tested ELM327 connection and refactored bt driver to include elm327

This commit is contained in:
Sem van der Hoeven
2024-01-18 23:29:16 +01:00
parent 249f22c053
commit 6ffb01b535
4 changed files with 41 additions and 35 deletions

View File

@@ -14,7 +14,7 @@ Program to create a car monitor display using:
#include "obd2_display.h"
#include "statemachine.h"
#include "obd2_util.h"
#include "obd2_bt.h"
#include "obd2_elm327.h"
#define DEBUG 1
// #define RTT_MR 0x400E1A30U
@@ -86,7 +86,7 @@ char device_label_i = -1; /* counter in the current device label */
char bt_state = BT_INITIALISING;
obd2_bt_t bt;
obd2_elm327_t elm327;
void on_init_enter();
void on_init_run();
@@ -191,7 +191,7 @@ void on_init_run()
display.print("Bluetooth ", (display.getDisplayXSize() / 2) - (11 * display.getFontXsize()), initialization_y + 50);
char current_bt_state[BT_STATE_LENGTH];
obd2_bt_get_state(&bt, (char *)current_bt_state);
obd2_elm327_get_state(&elm327, (char *)current_bt_state);
display.print(current_bt_state, (display.getDisplayXSize() / 2) + display.getFontXsize(), initialization_y + 50);
display.setBackColor(VGA_BLACK);
@@ -437,7 +437,7 @@ void setup()
/* Serial1 is bluetooth module, pin 18 and 19. */
Serial1.begin(BT_BAUD);
obd2_bt_init(&bt);
obd2_elm327_init(&elm327);
}
void loop()