Merge branch 'master' of github.com:meshtastic/Meshtastic-device

This commit is contained in:
Thomas Göttgens 2022-09-12 13:25:54 +02:00
commit a6bdff53c9
5 changed files with 22 additions and 10 deletions

View File

@ -176,7 +176,8 @@ bool NMEAGPS::lookForLocation()
p.latitude_i = toDegInt(loc.lat); p.latitude_i = toDegInt(loc.lat);
p.longitude_i = toDegInt(loc.lng); 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.altitude = reader.altitude.meters();
p.fix_quality = fixQual; p.fix_quality = fixQual;

View File

@ -19,11 +19,13 @@
#endif #endif
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
#include "modules/esp32/RangeTestModule.h" #include "modules/esp32/RangeTestModule.h"
#include "modules/esp32/SerialModule.h"
#include "modules/esp32/StoreForwardModule.h" #include "modules/esp32/StoreForwardModule.h"
#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)
#include "modules/SerialModule.h"
#endif
#endif #endif
/** /**
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else) * Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)

View File

@ -34,7 +34,7 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr
// Log packet size and list of fields // 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, 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.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.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.timestamp ? "PTS " : "",
p.time ? "TIME " : ""); p.time ? "TIME " : "");
@ -75,6 +75,9 @@ MeshPacket *PositionModule::allocReply()
p.altitude = node->position.altitude; p.altitude = node->position.altitude;
else else
p.altitude_hae = node->position.altitude_hae; 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) { if (pos_flags & Config_PositionConfig_PositionFlags_DOP) {

View File

@ -69,8 +69,7 @@ SerialModuleRadio::SerialModuleRadio() : SinglePortModule("SerialModuleRadio", P
int32_t SerialModule::runOnce() 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 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.
@ -140,22 +139,29 @@ int32_t SerialModule::runOnce()
baud = 921600; baud = 921600;
} }
#ifdef ARCH_ESP32
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
Serial2.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd); Serial2.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
} else { } else {
Serial2.begin(baud, SERIAL_8N1, RXD2, TXD2); 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) { if (moduleConfig.serial.timeout) {
Serial2.setTimeout( Serial2.setTimeout(moduleConfig.serial.timeout); // Number of MS to wait to set the timeout for the string.
moduleConfig.serial.timeout); // Number of MS to wait to set the timeout for the string.
} else { } else {
Serial2.setTimeout(TIMEOUT); // Number of MS to wait to set the timeout for the string. Serial2.setTimeout(TIMEOUT); // Number of MS to wait to set the timeout for the string.
} }
#ifdef ARCH_ESP32
Serial2.setRxBufferSize(RX_BUFFER); Serial2.setRxBufferSize(RX_BUFFER);
#endif
serialModuleRadio = new SerialModuleRadio(); serialModuleRadio = new SerialModuleRadio();
@ -209,8 +215,7 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
{ {
#ifdef ARCH_ESP32 #if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO)
if (moduleConfig.serial.enabled) { if (moduleConfig.serial.enabled) {
auto &p = mp.decoded; auto &p = mp.decoded;
@ -244,6 +249,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
Serial2.printf("%s", p.payload.bytes); Serial2.printf("%s", p.payload.bytes);
} else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) {
// TODO this needs to be implemented
} }
} }