diff --git a/src/graphics/display.rs b/src/graphics/display.rs index 6c1e364..c2a6f7b 100644 --- a/src/graphics/display.rs +++ b/src/graphics/display.rs @@ -50,12 +50,12 @@ impl<'a, T: SmartLedsWrite + 'a> Output<'a, SegmentSpace> for BikeOutput Option<&Self::Controls> { - Some(&self.controls) + fn controls(&mut self) -> Option<&mut Self::Controls> { + Some(&mut self.controls) } } -impl<'a, T: SmartLedsWriteAsync + 'a> OutputAsync<'a, SegmentSpace> for BikeOutput where T::Color: 'static + Copy + Fract8Ops + WithGamma + Default + Debug + AsMilliwatts + 'a { +impl<'a, T: SmartLedsWriteAsync + 'a> OutputAsync<'a, SegmentSpace> for BikeOutput where T::Color: 'static + Copy + Mul + WithGamma + Default + Debug + AsMilliwatts + 'a { async fn commit_async(&mut self) -> Result<(), T::Error> where T: SmartLedsWriteAsync { self.writer.controls().set_brightness(self.controls.brightness()); self.writer.controls().set_on(self.controls.is_on()); @@ -67,8 +67,8 @@ impl<'a, T: SmartLedsWriteAsync + 'a> OutputAsync<'a, SegmentSpace> for BikeOutp type Error = T::Error; type Controls = DisplayControls; - fn controls(&self) -> Option<&Self::Controls> { - Some(&self.controls) + fn controls(&mut self) -> Option<&mut Self::Controls> { + Some(&mut self.controls) } } diff --git a/src/graphics/oled_ui.rs b/src/graphics/oled_ui.rs index a41e0f8..2b5c547 100644 --- a/src/graphics/oled_ui.rs +++ b/src/graphics/oled_ui.rs @@ -10,9 +10,9 @@ use embedded_graphics::primitives::{Line, PrimitiveStyle, PrimitiveStyleBuilder, use embedded_graphics::text::{Alignment, Text}; use embedded_graphics::{image::Image, prelude::Point, Drawable}; use enum_map::EnumMap; -use figments::liber8tion::trig::sin8; +use figments::liber8tion::trig::Trig8; use figments::mappings::embedded_graphics::Matrix2DSpace; -use figments::{liber8tion::trig::cos8, mappings::embedded_graphics::EmbeddedGraphicsSampler}; +use figments::{mappings::embedded_graphics::EmbeddedGraphicsSampler}; use figments::prelude::*; use nalgebra::Vector2; use micromath::F32Ext; diff --git a/src/graphics/ssd1306.rs b/src/graphics/ssd1306.rs index 75873bf..bb62d15 100644 --- a/src/graphics/ssd1306.rs +++ b/src/graphics/ssd1306.rs @@ -62,7 +62,7 @@ impl AdditivePixelSink for SsdPixel { Fract8::MIN => (), Fract8::MAX => self.set_pixel(pixel), _ => { - let dither_value = DITHER_MAP[opacity as usize / 17]; + let dither_value = DITHER_MAP[opacity.to_raw() as usize / 17]; let dither_x = self.coords.x % 4; let dither_y = self.coords.y % 4; if dither_value.shr(dither_x).shr(dither_y * 4).bitand(0x01) == 1 { @@ -231,14 +231,14 @@ impl<'a> OutputAsync<'a, Matrix2DSpace> for SsdOutput { self.is_on = new_power; } if self.last_brightness != new_brightness { - self.target.set_brightness(ssd1306::prelude::Brightness::custom(1, new_brightness)).await.unwrap(); + self.target.set_brightness(ssd1306::prelude::Brightness::custom(1, new_brightness.to_raw())).await.unwrap(); self.last_brightness = new_brightness; } self.target.draw(&self.pixbuf).await } - fn controls(&self) -> Option<&Self::Controls> { - Some(&self.controls) + fn controls(&mut self) -> Option<&mut Self::Controls> { + Some(&mut self.controls) } } \ No newline at end of file diff --git a/src/tasks/oled.rs b/src/tasks/oled.rs index 5e4aabb..4799525 100644 --- a/src/tasks/oled.rs +++ b/src/tasks/oled.rs @@ -9,12 +9,12 @@ use log::*; use crate::{animation::Animation, events::{Personality, Prediction}, graphics::{display::DisplayControls, oled_ui::{OledUniforms, Screen}}}; #[cfg(feature="oled")] -pub type OledUiSurfacePool = BufferedSurfacePool; +pub type OledUiSurfacePool = figments::surface::BufferedSurfacePool; #[cfg(not(feature="oled"))] -pub type OledUiSurfacePool = NullBufferPool; +pub type OledUiSurfacePool = figments::surface::NullBufferPool; -type OledSurface = >::Surface; +type OledSurface = ::Surface; pub type LockedUniforms = Arc>; diff --git a/src/tasks/safetyui.rs b/src/tasks/safetyui.rs index 6df4578..a0623e3 100644 --- a/src/tasks/safetyui.rs +++ b/src/tasks/safetyui.rs @@ -20,7 +20,7 @@ pub struct SafetyUi { } impl>> SafetyUi { - pub fn new>(surfaces: &mut SS, display: DisplayControls) -> Self where SS::Error: Debug { + pub fn new>(surfaces: &mut SS, display: DisplayControls) -> Self where SS::Error: Debug { let ret = Self { overlay: SurfaceBuilder::build(surfaces) .rect(Rectangle::everything()) diff --git a/src/tasks/ui.rs b/src/tasks/ui.rs index 20eaff9..300e0ec 100644 --- a/src/tasks/ui.rs +++ b/src/tasks/ui.rs @@ -23,7 +23,7 @@ pub struct Ui { } impl>> Ui { - pub fn new>(surfaces: &mut SS) -> Self where SS::Error: Debug { + pub fn new>(surfaces: &mut SS) -> Self where SS::Error: Debug { Self { background: SurfaceBuilder::build(surfaces) .rect(Rectangle::everything())