change Serial1 to BT_SERIAL and add debug preprocessor commands to all debug prints to console

This commit is contained in:
Sem van der Hoeven
2024-01-13 16:06:26 +01:00
parent 4708e87685
commit 7099d468d3

View File

@@ -22,6 +22,7 @@ Program to create a car monitor display using:
#define PIN_BT_RX 19 #define PIN_BT_RX 19
#define PIN_BT_TX 18 #define PIN_BT_TX 18
#define PIN_BT_STATE 3 /* connected/disconnected state of BT */ #define PIN_BT_STATE 3 /* connected/disconnected state of BT */
#define BT_SERIAL Serial1
#define MS(x) x * 1000 #define MS(x) x * 1000
#define S(x) MS(x) * 1000 #define S(x) MS(x) * 1000
@@ -95,7 +96,7 @@ char logo_flag = 0;
/* device info variables */ /* device info variables */
char init_device_info = 0; /* wether we are drawing CPU (0), RAM (1) or DISPLAY (2) */ char init_device_info = 0; /* wether we are drawing CPU (0), RAM (1) or DISPLAY (2) */
uint32_t ram_b_amount = 0; /* counts up to 96 to show the KB of ram */ uint32_t ram_b_amount = 0; /* counts up to 96 to show the KB of ram */
char device_label_i = -1; /* counter in the current device label */ char device_label_i = -1; /* counter in the current device label */
char bt_state = BT_INITIALISING; char bt_state = BT_INITIALISING;
@@ -150,8 +151,9 @@ void on_init_enter()
Timer3.attachInterrupt(update_ram_kb); Timer3.attachInterrupt(update_ram_kb);
logo_flag |= (1 << FLAG_LOGO_UPDATE); logo_flag |= (1 << FLAG_LOGO_UPDATE);
#if (DEBUG == 1)
Serial.println("Entering init state!"); Serial.println("Entering init state!");
#endif
} }
void on_init_run() void on_init_run()
@@ -275,7 +277,9 @@ void on_init_run()
void on_init_exit() void on_init_exit()
{ {
#if (DEBUG == 1)
Serial.println("Exiting init state!"); Serial.println("Exiting init state!");
#endif
display.clrScr(); display.clrScr();
Timer0.detachInterrupt(); Timer0.detachInterrupt();
Timer0.stop(); Timer0.stop();
@@ -289,13 +293,17 @@ void on_init_exit()
void on_main_enter() void on_main_enter()
{ {
#if (DEBUG == 1)
Serial.println("Entering main loop"); Serial.println("Entering main loop");
#endif
} }
void on_main_run() void on_main_run()
{ {
delay(500); delay(500);
#if (DEBUG == 1)
Serial.println("main!"); Serial.println("main!");
#endif
} }
void update_init_text() void update_init_text()
@@ -338,7 +346,9 @@ void update_device_info()
init_device_info = DEV_RAM; init_device_info = DEV_RAM;
device_label_i = 0; device_label_i = 0;
Timer3.start(50); Timer3.start(50);
#if (DEBUG == 1)
Serial.println("DEV RAM"); Serial.println("DEV RAM");
#endif
} }
break; break;
case DEV_RAM: case DEV_RAM:
@@ -421,7 +431,7 @@ void setup()
Serial.begin(9600); Serial.begin(9600);
#endif #endif
/* Serial1 is bluetooth module, pin 18 and 19. */ /* Serial1 is bluetooth module, pin 18 and 19. */
Serial1.begin(115200); BT_SERIAL.begin(115200);
/* Init display */ /* Init display */
display.InitLCD(); display.InitLCD();