diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index d6721b018..322b0cf5e 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -355,9 +355,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) LOG_INFO("getFromRadio=STATE_SEND_FILEMANIFEST\n"); // last element if (config_state == filesManifest.size()) { // also handles an empty filesManifest - state = STATE_SEND_COMPLETE_ID; config_state = 0; filesManifest.clear(); + // Skip to complete packet + sendConfigComplete(); } else { fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag; fromRadioScratch.fileInfo = filesManifest.at(config_state); @@ -368,12 +369,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) } case STATE_SEND_COMPLETE_ID: - LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n"); - fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag; - fromRadioScratch.config_complete_id = config_nonce; - config_nonce = 0; - state = STATE_SEND_PACKETS; - pauseBluetoothLogging = false; + sendConfigComplete(); break; case STATE_SEND_PACKETS: @@ -419,6 +415,16 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) return 0; } +void PhoneAPI::sendConfigComplete() +{ + LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n"); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag; + fromRadioScratch.config_complete_id = config_nonce; + config_nonce = 0; + state = STATE_SEND_PACKETS; + pauseBluetoothLogging = false; +} + void PhoneAPI::handleDisconnect() { filesManifest.clear(); diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 1a2a065d3..3c3668300 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -104,6 +104,8 @@ class PhoneAPI */ size_t getFromRadio(uint8_t *buf); + void sendConfigComplete(); + /** * Return true if we have data available to send to the phone */