You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a dashboard on MCU where screen will be updated very often (few times per second)
My current code runs in single thread / loop / task. The issue I am having is that a swipe event (PointerPressed, PointerMoved and PointerReleased) have to happen before the screen updates, otherwise the event is lost
My code is very simple
loop {
slint::platform::update_timers_and_animations();
if let Some(evt) = touchpad.read_one_touch_event(true) {
let position = slint::LogicalPosition::new(
(WINDOW_WIDTH - evt.x) as _,
(WINDOW_HEIGHT - evt.y) as _,
);
if evt.action == 0 {
window.dispatch_event(slint::platform::WindowEvent::PointerPressed {
position,
button: PointerEventButton::Left,
});
} else if evt.action == 2 {
window.dispatch_event(slint::platform::WindowEvent::PointerMoved { position });
} else if evt.action == 1 {
window.dispatch_event(slint::platform::WindowEvent::PointerReleased {
position,
button: PointerEventButton::Left,
});
}
}
window.draw_if_needed(|renderer| {
renderer.render_by_line(&mut draw_buffer);
});
if window.has_active_animations() {
continue;
}
// simulate data changing
app_window.set_data(data);
}
I've trying using embassy and async but I don't think it works the way async works in JS land
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am building a dashboard on MCU where screen will be updated very often (few times per second)
My current code runs in single thread / loop / task. The issue I am having is that a swipe event (
PointerPressed
,PointerMoved
andPointerReleased
) have to happen before the screen updates, otherwise the event is lostMy code is very simple
I've trying using embassy and async but I don't think it works the way async works in JS land
How is input handled when screen is updating?
Beta Was this translation helpful? Give feedback.
All reactions