thermometer engine blocked state introduced
This commit is contained in:
parent
43078c37e0
commit
698738a17b
14
my_src/hmi.c
14
my_src/hmi.c
@ -20,6 +20,7 @@ const uint32_t STORAGE_MAGIC = 0xaffe000a;
|
||||
const uint8_t COLD_COUNT_THRESHOLD = 40;
|
||||
const uint32_t HOT_TEMPERATURE_THRESHOLD = 5;
|
||||
|
||||
const char THERMOMETER_STATE_MARKS[TE_LAST] = {'I', 'H', 'C', 'C', 'C', 'B'};
|
||||
|
||||
|
||||
|
||||
@ -66,7 +67,7 @@ void updateDisplay(void *handle) {
|
||||
LED_P8x16Str(0, 4, buf);
|
||||
|
||||
|
||||
sprintf(buf, " %5ds", lDisplay->overrunTime);
|
||||
sprintf(buf, "%c %5ds", THERMOMETER_STATE_MARKS[lDisplay->thermometerEngineState], lDisplay->overrunTime);
|
||||
// static uint32_t h = 0;
|
||||
// static uint32_t c = 0;
|
||||
// uint32_t i = HAL_GetTick();
|
||||
@ -103,19 +104,25 @@ void thermometerEngine(void *handle) {
|
||||
break;
|
||||
case TE_CONFIRMED:
|
||||
disableAlarm();
|
||||
lDisplay->thermometerEngineState = TE_IDLE;
|
||||
lDisplay->thermometerEngineState = TE_BLOCKED;
|
||||
break;
|
||||
case TE_BLOCKED:
|
||||
break;
|
||||
default:
|
||||
lDisplay->thermometerEngineState = TE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void thermometerEngineConfirmAlarm() {
|
||||
static void thermometerEngineConfirmAlarm() {
|
||||
if (display.thermometerEngineState == TE_UNCONFIRMED) {
|
||||
display.thermometerEngineState = TE_CONFIRMED;
|
||||
}
|
||||
}
|
||||
|
||||
static void thermometerEngineUnblock() {
|
||||
display.thermometerEngineState = TE_IDLE;
|
||||
}
|
||||
|
||||
void hmiInit() {
|
||||
eepromRead(STORAGE_ADDRESS, &storage, sizeof(storage));
|
||||
if (storage.magic == STORAGE_MAGIC) {
|
||||
@ -222,6 +229,7 @@ void buttonShort() {
|
||||
thermometerEngineConfirmAlarm();
|
||||
} else if (display.timerState == RUNNING || display.timerState == OVERRUN) {
|
||||
stopTimer();
|
||||
thermometerEngineUnblock();
|
||||
disableAlarm();
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
|
||||
typedef enum { TE_IDLE, TE_HOT, TE_COLD, TE_UNCONFIRMED, TE_CONFIRMED } tThermometerEngineState;
|
||||
typedef enum { TE_IDLE = 0, TE_HOT, TE_COLD, TE_UNCONFIRMED, TE_CONFIRMED, TE_BLOCKED, TE_LAST } tThermometerEngineState;
|
||||
|
||||
typedef struct {
|
||||
uint32_t toggle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user