graphics: more figments updates
This commit is contained in:
@@ -50,12 +50,12 @@ impl<'a, T: SmartLedsWrite + 'a> Output<'a, SegmentSpace> for BikeOutput<T, T::C
|
||||
})
|
||||
}
|
||||
|
||||
fn controls(&self) -> 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<T, T::Color> where T::Color: 'static + Copy + Fract8Ops + WithGamma + Default + Debug + AsMilliwatts + 'a {
|
||||
impl<'a, T: SmartLedsWriteAsync + 'a> OutputAsync<'a, SegmentSpace> for BikeOutput<T, T::Color> where T::Color: 'static + Copy + Mul<Fract8, Output = T::Color> + 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -62,7 +62,7 @@ impl AdditivePixelSink<BinaryColor> 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user