From 79ce7d929c23405b80baef5baa6a02ddace3d2ba Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 18 Mar 2020 13:29:22 -0700 Subject: [PATCH] send dynamic probed GPS status to the phone --- src/MeshBluetoothService.cpp | 13 +++++++++++++ src/NodeDB.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/MeshBluetoothService.cpp b/src/MeshBluetoothService.cpp index fdfac9ab..69fefaa6 100644 --- a/src/MeshBluetoothService.cpp +++ b/src/MeshBluetoothService.cpp @@ -13,6 +13,8 @@ #include "PowerFSM.h" #include "CallbackCharacteristic.h" +#include "GPS.h" + // This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in proccess at once static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)]; @@ -93,6 +95,7 @@ public: } }; + // wrap our protobuf version with something that forces the service to reload the config class RadioCharacteristic : public ProtobufCharacteristic { @@ -102,6 +105,16 @@ public: { } + void onRead(BLECharacteristic *c) + { + DEBUG_MSG("Reading radio config\n"); + + // update gps connection state + devicestate.has_radio = gps.isConnected; + + BLEKeepAliveCallbacks::onRead(c); + } + void onWrite(BLECharacteristic *c) { ProtobufCharacteristic::onWrite(c); diff --git a/src/NodeDB.cpp b/src/NodeDB.cpp index 2fef454a..6915ee0a 100644 --- a/src/NodeDB.cpp +++ b/src/NodeDB.cpp @@ -52,7 +52,7 @@ void NodeDB::init() devicestate.has_my_node = true; devicestate.has_radio = true; devicestate.has_owner = true; - devicestate.has_radio = true; + devicestate.has_radio = false; devicestate.radio.has_channel_settings = true; devicestate.radio.has_preferences = true; devicestate.node_db_count = 0;