Skip to content
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

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

hnez
Copy link
Member

@hnez hnez commented Aug 30, 2023

Add warning on the LCD …

lcd

… and web interface if the LXA TAC is running hot.

web

display.with_lock(|target| {
Text::new("Temperature alert!", row_anchor(0), ui_text_style)
.draw(target)
.unwrap();
Copy link
Member

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?

Copy link
Member Author

@hnez hnez Sep 26, 2023

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:

tacd/src/ui/display.rs

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(())
}
}

Copy link
Member

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>
@hnez
Copy link
Member Author

hnez commented Sep 26, 2023

I had to do a manual rebase due to a merge conflict in web/src/TacComponents.tsx, invalidating the previous approvals.
Can I get a new approval? Also feel free to click merge.

Copy link
Member

@KarlK90 KarlK90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now.

@hnez hnez merged commit 60a84f0 into linux-automation:main Sep 26, 2023
13 checks passed
@hnez hnez deleted the temperature-limits branch October 6, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants