New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem on ESP platform with Embassy #5219
Comments
Did you import the Slider? Adding it into the
That sounds like a bug to me... |
Just realize that i've made a really dumb question. Sorry for that.
The slint code works well on slintpad. So there may be something wrong inside |
After update to slint 1.6.0, things are not getting better much. switch_animate_1.6.0.mp4 |
How are you rendering to the screen? We made a change in 1.6 regarding the dirty regions. Render now returns the region that has multiple rectangles, all of which need to be flushed to the screen. |
My whole project code is here, everything about slint is in ui.rs, the render loop looks like this: loop {
slint::platform::update_timers_and_animations();
window.draw_if_needed(|renderer| {
renderer.render_by_line(DisplayWrapper{
display: &mut display,
line_buffer: &mut line_buffer
});
});
if !window.has_active_animations() {
if let Some(duration) = slint::platform::duration_until_next_timer_update() {
Timer::after(Duration::from_millis(duration.as_millis() as u64)).await;
continue;
}
}
Timer::after(Duration::from_millis(10)).await;
} and the struct DisplayWrapper<'a, T>{
display: &'a mut T,
line_buffer: &'a mut [slint::platform::software_renderer::Rgb565Pixel],
}
impl<T: DrawTarget<Color = Rgb565>>
slint::platform::software_renderer::LineBufferProvider for DisplayWrapper<'_, T>
{
type TargetPixel = slint::platform::software_renderer::Rgb565Pixel;
fn process_line(
&mut self,
line: usize,
range: core::ops::Range<usize>,
render_fn: impl FnOnce(&mut [Self::TargetPixel]),
) {
// Render into the line
render_fn(&mut self.line_buffer[range.clone()]);
self.display.fill_contiguous(
&Rectangle::new(Point::new(range.start as _, line as _), Size::new(range.len() as _, 1)),
self.line_buffer[range.clone()].iter().map(|p| RawU16::new(p.0).into())
).map_err(drop).unwrap();
}
}
No, I'm using |
Thanks for confirming. So it can’t be that. Does the background change work if you remove the animation on the background property? (Not a solution of course, but helps narrow down a theory I have) |
switch_1.6.0.mp4Just like when using slint 1.5.1 as i shown on top of this issue, the only difference between animated version and no animation version is that no animation version could change the color correctly rather than a unexpected deeper or lighter color. |
Ouch, ok, so my theory of it being related to the time is not true either :(. Since you're calling |
@tronical I've added debug output in |
I'm using ESP32C3 and following the Official MCU guide to build a demo. It works but i encounter two problems.
My Cargo.toml slint part
My
.slint
fileI'm using linebuffer method with super loop approach by following the guide.
Can't use
Slider
widget, when addSlider
in my.slint
, compiler will error out with:When toggled switch, not full background freshed, only switch area changed.
switch.mp4
And when config
animate
tobackground
, display get even weird.switch_animate.mp4
The text was updated successfully, but these errors were encountered: