From 9f15ef50e6e0f48d5882605db987bfccc223d28f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 11 Oct 2024 16:30:42 +0200 Subject: [PATCH] review update --- src/mesh/NodeDB.cpp | 2 +- src/mesh/PhoneAPI.cpp | 19 ++++++++++--------- src/modules/AdminModule.cpp | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index d8d784940..7b6d7fb31 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -53,7 +53,7 @@ NodeDB *nodeDB = nullptr; EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate; meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; meshtastic_LocalConfig config; -meshtastic_DeviceUIConfig uiconfig{.screen_timeout = 30}; +meshtastic_DeviceUIConfig uiconfig{.screen_brightness = 153, .screen_timeout = 30}; meshtastic_LocalModuleConfig moduleConfig; meshtastic_ChannelFile channelFile; meshtastic_OEMStore oemStore; diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 2d3567d74..1df131657 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -52,7 +52,7 @@ void PhoneAPI::handleStartConfig() } // even if we were already connected - restart our state machine - state = STATE_SEND_UIDATA; + state = STATE_SEND_MY_INFO; pauseBluetoothLogging = true; filesManifest = getFiles("/", 10); LOG_DEBUG("Got %d files in manifest\n", filesManifest.size()); @@ -190,23 +190,24 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_NOTHING: LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n"); break; - case STATE_SEND_UIDATA: - LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); - fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; - fromRadioScratch.deviceuiConfig = uiconfig; - state = STATE_SEND_MY_INFO; - break; case STATE_SEND_MY_INFO: LOG_INFO("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. fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag; fromRadioScratch.my_info = myNodeInfo; - state = STATE_SEND_OWN_NODEINFO; + state = STATE_SEND_UIDATA; service->refreshLocalMeshNode(); // Update my NodeInfo because the client will be asking for it soon. break; + case STATE_SEND_UIDATA: + LOG_INFO("getFromRadio=STATE_SEND_UIDATA\n"); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_deviceuiConfig_tag; + fromRadioScratch.deviceuiConfig = uiconfig; + state = STATE_SEND_OWN_NODEINFO; + break; + case STATE_SEND_OWN_NODEINFO: { LOG_INFO("getFromRadio=STATE_SEND_OWN_NODEINFO\n"); auto us = nodeDB->readNextMeshNode(readIndex); @@ -504,8 +505,8 @@ bool PhoneAPI::available() switch (state) { case STATE_SEND_NOTHING: return false; - case STATE_SEND_UIDATA: case STATE_SEND_MY_INFO: + case STATE_SEND_UIDATA: case STATE_SEND_CHANNELS: case STATE_SEND_CONFIG: case STATE_SEND_MODULECONFIG: diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index b0e0c4722..c0d463bdc 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -178,6 +178,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta case meshtastic_AdminMessage_get_ui_config_request_tag: { LOG_INFO("Client is getting device-ui config\n"); handleGetDeviceUIConfig(mp); + handled = true; break; }