From 3f1161b68b746b3e0d82fe6a6755582219ceb418 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 13:04:28 -0700 Subject: [PATCH 1/8] bug #53 - report the error on console and fixup (will add analytics in a separate call) --- src/MeshRadio.cpp | 12 +++++++++++- src/MeshRadio.h | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/MeshRadio.cpp b/src/MeshRadio.cpp index 3ac730bc..b3a74e7f 100644 --- a/src/MeshRadio.cpp +++ b/src/MeshRadio.cpp @@ -130,6 +130,8 @@ void MeshRadio::reloadConfig() ErrorCode MeshRadio::send(MeshPacket *p) { + lastTxStart = millis(); + if (useHardware) return rf95.send(p); else { @@ -138,7 +140,15 @@ ErrorCode MeshRadio::send(MeshPacket *p) } } +#define TX_WATCHDOG_TIMEOUT 30 * 1000 + void MeshRadio::loop() { - // Currently does nothing, since we do it all in ISRs now + // It should never take us more than 30 secs to send a packet, if it does, we have a bug + uint32_t now = millis(); + if (lastTxStart != 0 && (now - lastTxStart) > TX_WATCHDOG_TIMEOUT && rf95.mode() == RHGenericDriver::RHModeTx) { + DEBUG_MSG("ERROR! Bug! Tx packet took too long to send, forcing radio into rx mode"); + rf95.setModeRx(); + lastTxStart = 0; // Stop checking for now, because we just warned the developer + } } diff --git a/src/MeshRadio.h b/src/MeshRadio.h index 1b7ecfb5..293d5852 100644 --- a/src/MeshRadio.h +++ b/src/MeshRadio.h @@ -87,10 +87,11 @@ class MeshRadio void reloadConfig(); private: - // RHDatagram manager; // RHReliableDatagram manager; // don't use mesh yet RHMesh manager; - // MeshRXHandler rxHandler; + + /// Used for the tx timer watchdog, to check for bugs in our transmit code, msec of last time we did a send + uint32_t lastTxStart = 0; /// low level send, might block for mutiple seconds ErrorCode sendTo(NodeNum dest, const uint8_t *buf, size_t len); From 34ead2d68ef3bda7dc238854ff80facf66b262f1 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 13:33:24 -0700 Subject: [PATCH 2/8] add support for reporting device errors up through the phone to analytics related to https://github.com/meshtastic/Meshtastic-esp32/issues/53 --- proto | 2 +- src/MeshBluetoothService.cpp | 24 +++++++++++++++++++----- src/MeshRadio.cpp | 2 ++ src/NodeDB.cpp | 11 ++++++++++- src/error.h | 7 +++++++ src/mesh.pb.h | 19 ++++++++++++++----- 6 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 src/error.h diff --git a/proto b/proto index 398fdf36..1b2449b5 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 398fdf362518e9d6869247cef09f2e071b715639 +Subproject commit 1b2449b50d11f66d90511559e94cdf40f525fafb diff --git a/src/MeshBluetoothService.cpp b/src/MeshBluetoothService.cpp index 529a0124..d65df83b 100644 --- a/src/MeshBluetoothService.cpp +++ b/src/MeshBluetoothService.cpp @@ -224,6 +224,24 @@ class FromNumCharacteristic : public CallbackCharacteristic } }; +class MyNodeInfoCharacteristic : public ProtobufCharacteristic +{ + public: + MyNodeInfoCharacteristic() + : ProtobufCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, MyNodeInfo_fields, + &myNodeInfo) + { + } + + void onRead(BLECharacteristic *c) + { + ProtobufCharacteristic::onRead(c); + + myNodeInfo.error_code = 0; // The phone just read us, so throw it away + myNodeInfo.error_address = 0; + } +}; + FromNumCharacteristic *meshFromNumCharacteristic; /** @@ -254,11 +272,7 @@ BLEService *createMeshBluetoothService(BLEServer *server) addWithDesc(service, meshFromNumCharacteristic, "fromRadio"); addWithDesc(service, new ToRadioCharacteristic, "toRadio"); addWithDesc(service, new FromRadioCharacteristic, "fromNum"); - - addWithDesc(service, - new ProtobufCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, - MyNodeInfo_fields, &myNodeInfo), - "myNode"); + addWithDesc(service, new MyNodeInfoCharacteristic, "myNode"); addWithDesc(service, new RadioCharacteristic, "radio"); addWithDesc(service, new OwnerCharacteristic, "owner"); addWithDesc(service, new NodeInfoCharacteristic, "nodeinfo"); diff --git a/src/MeshRadio.cpp b/src/MeshRadio.cpp index b3a74e7f..2877d189 100644 --- a/src/MeshRadio.cpp +++ b/src/MeshRadio.cpp @@ -1,4 +1,5 @@ #include "RH_RF95.h" +#include "error.h" #include #include #include @@ -149,6 +150,7 @@ void MeshRadio::loop() if (lastTxStart != 0 && (now - lastTxStart) > TX_WATCHDOG_TIMEOUT && rf95.mode() == RHGenericDriver::RHModeTx) { DEBUG_MSG("ERROR! Bug! Tx packet took too long to send, forcing radio into rx mode"); rf95.setModeRx(); + recordCriticalError(ErrTxWatchdog); lastTxStart = 0; // Stop checking for now, because we just warned the developer } } diff --git a/src/NodeDB.cpp b/src/NodeDB.cpp index 804f94c9..3aa8690d 100644 --- a/src/NodeDB.cpp +++ b/src/NodeDB.cpp @@ -9,6 +9,7 @@ #include "NodeDB.h" #include "PowerFSM.h" #include "configuration.h" +#include "error.h" #include "mesh-pb-constants.h" #include #include @@ -327,4 +328,12 @@ NodeInfo *NodeDB::getOrCreateNode(NodeNum n) } return info; -} \ No newline at end of file +} + +/// Record an error that should be reported via analytics +void recordCriticalError(CriticalErrorCode code, uint32_t address) +{ + myNodeInfo.error_code = code; + myNodeInfo.error_address = address; + myNodeInfo.error_count++; +} diff --git a/src/error.h b/src/error.h new file mode 100644 index 00000000..6538f501 --- /dev/null +++ b/src/error.h @@ -0,0 +1,7 @@ +#pragma once + +/// Error codes for critical error +enum CriticalErrorCode { NoError, ErrTxWatchdog }; + +/// Record an error that should be reported via analytics +void recordCriticalError(CriticalErrorCode code, uint32_t address = 0); diff --git a/src/mesh.pb.h b/src/mesh.pb.h index d1a613ca..bed7aed2 100644 --- a/src/mesh.pb.h +++ b/src/mesh.pb.h @@ -52,6 +52,9 @@ typedef struct _MyNodeInfo { char region[12]; char hw_model[12]; char firmware_version[12]; + uint32_t error_code; + uint32_t error_address; + uint32_t error_count; } MyNodeInfo; typedef struct _Position { @@ -176,7 +179,7 @@ typedef struct _ToRadio { #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default} #define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} -#define MyNodeInfo_init_default {0, 0, 0, "", "", ""} +#define MyNodeInfo_init_default {0, 0, 0, "", "", "", 0, 0, 0} #define DeviceState_init_default {false, RadioConfig_init_default, false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}, false, MeshPacket_init_default, 0} #define FromRadio_init_default {0, 0, {MeshPacket_init_default}} #define ToRadio_init_default {0, {MeshPacket_init_default}} @@ -189,7 +192,7 @@ typedef struct _ToRadio { #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero} #define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} -#define MyNodeInfo_init_zero {0, 0, 0, "", "", ""} +#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", 0, 0, 0} #define DeviceState_init_zero {false, RadioConfig_init_zero, false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}, false, MeshPacket_init_zero, 0} #define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}} #define ToRadio_init_zero {0, {MeshPacket_init_zero}} @@ -207,6 +210,9 @@ typedef struct _ToRadio { #define MyNodeInfo_region_tag 4 #define MyNodeInfo_hw_model_tag 5 #define MyNodeInfo_firmware_version_tag 6 +#define MyNodeInfo_error_code_tag 7 +#define MyNodeInfo_error_address_tag 8 +#define MyNodeInfo_error_count_tag 9 #define Position_latitude_tag 1 #define Position_longitude_tag 2 #define Position_altitude_tag 3 @@ -349,7 +355,10 @@ X(a, STATIC, SINGULAR, BOOL, has_gps, 2) \ X(a, STATIC, SINGULAR, INT32, num_channels, 3) \ X(a, STATIC, SINGULAR, STRING, region, 4) \ X(a, STATIC, SINGULAR, STRING, hw_model, 5) \ -X(a, STATIC, SINGULAR, STRING, firmware_version, 6) +X(a, STATIC, SINGULAR, STRING, firmware_version, 6) \ +X(a, STATIC, SINGULAR, UINT32, error_code, 7) \ +X(a, STATIC, SINGULAR, UINT32, error_address, 8) \ +X(a, STATIC, SINGULAR, UINT32, error_count, 9) #define MyNodeInfo_CALLBACK NULL #define MyNodeInfo_DEFAULT NULL @@ -422,8 +431,8 @@ extern const pb_msgdesc_t ToRadio_msg; #define RadioConfig_size 120 #define RadioConfig_UserPreferences_size 72 #define NodeInfo_size 155 -#define MyNodeInfo_size 63 -#define DeviceState_size 15058 +#define MyNodeInfo_size 81 +#define DeviceState_size 15076 #define FromRadio_size 301 #define ToRadio_size 295 From 3a756b0e088bb8a31769a01b32052f2482385b1c Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 13:58:17 -0700 Subject: [PATCH 3/8] keep the elf files in the zip package, useful with @girtsf tool --- bin/build-all.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 45473c63..0cdecaa9 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -9,6 +9,7 @@ COUNTRIES="US EU433 EU865 CN JP" SRCMAP=.pio/build/esp32/output.map SRCBIN=.pio/build/esp32/firmware.bin +SRCELF=.pio/build/esp32/firmware.elf OUTDIR=release/latest # We keep all old builds (and their map files in the archive dir) @@ -26,12 +27,14 @@ for COUNTRY in $COUNTRIES; do rm -f $SRCBIN $SRCMAP pio run # -v cp $SRCBIN $OUTDIR/firmware-TBEAM-$COUNTRY-$VERSION.bin + cp $SRCELF $OUTDIR/firmware-TBEAM-$COUNTRY-$VERSION.elf #cp $SRCMAP $ARCHIVEDIR/firmware-TBEAM-$COUNTRY-$VERSION.map export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 $COMMONOPTS" rm -f $SRCBIN $SRCMAP pio run # -v cp $SRCBIN $OUTDIR/firmware-HELTEC-$COUNTRY-$VERSION.bin + cp $SRCELF $OUTDIR/firmware-HELTEC-$COUNTRY-$VERSION.elf #cp $SRCMAP $ARCHIVEDIR/firmware-HELTEC-$COUNTRY-$VERSION.map done @@ -51,6 +54,6 @@ Generated by bin/buildall.sh --> XML rm -f $ARCHIVEDIR/firmware-$VERSION.zip -zip $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/firmware-*-$VERSION.bin +zip $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/firmware-*-$VERSION.* echo BUILT ALL \ No newline at end of file From f4d368e1f4a998c91d9c6a4e79ed99ab8c99c246 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 14:43:55 -0700 Subject: [PATCH 4/8] fix #27 - add a device-install.sh script to the release --- README.md | 60 ++++++++++++++++++++++++++++++++++++------- bin/build-all.sh | 4 +-- bin/device-install.sh | 11 ++++++++ release/.gitignore | 1 + 4 files changed, 65 insertions(+), 11 deletions(-) create mode 100755 bin/device-install.sh diff --git a/README.md b/README.md index 565dd034..b99fe24d 100644 --- a/README.md +++ b/README.md @@ -51,31 +51,73 @@ Warning: ESP32 has no Chip ID. Reading MAC instead. MAC: 24:6f:28:b5:36:71 Hard resetting via RTS pin... ``` -6. Install the correct firmware for your board with "esptool.py write_flash 0x10000 firmware-_board_-_country_.bin". For instance "esptool.py write_flash 0x10000 release/firmware-HELTEC-US-0.0.3.bin". You should see something like this: +6. cd into the directory where the release zip file was expanded. +7. Install the correct firmware for your board with "device-install.sh firmware-_board_-_country_.bin". For instance "./device-install.sh firmware-HELTEC-US-0.0.3.bin". You should see something like this: ``` -~/development/meshtastic/meshtastic-esp32$ esptool.py write_flash 0x10000 release/firmware-HELTEC-US-0.0.3.bin +kevinh@kevin-server:~/development/meshtastic/meshtastic-esp32/release/latest$ ./device-install.sh firmware-TBEAM-US-0.1.8.bin +Trying to flash firmware-TBEAM-US-0.1.8.bin, but first erasing and writing system information esptool.py v2.6 Found 2 serial ports Serial port /dev/ttyUSB0 -Connecting...... +Connecting........____ Detecting chip type... ESP32 Chip is ESP32D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None -MAC: 24:6f:28:b5:36:71 +MAC: 24:6f:28:b2:01:6c Uploading stub... Running stub... Stub running... +Changing baud rate to 921600 +Changed. +Erasing flash (this may take a while)... +Chip erase completed successfully in 6.1s +Hard resetting via RTS pin... +esptool.py v2.6 +Found 2 serial ports +Serial port /dev/ttyUSB0 +Connecting....... +Detecting chip type... ESP32 +Chip is ESP32D0WDQ6 (revision 1) +Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None +MAC: 24:6f:28:b2:01:6c +Uploading stub... +Running stub... +Stub running... +Changing baud rate to 921600 +Changed. Configuring flash size... -Auto-detected Flash size: 8MB -Compressed 1184800 bytes to 652635... -Wrote 1184800 bytes (652635 compressed) at 0x00010000 in 57.6 seconds (effective 164.5 kbit/s)... +Auto-detected Flash size: 4MB +Flash params set to 0x0220 +Compressed 61440 bytes to 11950... +Wrote 61440 bytes (11950 compressed) at 0x00001000 in 0.2 seconds (effective 3092.4 kbit/s)... +Hash of data verified. + +Leaving... +Hard resetting via RTS pin... +esptool.py v2.6 +Found 2 serial ports +Serial port /dev/ttyUSB0 +Connecting..... +Detecting chip type... ESP32 +Chip is ESP32D0WDQ6 (revision 1) +Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None +MAC: 24:6f:28:b2:01:6c +Uploading stub... +Running stub... +Stub running... +Changing baud rate to 921600 +Changed. +Configuring flash size... +Auto-detected Flash size: 4MB +Compressed 1223568 bytes to 678412... +Wrote 1223568 bytes (678412 compressed) at 0x00010000 in 10.7 seconds (effective 912.0 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... ``` -7. The board will boot and show the Meshtastic logo. -8. Please post a comment on our chat so we know if these instructions worked for you ;-). If you find bugs/have-questions post there also - we will be rapidly iterating over the next few weeks. +8. The board will boot and show the Meshtastic logo. +9. Please post a comment on our chat so we know if these instructions worked for you ;-). If you find bugs/have-questions post there also - we will be rapidly iterating over the next few weeks. ## Meshtastic Android app The source code for the (optional) Meshtastic Android app is [here](https://github.com/meshtastic/Meshtastic-Android). diff --git a/bin/build-all.sh b/bin/build-all.sh index 0cdecaa9..9dbc2fb4 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -5,7 +5,7 @@ set -e source bin/version.sh COUNTRIES="US EU433 EU865 CN JP" -# COUNTRIES=US +#COUNTRIES=US SRCMAP=.pio/build/esp32/output.map SRCBIN=.pio/build/esp32/firmware.bin @@ -54,6 +54,6 @@ Generated by bin/buildall.sh --> XML rm -f $ARCHIVEDIR/firmware-$VERSION.zip -zip $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/firmware-*-$VERSION.* +zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh echo BUILT ALL \ No newline at end of file diff --git a/bin/device-install.sh b/bin/device-install.sh new file mode 100755 index 00000000..1101e26b --- /dev/null +++ b/bin/device-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +FILENAME=$1 + +echo "Trying to flash $FILENAME, but first erasing and writing system information" +esptool.py --baud 921600 erase_flash +esptool.py --baud 921600 write_flash 0x1000 system-info.bin +esptool.py --baud 921600 write_flash 0x10000 $FILENAME + diff --git a/release/.gitignore b/release/.gitignore index 9688c673..cb362848 100644 --- a/release/.gitignore +++ b/release/.gitignore @@ -1,3 +1,4 @@ +*.elf *.bin *.map *.zip \ No newline at end of file From 42d79668581327fcdb44f349c41de9aacd164f91 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 15:13:28 -0700 Subject: [PATCH 5/8] add instructions on how to reinstall --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b99fe24d..8224afeb 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,11 @@ MAC: 24:6f:28:b5:36:71 Hard resetting via RTS pin... ``` 6. cd into the directory where the release zip file was expanded. -7. Install the correct firmware for your board with "device-install.sh firmware-_board_-_country_.bin". For instance "./device-install.sh firmware-HELTEC-US-0.0.3.bin". You should see something like this: +7. Install the correct firmware for your board with "device-install.sh firmware-_board_-_country_.bin". For instance "./device-install.sh firmware-HELTEC-US-0.0.3.bin". + +Note: If you have previously installed meshtastic, you don't need to run this full script instead just run "esptool.py --baud 921600 write_flash 0x10000 firmware-_board_-_country_.bin". This will be faster, also all of your current preferences will be preserved. + +You should see something like this: ``` kevinh@kevin-server:~/development/meshtastic/meshtastic-esp32/release/latest$ ./device-install.sh firmware-TBEAM-US-0.1.8.bin Trying to flash firmware-TBEAM-US-0.1.8.bin, but first erasing and writing system information From d647be73dfb099334756c4f3a0c7e1dec9d14579 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 15:16:32 -0700 Subject: [PATCH 6/8] oops nasty bug probably responsible for ble mutex seeming bugs #33 Was calling the wrong superclass method and therfore not properly populating radio --- src/MeshBluetoothService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeshBluetoothService.cpp b/src/MeshBluetoothService.cpp index d65df83b..e60380ff 100644 --- a/src/MeshBluetoothService.cpp +++ b/src/MeshBluetoothService.cpp @@ -111,7 +111,7 @@ class RadioCharacteristic : public ProtobufCharacteristic // update gps connection state devicestate.has_radio = gps.isConnected; - BLEKeepAliveCallbacks::onRead(c); + ProtobufCharacteristic::onRead(c); } void onWrite(BLECharacteristic *c) From b4b8abe6ec15ca9eb46fa47b07e8158637d2a0d3 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 15:20:24 -0700 Subject: [PATCH 7/8] omg I was not setting the correct flag to tell phone we had gps --- src/MeshBluetoothService.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/MeshBluetoothService.cpp b/src/MeshBluetoothService.cpp index e60380ff..3a059230 100644 --- a/src/MeshBluetoothService.cpp +++ b/src/MeshBluetoothService.cpp @@ -107,10 +107,6 @@ class RadioCharacteristic : public ProtobufCharacteristic void onRead(BLECharacteristic *c) { DEBUG_MSG("Reading radio config\n"); - - // update gps connection state - devicestate.has_radio = gps.isConnected; - ProtobufCharacteristic::onRead(c); } @@ -235,6 +231,9 @@ class MyNodeInfoCharacteristic : public ProtobufCharacteristic void onRead(BLECharacteristic *c) { + // update gps connection state + myNodeInfo.has_gps = gps.isConnected; + ProtobufCharacteristic::onRead(c); myNodeInfo.error_code = 0; // The phone just read us, so throw it away From a3b70e75383462cea85034c619ea7b8658ffd9a2 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 24 Mar 2020 15:23:50 -0700 Subject: [PATCH 8/8] 0.1.9 --- bin/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/version.sh b/bin/version.sh index f2017919..b5e0a2a1 100644 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,3 +1,3 @@ -export VERSION=0.1.8 \ No newline at end of file +export VERSION=0.1.9 \ No newline at end of file