Show error popups for at least 10s
This commit is contained in:
parent
67b19368b0
commit
64ff7b3439
|
@ -5,4 +5,4 @@ touchgfx_path := ../Middlewares/ST/touchgfx
|
||||||
# Location of the TouchGFX Environment
|
# Location of the TouchGFX Environment
|
||||||
touchgfx_env := C:/TouchGFX/4.21.2/env
|
touchgfx_env := C:/TouchGFX/4.21.2/env
|
||||||
# Optional additional compiler flags
|
# 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
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
#include "gui/common/NamedField.hpp"
|
#include "gui/common/NamedField.hpp"
|
||||||
|
|
||||||
|
constexpr int32_t SHOW_ERRORS_FOR = 10000; // ms
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
#endif
|
||||||
#include "vehicle_state.h"
|
#include "vehicle_state.h"
|
||||||
|
|
||||||
DriverViewPresenter::DriverViewPresenter(DriverViewView &v)
|
DriverViewPresenter::DriverViewPresenter(DriverViewView &v)
|
||||||
|
@ -54,9 +59,15 @@ void DriverViewPresenter::updateProgress() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverViewPresenter::updateErrorPopup() {
|
void DriverViewPresenter::updateErrorPopup() {
|
||||||
|
static uint32_t last_error = 0;
|
||||||
if (vehicle_state.ts_state == TS_ERROR) {
|
if (vehicle_state.ts_state == TS_ERROR) {
|
||||||
view.showAMSError();
|
view.showAMSError();
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
last_error = HAL_GetTick();
|
||||||
|
} else if (HAL_GetTick() - last_error > SHOW_ERRORS_FOR) {
|
||||||
|
#else
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
view.clearErrorPopup();
|
view.clearErrorPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue