don't touch that code if you don't even know about "Serial2"

This commit is contained in:
Thomas Göttgens 2022-12-22 17:43:55 +01:00
parent 23d6b815f5
commit 1a3f2a8ab5
3 changed files with 9 additions and 10 deletions

View File

@ -24,7 +24,7 @@
#endif #endif
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) #if defined(ARCH_ESP32) || defined(ARCH_NRF52)
#include "modules/ExternalNotificationModule.h" #include "modules/ExternalNotificationModule.h"
#if !defined(TTGO_T_ECHO) #if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
#include "modules/SerialModule.h" #include "modules/SerialModule.h"
#endif #endif
#endif #endif
@ -63,7 +63,7 @@ void setupModules()
new DeviceTelemetryModule(); new DeviceTelemetryModule();
new EnvironmentTelemetryModule(); new EnvironmentTelemetryModule();
#endif #endif
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) #if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
new SerialModule(); new SerialModule();
#endif #endif
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32

View File

@ -46,6 +46,8 @@
*/ */
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
#define RXD2 16 #define RXD2 16
#define TXD2 17 #define TXD2 17
#define RX_BUFFER 128 #define RX_BUFFER 128
@ -92,7 +94,6 @@ bool SerialModule::checkIsConnected()
int32_t SerialModule::runOnce() int32_t SerialModule::runOnce()
{ {
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
/* /*
Uncomment the preferences below if you want to use the module Uncomment the preferences below if you want to use the module
without having to configure it from the PythonAPI or WebUI. without having to configure it from the PythonAPI or WebUI.
@ -224,9 +225,6 @@ int32_t SerialModule::runOnce()
return INT32_MAX; return INT32_MAX;
} }
#else
return INT32_MAX;
#endif
} }
MeshPacket *SerialModuleRadio::allocReply() MeshPacket *SerialModuleRadio::allocReply()
@ -252,7 +250,6 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
{ {
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
if (moduleConfig.serial.enabled) { if (moduleConfig.serial.enabled) {
if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) {
// in API mode we don't care about stuff from radio. // in API mode we don't care about stuff from radio.
@ -311,8 +308,6 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
} else { } else {
DEBUG_MSG("Serial Module Disabled\n"); DEBUG_MSG("Serial Module Disabled\n");
} }
#endif
return ProcessMessage::CONTINUE; // Let others look at this message also if they want return ProcessMessage::CONTINUE; // Let others look at this message also if they want
} }
#endif

View File

@ -8,6 +8,8 @@
#include "Router.h" #include "Router.h"
#include <functional> #include <functional>
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
class SerialModule : public StreamAPI, private concurrency::OSThread class SerialModule : public StreamAPI, private concurrency::OSThread
{ {
bool firstTime = 1; bool firstTime = 1;
@ -68,3 +70,5 @@ class SerialModuleRadio : public MeshModule
}; };
extern SerialModuleRadio *serialModuleRadio; extern SerialModuleRadio *serialModuleRadio;
#endif