mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-01-13 11:53:37 +00:00
Extract calculation of temperature from raw sensor value.
This commit is contained in:
parent
146a06b0d1
commit
c92138f4b3
@ -76,7 +76,7 @@ void TemperatureWidget::paint(Painter& painter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !history.empty() ) {
|
if( !history.empty() ) {
|
||||||
const int32_t temp = -45 + history.back() * 5;
|
const int32_t temp = temperature(history.back());
|
||||||
const size_t temp_len = 3;
|
const size_t temp_len = 3;
|
||||||
painter.draw_string(
|
painter.draw_string(
|
||||||
{ static_cast<Coord>(rect.right() - (temp_len * 8)), rect.top() },
|
{ static_cast<Coord>(rect.right() - (temp_len * 8)), rect.top() },
|
||||||
@ -86,6 +86,10 @@ void TemperatureWidget::paint(Painter& painter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t TemperatureWidget::temperature(const int32_t sensor_value) {
|
||||||
|
return -45 + sensor_value * 5
|
||||||
|
}
|
||||||
|
|
||||||
/* TemperatureView *******************************************************/
|
/* TemperatureView *******************************************************/
|
||||||
|
|
||||||
TemperatureView::TemperatureView(NavigationView& nav) {
|
TemperatureView::TemperatureView(NavigationView& nav) {
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
void paint(Painter& painter) override;
|
void paint(Painter& painter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int32_t temperature(const uint32_t sensor_value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TemperatureView : public View {
|
class TemperatureView : public View {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user