style(esp32-32e): reformat code and fix display dimensions

This commit is contained in:
2026-02-17 04:10:03 -08:00
parent 0ace263324
commit f39364f67f
3 changed files with 61 additions and 47 deletions

View File

@@ -154,7 +154,11 @@ void DisplayDriverGFX::render(const ScreenState& state) {
break;
case ScreenID::ALERT:
drawAlert(state);
// Only redraw on first entry or screen change
if(_needsRedraw) {
drawAlert(state);
_needsRedraw = false;
}
break;
case ScreenID::DASHBOARD:
@@ -167,8 +171,9 @@ void DisplayDriverGFX::render(const ScreenState& state) {
}
void DisplayDriverGFX::drawAlert(const ScreenState& state) {
// Always redraw background for animation
uint32_t elapsed = millis() - state.alertStartMs;
uint8_t pulse = static_cast<uint8_t>(180.0f + 75.0f * sinf(elapsed / 300.0f));
uint8_cast<uint8_t_t pulse = static>(180.0f + 75.0f * sinf(elapsed / 300.0f));
uint16_t bg = _gfx->color565(pulse, 0, 0);
_gfx->fillScreen(bg);