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 uint8_t COLD_COUNT_THRESHOLD = 40;
|
||||||
const uint32_t HOT_TEMPERATURE_THRESHOLD = 5;
|
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);
|
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 h = 0;
|
||||||
// static uint32_t c = 0;
|
// static uint32_t c = 0;
|
||||||
// uint32_t i = HAL_GetTick();
|
// uint32_t i = HAL_GetTick();
|
||||||
@ -103,19 +104,25 @@ void thermometerEngine(void *handle) {
|
|||||||
break;
|
break;
|
||||||
case TE_CONFIRMED:
|
case TE_CONFIRMED:
|
||||||
disableAlarm();
|
disableAlarm();
|
||||||
lDisplay->thermometerEngineState = TE_IDLE;
|
lDisplay->thermometerEngineState = TE_BLOCKED;
|
||||||
|
break;
|
||||||
|
case TE_BLOCKED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lDisplay->thermometerEngineState = TE_IDLE;
|
lDisplay->thermometerEngineState = TE_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thermometerEngineConfirmAlarm() {
|
static void thermometerEngineConfirmAlarm() {
|
||||||
if (display.thermometerEngineState == TE_UNCONFIRMED) {
|
if (display.thermometerEngineState == TE_UNCONFIRMED) {
|
||||||
display.thermometerEngineState = TE_CONFIRMED;
|
display.thermometerEngineState = TE_CONFIRMED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void thermometerEngineUnblock() {
|
||||||
|
display.thermometerEngineState = TE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
void hmiInit() {
|
void hmiInit() {
|
||||||
eepromRead(STORAGE_ADDRESS, &storage, sizeof(storage));
|
eepromRead(STORAGE_ADDRESS, &storage, sizeof(storage));
|
||||||
if (storage.magic == STORAGE_MAGIC) {
|
if (storage.magic == STORAGE_MAGIC) {
|
||||||
@ -222,6 +229,7 @@ void buttonShort() {
|
|||||||
thermometerEngineConfirmAlarm();
|
thermometerEngineConfirmAlarm();
|
||||||
} else if (display.timerState == RUNNING || display.timerState == OVERRUN) {
|
} else if (display.timerState == RUNNING || display.timerState == OVERRUN) {
|
||||||
stopTimer();
|
stopTimer();
|
||||||
|
thermometerEngineUnblock();
|
||||||
disableAlarm();
|
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 {
|
typedef struct {
|
||||||
uint32_t toggle;
|
uint32_t toggle;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user