platform: smart_leds: handle frame render error

This commit is contained in:
Victoria Fischer 2024-11-16 12:15:42 +01:00
parent e51ac02dc6
commit e3b5a9bde4

View File

@ -69,7 +69,9 @@ impl<T: SmartLedsWrite<Color = Rgb<u8>>, S: Surface, const PIXEL_NUM: usize> Dis
fn end_frame(&mut self) { fn end_frame(&mut self) {
let b = brightness_for_mw(self.pixbuf.as_milliwatts(), 255, self.max_mw); let b = brightness_for_mw(self.pixbuf.as_milliwatts(), 255, self.max_mw);
let _ = self.target.write(brightness(self.pixbuf.iter().cloned(), b)); if let Err(_) = self.target.write(brightness(self.pixbuf.iter().cloned(), b).map(|x| { rgb::Bgr::new(x.r, x.g, x.b)})) {
panic!("Could not write frame");
}
} }
fn render_frame(&mut self) { fn render_frame(&mut self) {