-
Notifications
You must be signed in to change notification settings - Fork 4
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
temperatures: display over temperature notifications #32
Conversation
10e2a02
to
e4ab3f0
Compare
display.with_lock(|target| { | ||
Text::new("Temperature alert!", row_anchor(0), ui_text_style) | ||
.draw(target) | ||
.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these infallible calls? Otherwise an error here would bring down tacd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The embedded_graphics
crate propagates the Result
returned by the draw_iter()
method of a DrawTarget
trait implementation.
In our implementation this method call is in fact infallible:
Lines 143 to 172 in 24bd697
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error> | |
where | |
I: IntoIterator<Item = Pixel<Self::Color>>, | |
{ | |
let bpp = self.0.var_screen_info.bits_per_pixel / 8; | |
let xres = self.0.var_screen_info.xres; | |
let yres = self.0.var_screen_info.yres; | |
let line_length = self.0.fix_screen_info.line_length; | |
for Pixel(coord, color) in pixels { | |
let x = coord.x as u32; | |
let y = coord.y as u32; | |
if x >= xres || y >= yres { | |
continue; | |
} | |
let offset = line_length * y + bpp * x; | |
for b in 0..bpp { | |
self.0.frame[(offset + b) as usize] = match color { | |
BinaryColor::Off => 0x00, | |
BinaryColor::On => 0xff, | |
} | |
} | |
} | |
Ok(()) | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, in the future I would like to get rid of all these unwrap()
calls but as discussed this is fine for now.
There is already a topic that provides raw temperature information, but that topic provides updates at a fixed 2Hz rate. Add a new topic that only provides warnings and only publishes when the warning state changes. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Notify the user if the TAC is running hot. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Notify the user if their TAC is overheating. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
e4ab3f0
to
f9fd3c7
Compare
I had to do a manual rebase due to a merge conflict in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now.
Add warning on the LCD …
… and web interface if the LXA TAC is running hot.