diff --git a/protobufs b/protobufs index 579308947..d8213ad13 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 579308947366b35f7eb6908d5eaabd0114bba244 +Subproject commit d8213ad133c42fb59a052326659e2cbfde3db6d6 diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 9a0066bad..5d2c148c4 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -84,10 +84,10 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) case ToRadio_want_config_id_tag: config_nonce = toRadioScratch.want_config_id; DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce); - handleStartConfig(); break; case ToRadio_disconnect_tag: + DEBUG_MSG("Disconnecting from phone\n"); close(); break; default: @@ -116,9 +116,8 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) */ size_t PhoneAPI::getFromRadio(uint8_t *buf) { - DEBUG_MSG("getFromRadio, state=%d\n", state); if (!available()) { - // DEBUG_MSG("PhoneAPI::getFromRadio, !available\n"); + DEBUG_MSG("getFromRadio=not available\n"); return 0; } // In case we send a FromRadio packet @@ -127,9 +126,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // Advance states as needed switch (state) { case STATE_SEND_NOTHING: + DEBUG_MSG("getFromRadio=STATE_SEND_NOTHING\n"); break; - + case STATE_SEND_MY_INFO: + DEBUG_MSG("getFromRadio=STATE_SEND_MY_INFO\n"); // If the user has specified they don't want our node to share its location, make sure to tell the phone // app not to send locations on our behalf. myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info @@ -141,6 +142,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) break; case STATE_SEND_NODEINFO: { + DEBUG_MSG("getFromRadio=STATE_SEND_NODEINFO\n"); const NodeInfo *info = nodeInfoForPhone; nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time @@ -160,6 +162,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) } case STATE_SEND_CONFIG: + DEBUG_MSG("getFromRadio=STATE_SEND_CONFIG\n"); fromRadioScratch.which_payloadVariant = FromRadio_config_tag; switch (config_state) { case Config_device_tag: @@ -205,6 +208,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) break; case STATE_SEND_MODULECONFIG: + DEBUG_MSG("getFromRadio=STATE_SEND_MODULECONFIG\n"); fromRadioScratch.which_payloadVariant = FromRadio_moduleConfig_tag; switch (config_state) { case ModuleConfig_mqtt_tag: @@ -242,6 +246,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) break; case STATE_SEND_COMPLETE_ID: + DEBUG_MSG("getFromRadio=STATE_SEND_COMPLETE_ID\n"); fromRadioScratch.which_payloadVariant = FromRadio_config_complete_id_tag; fromRadioScratch.config_complete_id = config_nonce; config_nonce = 0; @@ -250,6 +255,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_PACKETS: // Do we have a message from the mesh? + DEBUG_MSG("getFromRadio=STATE_SEND_PACKETS\n"); if (packetForPhone) { printPacket("phone downloaded packet", packetForPhone); @@ -310,11 +316,10 @@ bool PhoneAPI::available() case STATE_SEND_COMPLETE_ID: return true; case STATE_SEND_PACKETS: { - // Try to pull a new packet from the service (if we haven't already) if (!packetForPhone) packetForPhone = service.getForPhone(); bool hasPacket = !!packetForPhone; - // DEBUG_MSG("available hasPacket=%d\n", hasPacket); + DEBUG_MSG("available hasPacket=%d\n", hasPacket); return hasPacket; } default: diff --git a/src/mesh/generated/module_config.pb.h b/src/mesh/generated/module_config.pb.h index 5ff22a807..e7e99b6b3 100644 --- a/src/mesh/generated/module_config.pb.h +++ b/src/mesh/generated/module_config.pb.h @@ -4,7 +4,6 @@ #ifndef PB_MODULE_CONFIG_PB_H_INCLUDED #define PB_MODULE_CONFIG_PB_H_INCLUDED #include -#include "telemetry.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index 3fb40a0f5..93a486d45 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -22,7 +22,6 @@ static BLEDfu bledfu; // DFU software update helper service static uint8_t fromRadioBytes[FromRadio_size]; static uint8_t toRadioBytes[ToRadio_size]; -static bool bleConnected; static uint16_t connectionHandle; class BluetoothPhoneAPI : public PhoneAPI @@ -51,12 +50,12 @@ void onConnect(uint16_t conn_handle) { // Get the reference to current connection BLEConnection *connection = Bluefruit.Connection(conn_handle); + connectionHandle = conn_handle; char central_name[32] = {0}; connection->getPeerName(central_name, sizeof(central_name)); DEBUG_MSG("BLE Connected to %s\n", central_name); - bleConnected = true; } /** @@ -67,8 +66,6 @@ void onConnect(uint16_t conn_handle) void onDisconnect(uint16_t conn_handle, uint8_t reason) { // FIXME - we currently assume only one active connection - bleConnected = false; - DEBUG_MSG("BLE Disconnected, reason = 0x%x\n", reason); } @@ -294,7 +291,6 @@ void NRF52Bluetooth::clearBonds() void NRF52Bluetooth::onConnectionSecured(uint16_t conn_handle) { DEBUG_MSG("BLE connection secured\n"); - //bluetoothPhoneAPI->setInitialState(); } bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request)