Show error popups for at least 10s

This commit is contained in:
Jasper Blanckenburg 2023-06-26 17:18:24 +02:00
parent 67b19368b0
commit 64ff7b3439
2 changed files with 12 additions and 1 deletions

View File

@ -5,4 +5,4 @@ touchgfx_path := ../Middlewares/ST/touchgfx
# Location of the TouchGFX Environment
touchgfx_env := C:/TouchGFX/4.21.2/env
# Optional additional compiler flags
user_cflags := -DUSE_BPP=16 -std=gnu++1z -Wno-cast-qual -Wno-missing-declarations -Wno-format-truncation
user_cflags := -DUSE_BPP=16 -std=gnu++1z -Wno-cast-qual -Wno-missing-declarations -Wno-format-truncation -Wno-unused-variable

View File

@ -3,6 +3,11 @@
#include "gui/common/NamedField.hpp"
constexpr int32_t SHOW_ERRORS_FOR = 10000; // ms
#ifndef SIMULATOR
#include "stm32h7xx_hal.h"
#endif
#include "vehicle_state.h"
DriverViewPresenter::DriverViewPresenter(DriverViewView &v)
@ -54,9 +59,15 @@ void DriverViewPresenter::updateProgress() {
}
void DriverViewPresenter::updateErrorPopup() {
static uint32_t last_error = 0;
if (vehicle_state.ts_state == TS_ERROR) {
view.showAMSError();
#ifndef SIMULATOR
last_error = HAL_GetTick();
} else if (HAL_GetTick() - last_error > SHOW_ERRORS_FOR) {
#else
} else {
#endif
view.clearErrorPopup();
}
}