From 51064335729b03fab2251e8a790749e1122819f1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 12 Jun 2022 09:44:23 -0500 Subject: [PATCH] Removed phone_timeout_secs pref references (#1503) --- protobufs | 2 +- src/PowerFSM.cpp | 3 --- src/SerialConsole.cpp | 6 ++++-- src/mesh/NodeDB.h | 1 - src/mesh/generated/config.pb.h | 9 +++------ src/mesh/generated/localonly.pb.h | 2 +- src/mesh/generated/telemetry.pb.h | 8 ++++---- src/modules/AdminModule.cpp | 6 ++---- 8 files changed, 15 insertions(+), 22 deletions(-) diff --git a/protobufs b/protobufs index dbd4219a8..e5b5adc19 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit dbd4219a862b26b5c6fa6569bd8faa42ab8852a5 +Subproject commit e5b5adc196d3593ab15c04101093443ab8b36c9c diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 0804d62dc..82f73147c 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -348,9 +348,6 @@ void PowerFSM_setup() // See: https://github.com/meshtastic/Meshtastic-device/issues/1071 if (isRouter || config.power.is_power_saving) { - - // I don't think this transition is correct, turning off for now - @geeksville - // powerFSM.add_timed_transition(&stateDARK, &stateNB, getPref_phone_timeout_secs() * 1000, NULL, "Phone timeout"); powerFSM.add_timed_transition(&stateNB, &stateLS, config.power.min_wake_secs ? config.power.min_wake_secs : default_min_wake_secs * 1000, diff --git a/src/SerialConsole.cpp b/src/SerialConsole.cpp index 2d001192b..49e7e017a 100644 --- a/src/SerialConsole.cpp +++ b/src/SerialConsole.cpp @@ -4,6 +4,8 @@ #include "configuration.h" #define Port Serial +// Defaulting to the formerly removed phone_timeout_secs value of 15 minutes +#define SERIAL_CONNECTION_TIMEOUT (15 * 60) * 1000UL SerialConsole *console; @@ -41,12 +43,12 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port) emitRebooted(); } + // For the serial port we can't really detect if any client is on the other side, so instead just look for recent messages bool SerialConsole::checkIsConnected() { uint32_t now = millis(); - uint32_t timeout = (config.power.phone_timeout_secs > 0 ? config.power.phone_timeout_secs : default_phone_timeout_secs )* 1000UL; - return (now - lastContactMsec) < timeout; + return (now - lastContactMsec) < SERIAL_CONNECTION_TIMEOUT; } /** diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index e2ec49a9f..0d6d50ee1 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -168,7 +168,6 @@ extern NodeDB nodeDB; #define default_mesh_sds_timeout_secs IF_ROUTER(NODE_DELAY_FOREVER, 2 * 60 * 60) #define default_sds_secs 365 * 24 * 60 * 60 #define default_ls_secs IF_ROUTER(24 * 60 * 60, 5 * 60) -#define default_phone_timeout_secs 15 * 60 #define default_min_wake_secs 10 diff --git a/src/mesh/generated/config.pb.h b/src/mesh/generated/config.pb.h index 3c137cb02..e59fda04b 100644 --- a/src/mesh/generated/config.pb.h +++ b/src/mesh/generated/config.pb.h @@ -131,7 +131,6 @@ typedef struct _Config_PowerConfig { bool is_power_saving; float adc_multiplier_override; uint32_t wait_bluetooth_secs; - uint32_t phone_timeout_secs; uint32_t mesh_sds_timeout_secs; uint32_t sds_secs; uint32_t ls_secs; @@ -193,14 +192,14 @@ extern "C" { #define Config_init_default {0, {Config_DeviceConfig_init_default}} #define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""} #define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0} -#define Config_PowerConfig_init_default {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define Config_PowerConfig_init_default {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define Config_WiFiConfig_init_default {"", "", 0, 0} #define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0} #define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}} #define Config_init_zero {0, {Config_DeviceConfig_init_zero}} #define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""} #define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0} -#define Config_PowerConfig_init_zero {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define Config_PowerConfig_init_zero {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define Config_WiFiConfig_init_zero {"", "", 0, 0} #define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0} #define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}} @@ -238,7 +237,6 @@ extern "C" { #define Config_PowerConfig_is_power_saving_tag 5 #define Config_PowerConfig_adc_multiplier_override_tag 6 #define Config_PowerConfig_wait_bluetooth_secs_tag 7 -#define Config_PowerConfig_phone_timeout_secs_tag 8 #define Config_PowerConfig_mesh_sds_timeout_secs_tag 9 #define Config_PowerConfig_sds_secs_tag 10 #define Config_PowerConfig_ls_secs_tag 11 @@ -299,7 +297,6 @@ X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 4) \ X(a, STATIC, SINGULAR, BOOL, is_power_saving, 5) \ X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 6) \ X(a, STATIC, SINGULAR, UINT32, wait_bluetooth_secs, 7) \ -X(a, STATIC, SINGULAR, UINT32, phone_timeout_secs, 8) \ X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 9) \ X(a, STATIC, SINGULAR, UINT32, sds_secs, 10) \ X(a, STATIC, SINGULAR, UINT32, ls_secs, 11) \ @@ -358,7 +355,7 @@ extern const pb_msgdesc_t Config_LoRaConfig_msg; #define Config_DisplayConfig_size 14 #define Config_LoRaConfig_size 67 #define Config_PositionConfig_size 30 -#define Config_PowerConfig_size 55 +#define Config_PowerConfig_size 49 #define Config_WiFiConfig_size 103 #define Config_size 105 diff --git a/src/mesh/generated/localonly.pb.h b/src/mesh/generated/localonly.pb.h index fccc904e4..df0966414 100644 --- a/src/mesh/generated/localonly.pb.h +++ b/src/mesh/generated/localonly.pb.h @@ -126,7 +126,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg; #define LocalModuleConfig_fields &LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define LocalConfig_size 323 +#define LocalConfig_size 317 #define LocalModuleConfig_size 282 #ifdef __cplusplus diff --git a/src/mesh/generated/telemetry.pb.h b/src/mesh/generated/telemetry.pb.h index b7857e2ae..b6d3dc7e6 100644 --- a/src/mesh/generated/telemetry.pb.h +++ b/src/mesh/generated/telemetry.pb.h @@ -69,10 +69,10 @@ typedef struct _EnvironmentMetrics { /* Types of Measurements the telemetry module is equipped to handle */ typedef struct _Telemetry { - /* This is usually not sent over the mesh (to save space), but it is sent - from the phone so that the local device can set its RTC If it is sent over - the mesh (because there are devices on the mesh without GPS), it will only - be sent by devices which has a hardware GPS clock (IE Mobile Phone). + /* This is usually not sent over the mesh (to save space), but it is sent + from the phone so that the local device can set its RTC If it is sent over + the mesh (because there are devices on the mesh without GPS), it will only + be sent by devices which has a hardware GPS clock (IE Mobile Phone). seconds since 1970 */ uint32_t time; /* Key native device metrics such as battery level */ diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c9b533af6..6d25fd367 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -306,11 +306,10 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy break; } - // NOTE: The phone app needs to know the ls_secs & phone_timeout value so it can properly expect sleep behavior. + // NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior. // So even if we internally use 0 to represent 'use default' we still need to send the value we are // using to the app (so that even old phone apps work with new device loads). // r.get_radio_response.preferences.ls_secs = getPref_ls_secs(); - // r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs(); // hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private // and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password); // r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag; @@ -363,11 +362,10 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co break; } - // NOTE: The phone app needs to know the ls_secs & phone_timeout value so it can properly expect sleep behavior. + // NOTE: The phone app needs to know the ls_secsvalue so it can properly expect sleep behavior. // So even if we internally use 0 to represent 'use default' we still need to send the value we are // using to the app (so that even old phone apps work with new device loads). // r.get_radio_response.preferences.ls_secs = getPref_ls_secs(); - // r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs(); // hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private // and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password); // r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag;