From f019151e3f7193802ce73daf5cbc11713a657531 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 27 Nov 2021 09:08:23 -0600 Subject: [PATCH 1/4] auto_screen_carousel_secs behavior implementation --- src/graphics/Screen.cpp | 16 +++++++++++++--- src/mesh/generated/admin.pb.h | 2 +- src/mesh/generated/radioconfig.pb.h | 16 ++++++++-------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 38f22b1d3..486135fa5 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -794,6 +794,8 @@ void Screen::forceDisplay() #endif } +static uint32_t lastScreenTransition; + int32_t Screen::runOnce() { // If we don't have a screen, don't ever spend any CPU for us. @@ -870,8 +872,13 @@ int32_t Screen::runOnce() // standard screen switching is stopped. if (showingNormalScreen) { // standard screen loop handling here + if (radioConfig.preferences.auto_screen_carousel_secs > 0 && + (millis() - lastScreenTransition) > (radioConfig.preferences.auto_screen_carousel_secs * 1000)) { + DEBUG_MSG("LastScreenTransition exceeded %ums transitioning to next frame\n", (millis() - lastScreenTransition)); + handleOnPress(); + } } - + // DEBUG_MSG("want fps %d, fixed=%d\n", targetFramerate, // ui.getUiState()->frameState); If we are scrolling we need to be called // soon, otherwise just 1 fps (to save CPU) We also ask to be called twice @@ -933,8 +940,9 @@ void Screen::setFrames() normalFrames[numframes++] = drawCriticalFaultFrame; // If we have a text message - show it next, unless it's a phone message and we aren't using any special plugins - if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) + if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) { normalFrames[numframes++] = drawTextMessageFrame; + } // then all the nodes // We only show a few nodes in our scrolling list - because meshes with many nodes would have too many screens @@ -1025,11 +1033,13 @@ void Screen::handlePrint(const char *text) void Screen::handleOnPress() { + DEBUG_MSG("handleOnPress"); // If screen was off, just wake it, otherwise advance to next frame // If we are in a transition, the press must have bounced, drop it. if (ui.getUiState()->frameState == FIXED) { ui.nextFrame(); - + DEBUG_MSG("Setting LastScreenTransition\n"); + lastScreenTransition = millis(); setFastFramerate(); } } diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index a2da87520..7178f7075 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -79,7 +79,7 @@ extern const pb_msgdesc_t AdminMessage_msg; #define AdminMessage_fields &AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#define AdminMessage_size 423 +#define AdminMessage_size 427 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index 2381e60b9..f635ddc29 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -101,7 +101,6 @@ typedef struct _RadioConfig_UserPreferences { bool wifi_ap_mode; RegionCode region; ChargeCurrent charge_current; - bool position_broadcast_smart; LocationSharing location_share; GpsOperation gps_operation; uint32_t gps_update_interval; @@ -147,6 +146,7 @@ typedef struct _RadioConfig_UserPreferences { bool store_forward_plugin_enabled; uint32_t position_flags; bool is_always_powered; + uint32_t auto_screen_carousel_secs; } RadioConfig_UserPreferences; typedef struct _RadioConfig { @@ -191,9 +191,9 @@ extern "C" { /* Initializer values for message structs */ #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default} -#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero} -#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -211,7 +211,6 @@ extern "C" { #define RadioConfig_UserPreferences_wifi_ap_mode_tag 14 #define RadioConfig_UserPreferences_region_tag 15 #define RadioConfig_UserPreferences_charge_current_tag 16 -#define RadioConfig_UserPreferences_position_broadcast_smart_tag 17 #define RadioConfig_UserPreferences_location_share_tag 32 #define RadioConfig_UserPreferences_gps_operation_tag 33 #define RadioConfig_UserPreferences_gps_update_interval_tag 34 @@ -256,6 +255,7 @@ extern "C" { #define RadioConfig_UserPreferences_store_forward_plugin_enabled_tag 148 #define RadioConfig_UserPreferences_position_flags_tag 150 #define RadioConfig_UserPreferences_is_always_powered_tag 151 +#define RadioConfig_UserPreferences_auto_screen_carousel_secs_tag 152 #define RadioConfig_preferences_tag 1 /* Struct field encoding specification for nanopb */ @@ -281,7 +281,6 @@ X(a, STATIC, SINGULAR, STRING, wifi_password, 13) \ X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 14) \ X(a, STATIC, SINGULAR, UENUM, region, 15) \ X(a, STATIC, SINGULAR, UENUM, charge_current, 16) \ -X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart, 17) \ X(a, STATIC, SINGULAR, UENUM, location_share, 32) \ X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \ X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 34) \ @@ -325,7 +324,8 @@ X(a, STATIC, SINGULAR, UENUM, environmental_measurement_plugin_sensor_type, X(a, STATIC, SINGULAR, UINT32, environmental_measurement_plugin_sensor_pin, 147) \ X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_enabled, 148) \ X(a, STATIC, SINGULAR, UINT32, position_flags, 150) \ -X(a, STATIC, SINGULAR, BOOL, is_always_powered, 151) +X(a, STATIC, SINGULAR, BOOL, is_always_powered, 151) \ +X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 152) #define RadioConfig_UserPreferences_CALLBACK NULL #define RadioConfig_UserPreferences_DEFAULT NULL @@ -337,8 +337,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg; #define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg /* Maximum encoded size of messages (where known) */ -#define RadioConfig_size 420 -#define RadioConfig_UserPreferences_size 417 +#define RadioConfig_size 424 +#define RadioConfig_UserPreferences_size 421 #ifdef __cplusplus } /* extern "C" */ From 7a649e3fc31f83bf482e983adb948c6c964fae4a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 27 Nov 2021 09:16:26 -0600 Subject: [PATCH 2/4] Regen protobufs from upstream --- src/mesh/generated/admin.pb.h | 2 +- src/mesh/generated/radioconfig.pb.h | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index 7178f7075..b176b83e2 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -79,7 +79,7 @@ extern const pb_msgdesc_t AdminMessage_msg; #define AdminMessage_fields &AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#define AdminMessage_size 427 +#define AdminMessage_size 430 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index f635ddc29..37780ca6e 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -101,6 +101,7 @@ typedef struct _RadioConfig_UserPreferences { bool wifi_ap_mode; RegionCode region; ChargeCurrent charge_current; + bool position_broadcast_smart; LocationSharing location_share; GpsOperation gps_operation; uint32_t gps_update_interval; @@ -191,9 +192,9 @@ extern "C" { /* Initializer values for message structs */ #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default} -#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero} -#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0, 0, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -211,6 +212,7 @@ extern "C" { #define RadioConfig_UserPreferences_wifi_ap_mode_tag 14 #define RadioConfig_UserPreferences_region_tag 15 #define RadioConfig_UserPreferences_charge_current_tag 16 +#define RadioConfig_UserPreferences_position_broadcast_smart_tag 17 #define RadioConfig_UserPreferences_location_share_tag 32 #define RadioConfig_UserPreferences_gps_operation_tag 33 #define RadioConfig_UserPreferences_gps_update_interval_tag 34 @@ -281,6 +283,7 @@ X(a, STATIC, SINGULAR, STRING, wifi_password, 13) \ X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 14) \ X(a, STATIC, SINGULAR, UENUM, region, 15) \ X(a, STATIC, SINGULAR, UENUM, charge_current, 16) \ +X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart, 17) \ X(a, STATIC, SINGULAR, UENUM, location_share, 32) \ X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \ X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 34) \ @@ -337,8 +340,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg; #define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg /* Maximum encoded size of messages (where known) */ -#define RadioConfig_size 424 -#define RadioConfig_UserPreferences_size 421 +#define RadioConfig_size 427 +#define RadioConfig_UserPreferences_size 424 #ifdef __cplusplus } /* extern "C" */ From 69a2029ade0ccf96477c65450ca743bcfc8e02e2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 27 Nov 2021 09:29:39 -0600 Subject: [PATCH 3/4] Removed unnecessary debug print --- src/graphics/Screen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 486135fa5..2743c7356 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1032,8 +1032,7 @@ void Screen::handlePrint(const char *text) } void Screen::handleOnPress() -{ - DEBUG_MSG("handleOnPress"); +{ // If screen was off, just wake it, otherwise advance to next frame // If we are in a transition, the press must have bounced, drop it. if (ui.getUiState()->frameState == FIXED) { From 2a617ba7b2e2221632aa1f8a9249ff623a9bda0e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 29 Nov 2021 10:05:32 -0600 Subject: [PATCH 4/4] Upstream proto addition --- src/mesh/generated/portnums.pb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h index 5904a548c..26eec9ed6 100644 --- a/src/mesh/generated/portnums.pb.h +++ b/src/mesh/generated/portnums.pb.h @@ -24,6 +24,7 @@ typedef enum _PortNum { PortNum_STORE_FORWARD_APP = 65, PortNum_RANGE_TEST_APP = 66, PortNum_ENVIRONMENTAL_MEASUREMENT_APP = 67, + PortNum_ZPS_APP = 68, PortNum_PRIVATE_APP = 256, PortNum_ATAK_FORWARDER = 257, PortNum_MAX = 511