diff --git a/protobufs b/protobufs index 9bac2886f..1ecf94da9 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 9bac2886f9344f25716921467a82e8b0326107cd +Subproject commit 1ecf94da9898ea0b8f2745bfe6bda2a8f2ca4073 diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 83becb037..305689fff 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -31,6 +31,9 @@ #include "Throttle.h" #include +// Flag to indicate a heartbeat was received and we should send queue status +bool heartbeatReceived = false; + PhoneAPI::PhoneAPI() { lastContactMsec = millis(); @@ -155,6 +158,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) #endif case meshtastic_ToRadio_heartbeat_tag: LOG_DEBUG("Got client heartbeat"); + heartbeatReceived = true; break; default: // Ignore nop messages @@ -194,6 +198,17 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // In case we send a FromRadio packet memset(&fromRadioScratch, 0, sizeof(fromRadioScratch)); + // Respond to heartbeat by sending queue status + if (heartbeatReceived) { + memset(&fromRadioScratch, 0, sizeof(fromRadioScratch)); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag; + fromRadioScratch.queueStatus = router->getQueueStatus(); + heartbeatReceived = false; + size_t numbytes = pb_encode_to_bytes(buf, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch); + LOG_DEBUG("FromRadio=STATE_SEND_QUEUE_STATUS, numbytes=%u", numbytes); + return numbytes; + } + // Advance states as needed switch (state) { case STATE_SEND_NOTHING: diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 8e6524042..f915a1db3 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -267,6 +267,9 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_RAK3312 = 106, /* Elecrow ThinkNode M5 https://www.elecrow.com/wiki/ThinkNode_M5_Meshtastic_LoRa_Signal_Transceiver_ESP32-S3.html */ meshtastic_HardwareModel_THINKNODE_M5 = 107, + /* MeshSolar is an integrated power management and communication solution designed for outdoor low-power devices. + https://heltec.org/project/meshsolar/ */ + meshtastic_HardwareModel_HELTEC_MESH_SOLAR = 108, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index e8ae48072..b27f5f515 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -82,7 +82,10 @@ typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Mode { meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85 = 6, /* VE.Direct is a serial protocol used by Victron Energy products https://beta.ivc.no/wiki/index.php/Victron_VE_Direct_DIY_Cable */ - meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT = 7 + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT = 7, + /* Used to configure and view some parameters of MeshSolar. +https://heltec.org/project/meshsolar/ */ + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MS_CONFIG = 8 } meshtastic_ModuleConfig_SerialConfig_Serial_Mode; /* TODO: REPLACE */ @@ -472,8 +475,8 @@ extern "C" { #define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1)) #define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT -#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT -#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT+1)) +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MS_CONFIG +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MS_CONFIG+1)) #define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE #define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 7a56c258b..1133ad424 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -235,6 +235,11 @@ bool isWifiAvailable() #ifdef USE_WS5500 } else if (config.network.eth_enabled) { return true; +#endif +#ifndef ARCH_PORTDUINO + } else if (WiFi.status() == WL_CONNECTED) { + // it's likely we have wifi now, but user intends to turn it off in config! + return true; #endif } else { return false;