Refactor header files - includes should only declare, not define

This commit is contained in:
Sassa NF
2024-12-23 09:36:23 +00:00
parent cb6b93f9ff
commit ca6a61ff93
6 changed files with 132 additions and 73 deletions
+5 -3
View File
@@ -57,6 +57,7 @@ void _onUsbEvent0(void *arg, esp_event_base_t event_base, int32_t event_id,
bool Comms::initComms(Config &c)
{
bool fine = false;
#ifndef HELTEC
if (c.listen_on_usb.equalsIgnoreCase("readline"))
{
// comms using readline plaintext protocol
@@ -68,13 +69,14 @@ bool Comms::initComms(Config &c)
fine = true;
}
#endif
if (c.listen_on_serial0.equalsIgnoreCase("readline"))
{
// comms using readline plaintext protocol
Comms0 = new ReadlineComms("UART0", Serial0);
Serial0.onReceive(_onReceive0, false);
Serial0.begin(115200);
Comms0 = new ReadlineComms("UART0", SERIAL0);
SERIAL0.onReceive(_onReceive0, false);
SERIAL0.begin(115200);
Serial.println("Initialized communications on Serial0 using readline protocol");
}
+7 -1
View File
@@ -5,6 +5,12 @@
#include <HardwareSerial.h>
#include <config.h>
#ifdef HELTEC
#define SERIAL0 Serial
#else
#define SERIAL0 Serial0
#endif
enum MessageType
{
WRAP = 0,
@@ -69,7 +75,7 @@ struct Comms
struct NoopComms : Comms
{
NoopComms() : Comms("no-op", Serial0) {};
NoopComms() : Comms("no-op", SERIAL0) {};
virtual bool send(Message &) { return true; };
virtual void _onReceive() {};