I wanted to make a goofy CLI app to sync my monitor with the moonlander, at a framerate of about 2-3 fps. This seems to be working fine for a couple of seconds or even minutes, but then Keymapp crashes. I am wondering if the API doesn't support multiple calls per some time period (I am doing 70 led updates per frame) or if something else is happening.
Going as fast at ~10 fps (maximum speed, limited by the time the screen capture takes) or as slow as 0.5 fps does the same thing. Also closing keymapp and changing the port doesn't help.
Code snippet:
for col in 0..MOONLANDER_WIDTH {
for row in 0..MOONLANDER_HEIGHT {
let mut average_pixel = (0, 0, 0);
for idx in (0..width).step_by(horizontal_step) {
for jdx in (0..height).step_by(vertical_step) {
/* average_pixel update */
}
}
let future = async move {
let kb_index = /* ... */;
if let Err(e) = api.set_rgb_led(kb_index, average.0 as u8, average.1 as u8, average.2 as u8, 0).await {
/* ... */
};
};
futures.push(task::spawn(async move {
future.await;
}));
}
for future in futures {
let _ = future.await;
}
tokio::time::sleep_until(/* ... */).await;
}
}
Keymapp v1.3.4
kontroll v1.0.3
rustc v1.84.1
Windows 10 Pro N build: 19045.5487 version: 22H2
I wanted to make a goofy CLI app to sync my monitor with the moonlander, at a framerate of about 2-3 fps. This seems to be working fine for a couple of seconds or even minutes, but then Keymapp crashes. I am wondering if the API doesn't support multiple calls per some time period (I am doing 70 led updates per frame) or if something else is happening.
Going as fast at ~10 fps (maximum speed, limited by the time the screen capture takes) or as slow as 0.5 fps does the same thing. Also closing keymapp and changing the port doesn't help.
Code snippet:
Keymapp v1.3.4
kontroll v1.0.3
rustc v1.84.1
Windows 10 Pro N build: 19045.5487 version: 22H2