improve handling of when to process bluetooth state change and add TODO for reading OBD2 data

This commit is contained in:
Sem van der Hoeven
2024-01-14 13:02:14 +01:00
parent a81322e46d
commit 5c774752ab

View File

@@ -37,7 +37,12 @@ void obd2_bt_get_state(obd2_bt_t *bt, char *state)
void obd2_bt_process(obd2_bt_t *bt)
{
if (bt->state != BT_CONNECTED)
{
__UINT32_TYPE__ bt_state = digitalRead(BT_STATE_PIN);
if (bt_state != bt->state)
{
if (bt_state)
{
bt->state = BT_CONNECTED;
@@ -47,4 +52,8 @@ void obd2_bt_process(obd2_bt_t *bt)
bt->state = BT_INITIALISING;
}
bt->on_state_change();
}
}
/* TODO read from Serial1 to read OBD2 data */
}