From 4cd15705430d282292f7c625eb215bf91140483b Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Sun, 20 Mar 2022 11:01:49 +1100 Subject: [PATCH] make location_share a boolean --- proto | 2 +- src/gps/GPS.cpp | 3 +-- src/mesh/generated/radioconfig.pb.h | 20 +++++--------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/proto b/proto index 441303d53..92f3d9aaf 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 441303d53110b6ab5f485065d467c36f6793ba73 +Subproject commit 92f3d9aaf458722ae2384108f6ccad574f7ac3e0 diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 6b0c1e3a4..d59ff4c3e 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -151,8 +151,7 @@ GpsOperation GPS::getGpsOp() const auto op = radioConfig.preferences.gps_operation; if (op == GpsOperation_GpsOpUnset) - op = (radioConfig.preferences.location_share == LocationSharing_LocDisabled) ? GpsOperation_GpsOpTimeOnly - : GpsOperation_GpsOpMobile; + op = (radioConfig.preferences.disable_location_share) ? GpsOperation_GpsOpTimeOnly : GpsOperation_GpsOpMobile; return op; } diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index 4674ca0d2..7c8612d53 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -68,12 +68,6 @@ typedef enum _GpsCoordinateFormat { GpsCoordinateFormat_GpsFormatOSGR = 5 } GpsCoordinateFormat; -typedef enum _LocationSharing { - LocationSharing_LocUnset = 0, - LocationSharing_LocEnabled = 1, - LocationSharing_LocDisabled = 2 -} LocationSharing; - typedef enum _PositionFlags { PositionFlags_POS_UNDEFINED = 0, PositionFlags_POS_ALTITUDE = 1, @@ -129,7 +123,7 @@ typedef struct _RadioConfig_UserPreferences { ChargeCurrent charge_current; bool position_broadcast_smart_disabled; Role role; - LocationSharing location_share; + bool disable_location_share; GpsOperation gps_operation; uint32_t gps_update_interval; uint32_t gps_attempt_time; @@ -225,10 +219,6 @@ typedef struct _RadioConfig { #define _GpsCoordinateFormat_MAX GpsCoordinateFormat_GpsFormatOSGR #define _GpsCoordinateFormat_ARRAYSIZE ((GpsCoordinateFormat)(GpsCoordinateFormat_GpsFormatOSGR+1)) -#define _LocationSharing_MIN LocationSharing_LocUnset -#define _LocationSharing_MAX LocationSharing_LocDisabled -#define _LocationSharing_ARRAYSIZE ((LocationSharing)(LocationSharing_LocDisabled+1)) - #define _PositionFlags_MIN PositionFlags_POS_UNDEFINED #define _PositionFlags_MAX PositionFlags_POS_TIMESTAMP #define _PositionFlags_ARRAYSIZE ((PositionFlags)(PositionFlags_POS_TIMESTAMP+1)) @@ -248,9 +238,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, _Role_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 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, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_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, _Role_MIN, 0, _GpsOperation_MIN, 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, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_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, _Role_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 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, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_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, _Role_MIN, 0, _GpsOperation_MIN, 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, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, "", 0, 0, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -270,7 +260,7 @@ extern "C" { #define RadioConfig_UserPreferences_charge_current_tag 16 #define RadioConfig_UserPreferences_position_broadcast_smart_disabled_tag 17 #define RadioConfig_UserPreferences_role_tag 18 -#define RadioConfig_UserPreferences_location_share_tag 32 +#define RadioConfig_UserPreferences_disable_location_share_tag 32 #define RadioConfig_UserPreferences_gps_operation_tag 33 #define RadioConfig_UserPreferences_gps_update_interval_tag 34 #define RadioConfig_UserPreferences_gps_attempt_time_tag 36 @@ -363,7 +353,7 @@ X(a, STATIC, SINGULAR, UENUM, region, 15) \ X(a, STATIC, SINGULAR, UENUM, charge_current, 16) \ X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart_disabled, 17) \ X(a, STATIC, SINGULAR, UENUM, role, 18) \ -X(a, STATIC, SINGULAR, UENUM, location_share, 32) \ +X(a, STATIC, SINGULAR, BOOL, disable_location_share, 32) \ X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \ X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 34) \ X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 36) \