mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-16 04:31:04 +00:00
add waiting for ELM327 before init state
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
int current_state_id = 0;
|
||||
state_t states[STATE_AMOUNT] = {NULL, NULL};
|
||||
__UINT8_TYPE__ next = 0;
|
||||
static char has_init = 0;
|
||||
|
||||
__UINT8_TYPE__ statemachine_register_state(state_t *state, int index)
|
||||
{
|
||||
@@ -28,11 +29,17 @@ __UINT8_TYPE__ statemachine_init()
|
||||
}
|
||||
}
|
||||
current_state_id = 0;
|
||||
states[current_state_id].on_enter();
|
||||
}
|
||||
|
||||
void statemachine_loop()
|
||||
{
|
||||
|
||||
if (has_init == 0)
|
||||
{
|
||||
has_init = 1;
|
||||
states[current_state_id].on_enter();
|
||||
}
|
||||
|
||||
if (states[current_state_id].next == current_state_id)
|
||||
{
|
||||
next = 0;
|
||||
|
||||
Reference in New Issue
Block a user