From 0f4ac945591545cefb6c645573b1ef0a880cc745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 2 May 2024 12:48:50 +0200 Subject: [PATCH 1/4] fix building new TWC_mesh_v4 board --- variants/TWC_mesh_v4/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/TWC_mesh_v4/platformio.ini b/variants/TWC_mesh_v4/platformio.ini index 9cf25c685..481682143 100644 --- a/variants/TWC_mesh_v4/platformio.ini +++ b/variants/TWC_mesh_v4/platformio.ini @@ -1,6 +1,6 @@ [env:TWC_mesh_v4] extends = nrf52840_base -board = TWC_mesh_v4 +board = nordic_pca10059 board_level = extra build_flags = ${nrf52840_base.build_flags} -I variants/TWC_mesh_v4 -D TWC_mesh_v4 -L".pio\libdeps\TWC_mesh_v4\BSEC2 Software Library\src\cortex-m4\fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/TWC_mesh_v4> From 5f929a80244e7f5d4fda0df4571ecb0edbe55950 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Thu, 2 May 2024 20:13:36 +0800 Subject: [PATCH 2/4] Publish fixed position updates and consider changes in only altitude as an updated point (#3758) * AdminModule: Publish fixed position updates Enabled GPS thread when fixed position is updated, to let the GPS thread run once and publish the new fixed position. Signed-off-by: Andrew Yong * GPS: Consider changes in only altitude as an updated point Signed-off-by: Andrew Yong --------- Signed-off-by: Andrew Yong --- src/gps/GPS.cpp | 2 +- src/modules/AdminModule.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 17e35a4b3..1c1aac7ad 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1467,7 +1467,7 @@ bool GPS::lookForLocation() #endif // GPS_EXTRAVERBOSE // Is this a new point or are we re-reading the previous one? - if (!reader.location.isUpdated()) + if (!reader.location.isUpdated() && !reader.altitude.isUpdated()) return false; // check if a complete GPS solution set is available for reading diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 54eb577f7..37e798b3c 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -23,6 +23,10 @@ #include "mqtt/MQTT.h" #endif +#if !MESHTASTIC_EXCLUDE_GPS +#include "GPS.h" +#endif + AdminModule *adminModule; bool hasOpenEditTransaction; @@ -217,6 +221,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta nodeDB->setLocalPosition(r->set_fixed_position); config.position.fixed_position = true; saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); +#if !MESHTASTIC_EXCLUDE_GPS + if (gps != nullptr) + gps->enable(); +#endif } break; } From 0527fb10ce28fb054d74c9c0848717cdb2cc15e0 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Fri, 3 May 2024 00:14:44 +1200 Subject: [PATCH 3/4] Init. battery voltage from ADC reading, instead of fixed value (#3761) --- src/Power.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Power.cpp b/src/Power.cpp index 2658b74a4..770bf4b5a 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -223,7 +223,17 @@ class AnalogBatteryLevel : public HasBatteryLevel raw = raw / BATTERY_SENSE_SAMPLES; scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw; #endif - last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF + + if (!initial_read_done) { + // Flush the smoothing filter with an ADC reading, if the reading is plausibly correct + if (scaled > last_read_value) + last_read_value = scaled; + initial_read_done = true; + } else { + // Already initialized - filter this reading + last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF + } + // LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t) // (last_read_value)); } @@ -357,6 +367,8 @@ class AnalogBatteryLevel : public HasBatteryLevel const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS; // Start value from minimum voltage for the filter to not start from 0 // that could trigger some events. + // This value is over-written by the first ADC reading, it the voltage seems reasonable. + bool initial_read_done = false; float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS); uint32_t last_read_time_ms = 0; From d1b6f1142909efb9e82c1983c92670bc08712bce Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Thu, 2 May 2024 14:27:25 +0800 Subject: [PATCH 4/4] Fix t-echo gps failure --- variants/t-echo/variant.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/variants/t-echo/variant.h b/variants/t-echo/variant.h index 6a5146dc0..2abeed16d 100644 --- a/variants/t-echo/variant.h +++ b/variants/t-echo/variant.h @@ -131,7 +131,7 @@ External serial flash WP25R1635FZUIL0 // Note DIO2 is attached internally to the module to an analog switch for TX/RX switching #define SX1262_DIO3 \ (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main - // CPU? +// CPU? #define SX126X_BUSY (0 + 17) #define SX126X_RESET (0 + 25) // Not really an E22 but TTGO seems to be trying to clone that @@ -177,13 +177,13 @@ External serial flash WP25R1635FZUIL0 #define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake // Seems to be missing on this new board // #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS -#define PIN_GPS_TX (32 + 9) // This is for bits going TOWARDS the CPU -#define PIN_GPS_RX (32 + 8) // This is for bits going TOWARDS the GPS +#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS #define GPS_THREAD_INTERVAL 50 -#define PIN_SERIAL1_RX PIN_GPS_TX -#define PIN_SERIAL1_TX PIN_GPS_RX +#define PIN_SERIAL1_RX GPS_TX_PIN +#define PIN_SERIAL1_TX GPS_RX_PIN // PCF8563 RTC Module #define PCF8563_RTC 0x51