From 04141e9fcd490e04884f5d7f4054fa876b5e985a Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 29 Dec 2023 18:23:32 -0800 Subject: [PATCH] Serial config fix and available func call --- VortexEngine/src/Serial/Serial.cpp | 10 +++++++--- VortexEngine/src/VortexConfig.h | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/VortexEngine/src/Serial/Serial.cpp b/VortexEngine/src/Serial/Serial.cpp index ac1e6a19f8..f858954b39 100644 --- a/VortexEngine/src/Serial/Serial.cpp +++ b/VortexEngine/src/Serial/Serial.cpp @@ -12,6 +12,10 @@ #include #endif +#ifdef VORTEX_EMBEDDED +#include +#endif + bool SerialComs::m_serialConnected = false; uint32_t SerialComs::m_lastCheck = 0; @@ -51,15 +55,15 @@ bool SerialComs::checkSerial() if (!Vortex::vcallbacks()->serialCheck()) { return false; } - Vortex::vcallbacks()->serialBegin(9600); + Vortex::vcallbacks()->serialBegin(SERIAL_BAUD_RATE); #else // This will check if the serial communication is open - if (!Serial) { + if (!Serial.available()) { // serial is not connected return false; } // Begin serial communications - Serial.begin(9600); + Serial.begin(SERIAL_BAUD_RATE); #endif #endif // serial is now connected diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index f031a7ea01..86c6fabcfc 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -299,6 +299,11 @@ #define VAL_OPTION_3 170 #define VAL_OPTION_4 255 +// Serial Baud Rate +// +// The serial connection baud rate for the editor and anything else serial +#define SERIAL_BAUD_RATE 9600 + // =================================================================== // Boolean Configurations (0 or 1)