perf(DisplayDriverTFT): Throttle alert redraws to prevent tearing

This commit is contained in:
2026-02-20 02:41:04 -08:00
parent ba8789797c
commit b68d36bb85
2 changed files with 11 additions and 1 deletions

View File

@@ -193,8 +193,16 @@ void DisplayDriverTFT::drawBoot(const ScreenState& st) {
}
void DisplayDriverTFT::drawAlert(const ScreenState& st) {
// Throttle redraws to ~24fps to prevent tearing
uint32_t now = millis();
if(now - _lastAlertDrawMs < ALERT_DRAW_INTERVAL_MS) {
return;
}
_lastAlertDrawMs = now;
uint32_t elapsed = millis() - st.alertStartMs;
uint8_t pulse = 180 + (uint8_t)(75.0f * sinf(elapsed / 300.0f));
// Slower pulse - divide by 1500 for ~9.4 second cycle (was 300 for ~1.9s)
uint8_t pulse = 180 + (uint8_t)(75.0f * sinf(elapsed / 1500.0f));
uint16_t bg = _tft.color565(pulse, 0, 0);
_tft.fillScreen(bg);