From 61f6fb22c5de371783a86a5a7db7ea446e6202e7 Mon Sep 17 00:00:00 2001 From: Andre K Date: Sun, 24 Sep 2023 09:22:54 -0300 Subject: [PATCH] move `STATE_SEND_METADATA` to beginning of wantConfig (#2820) Co-authored-by: Ben Meadors --- src/mesh/PhoneAPI.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index c91f2e815..672c6871e 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -155,11 +155,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // app not to send locations on our behalf. fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag; fromRadioScratch.my_info = myNodeInfo; - state = STATE_SEND_NODEINFO; + state = STATE_SEND_METADATA; service.refreshLocalMeshNode(); // Update my NodeInfo because the client will be asking for it soon. break; + case STATE_SEND_METADATA: + LOG_INFO("getFromRadio=STATE_SEND_METADATA\n"); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_metadata_tag; + fromRadioScratch.metadata = getDeviceMetadata(); + state = STATE_SEND_NODEINFO; + break; + case STATE_SEND_NODEINFO: { LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n"); @@ -294,15 +301,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) config_state++; // Advance when we have sent all of our ModuleConfig objects if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) { - state = STATE_SEND_METADATA; + state = STATE_SEND_COMPLETE_ID; config_state = 0; } break; - case STATE_SEND_METADATA: - fromRadioScratch.which_payload_variant = meshtastic_FromRadio_metadata_tag; - fromRadioScratch.metadata = getDeviceMetadata(); - state = STATE_SEND_COMPLETE_ID; - break; + case STATE_SEND_COMPLETE_ID: LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n"); fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag;