diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index fc8f72781..abba6fe7d 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -176,7 +176,8 @@ bool NMEAGPS::lookForLocation() p.latitude_i = toDegInt(loc.lat); p.longitude_i = toDegInt(loc.lng); - p.altitude_hae = reader.altitude.meters() + reader.geoidHeight.meters(); + p.altitude_geoidal_seperation = reader.geoidHeight.meters(); + p.altitude_hae = reader.altitude.meters() + p.altitude_geoidal_seperation; p.altitude = reader.altitude.meters(); p.fix_quality = fixQual; diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index a049651bd..7ff90d9ca 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -19,11 +19,13 @@ #endif #ifdef ARCH_ESP32 #include "modules/esp32/RangeTestModule.h" -#include "modules/esp32/SerialModule.h" #include "modules/esp32/StoreForwardModule.h" #endif #if defined(ARCH_ESP32) || defined(ARCH_NRF52) #include "modules/ExternalNotificationModule.h" +#if !defined(TTGO_T_ECHO) +#include "modules/SerialModule.h" +#endif #endif /** * Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 881dcc17a..39ef08a8e 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -34,7 +34,7 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr // Log packet size and list of fields DEBUG_MSG("POSITION node=%08x l=%d %s%s%s%s%s%s%s%s%s%s%s%s%s\n", getFrom(&mp), mp.decoded.payload.size, p.latitude_i ? "LAT " : "", p.longitude_i ? "LON " : "", p.altitude ? "MSL " : "", p.altitude_hae ? "HAE " : "", - p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "", + p.altitude_geoidal_seperation ? "GEO " : "", p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "", p.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.timestamp ? "PTS " : "", p.time ? "TIME " : ""); @@ -75,6 +75,9 @@ MeshPacket *PositionModule::allocReply() p.altitude = node->position.altitude; else p.altitude_hae = node->position.altitude_hae; + + if (pos_flags & Config_PositionConfig_PositionFlags_GEOIDAL_SEPERATION) + p.altitude_geoidal_seperation = node->position.altitude_geoidal_seperation; } if (pos_flags & Config_PositionConfig_PositionFlags_DOP) { diff --git a/src/modules/esp32/SerialModule.cpp b/src/modules/SerialModule.cpp similarity index 93% rename from src/modules/esp32/SerialModule.cpp rename to src/modules/SerialModule.cpp index 0a7f4f685..7f07c1bba 100644 --- a/src/modules/esp32/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -69,8 +69,7 @@ SerialModuleRadio::SerialModuleRadio() : SinglePortModule("SerialModuleRadio", P int32_t SerialModule::runOnce() { -#ifdef ARCH_ESP32 - +#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) /* Uncomment the preferences below if you want to use the module without having to configure it from the PythonAPI or WebUI. @@ -140,22 +139,29 @@ int32_t SerialModule::runOnce() baud = 921600; } +#ifdef ARCH_ESP32 if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { Serial2.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd); } else { Serial2.begin(baud, SERIAL_8N1, RXD2, TXD2); } +#else + if (moduleConfig.serial.rxd && moduleConfig.serial.txd) + Serial2.setPins(moduleConfig.serial.rxd, moduleConfig.serial.txd); + Serial2.begin(baud, SERIAL_8N1); + +#endif if (moduleConfig.serial.timeout) { - Serial2.setTimeout( - moduleConfig.serial.timeout); // Number of MS to wait to set the timeout for the string. - + Serial2.setTimeout(moduleConfig.serial.timeout); // Number of MS to wait to set the timeout for the string. } else { Serial2.setTimeout(TIMEOUT); // Number of MS to wait to set the timeout for the string. } +#ifdef ARCH_ESP32 Serial2.setRxBufferSize(RX_BUFFER); +#endif serialModuleRadio = new SerialModuleRadio(); @@ -209,8 +215,7 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies) ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) { -#ifdef ARCH_ESP32 - +#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) if (moduleConfig.serial.enabled) { auto &p = mp.decoded; @@ -244,6 +249,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) Serial2.printf("%s", p.payload.bytes); } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { + // TODO this needs to be implemented } } diff --git a/src/modules/esp32/SerialModule.h b/src/modules/SerialModule.h similarity index 100% rename from src/modules/esp32/SerialModule.h rename to src/modules/SerialModule.h