Merge pull request #1293 from mc-hamster/router

support for position_broadcast_smart_disabled
pull/1297/head
Jm Casler 2022-03-14 18:22:49 -07:00 zatwierdzone przez GitHub
commit 9037a51f83
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 19 dodań i 37 usunięć

Wyświetl plik

@ -87,7 +87,7 @@ extern const pb_msgdesc_t ChannelFile_msg;
#define ChannelFile_fields &ChannelFile_msg
/* Maximum encoded size of messages (where known) */
#define DeviceState_size 9885
#define DeviceState_size 9749
#define ChannelFile_size 832
#ifdef __cplusplus

Wyświetl plik

@ -169,12 +169,6 @@ typedef struct _MyNodeInfo {
bool has_wifi;
float channel_utilization;
float air_util_tx;
pb_size_t router_count;
uint32_t router[4];
pb_size_t router_snr_count;
float router_snr[4];
pb_size_t router_sec_count;
uint16_t router_sec[4];
} MyNodeInfo;
typedef struct _Position {
@ -182,7 +176,6 @@ typedef struct _Position {
int32_t longitude_i;
int32_t altitude;
int32_t battery_level;
bool router_heartbeat;
uint32_t time;
Position_LocSource location_source;
Position_AltSource altitude_source;
@ -337,26 +330,26 @@ extern "C" {
#endif
/* Initializer values for message structs */
#define Position_init_default {0, 0, 0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define Position_init_default {0, 0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
#define Routing_init_default {0, {RouteDiscovery_init_default}}
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
#define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_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, 0}, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}}
#define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_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}
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
#define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}}
#define ToRadio_init_default {0, {MeshPacket_init_default}}
#define ToRadio_PeerInfo_init_default {0, 0}
#define Position_init_zero {0, 0, 0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define Position_init_zero {0, 0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
#define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_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, 0}, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}}
#define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_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}
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
#define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}}
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
@ -392,14 +385,10 @@ extern "C" {
#define MyNodeInfo_has_wifi_tag 18
#define MyNodeInfo_channel_utilization_tag 19
#define MyNodeInfo_air_util_tx_tag 20
#define MyNodeInfo_router_tag 21
#define MyNodeInfo_router_snr_tag 22
#define MyNodeInfo_router_sec_tag 23
#define Position_latitude_i_tag 1
#define Position_longitude_i_tag 2
#define Position_altitude_tag 3
#define Position_battery_level_tag 4
#define Position_router_heartbeat_tag 5
#define Position_time_tag 9
#define Position_location_source_tag 10
#define Position_altitude_source_tag 11
@ -471,7 +460,6 @@ X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 1) \
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 2) \
X(a, STATIC, SINGULAR, INT32, altitude, 3) \
X(a, STATIC, SINGULAR, INT32, battery_level, 4) \
X(a, STATIC, SINGULAR, BOOL, router_heartbeat, 5) \
X(a, STATIC, SINGULAR, FIXED32, time, 9) \
X(a, STATIC, SINGULAR, UENUM, location_source, 10) \
X(a, STATIC, SINGULAR, UENUM, altitude_source, 11) \
@ -580,10 +568,7 @@ X(a, STATIC, REPEATED, UINT32, air_period_tx, 16) \
X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) \
X(a, STATIC, SINGULAR, BOOL, has_wifi, 18) \
X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 19) \
X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 20) \
X(a, STATIC, REPEATED, UINT32, router, 21) \
X(a, STATIC, REPEATED, FLOAT, router_snr, 22) \
X(a, STATIC, REPEATED, UINT32, router_sec, 23)
X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 20)
#define MyNodeInfo_CALLBACK NULL
#define MyNodeInfo_DEFAULT NULL
@ -654,14 +639,14 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg;
#define ToRadio_PeerInfo_fields &ToRadio_PeerInfo_msg
/* Maximum encoded size of messages (where known) */
#define Position_size 155
#define Position_size 153
#define User_size 97
#define RouteDiscovery_size 40
#define Routing_size 42
#define Data_size 267
#define MeshPacket_size 318
#define NodeInfo_size 273
#define MyNodeInfo_size 282
#define NodeInfo_size 271
#define MyNodeInfo_size 210
#define LogRecord_size 81
#define FromRadio_size 327
#define ToRadio_size 321

Wyświetl plik

@ -28,8 +28,7 @@ typedef enum _RegionCode {
typedef enum _Role {
Role_Default = 0,
Role_Router = 1,
Role_Repeater = 2
Role_Router = 1
} Role;
typedef enum _ChargeCurrent {
@ -128,7 +127,7 @@ typedef struct _RadioConfig_UserPreferences {
bool wifi_ap_mode;
RegionCode region;
ChargeCurrent charge_current;
bool position_broadcast_smart;
bool position_broadcast_smart_disabled;
Role role;
LocationSharing location_share;
GpsOperation gps_operation;
@ -212,8 +211,8 @@ typedef struct _RadioConfig {
#define _RegionCode_ARRAYSIZE ((RegionCode)(RegionCode_TH+1))
#define _Role_MIN Role_Default
#define _Role_MAX Role_Repeater
#define _Role_ARRAYSIZE ((Role)(Role_Repeater+1))
#define _Role_MAX Role_Router
#define _Role_ARRAYSIZE ((Role)(Role_Router+1))
#define _ChargeCurrent_MIN ChargeCurrent_MAUnset
#define _ChargeCurrent_MAX ChargeCurrent_MA1320
@ -270,7 +269,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_position_broadcast_smart_disabled_tag 17
#define RadioConfig_UserPreferences_role_tag 18
#define RadioConfig_UserPreferences_location_share_tag 32
#define RadioConfig_UserPreferences_gps_operation_tag 33
@ -364,7 +363,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, 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, UENUM, gps_operation, 33) \

Wyświetl plik

@ -128,8 +128,6 @@ int32_t PositionModule::runOnce()
{
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
// radioConfig.preferences.position_broadcast_smart = true;
// We limit our GPS broadcasts to a max rate
uint32_t now = millis();
if (lastGpsSend == 0 || now - lastGpsSend >= getPref_position_broadcast_secs() * 1000) {
@ -154,10 +152,10 @@ int32_t PositionModule::runOnce()
DEBUG_MSG("Channel utilization is >50 percent. Skipping this opportunity to send.\n");
}
} else if (radioConfig.preferences.position_broadcast_smart == true) {
} else if (!radioConfig.preferences.position_broadcast_smart_disabled) {
// Only send packets if the channel is less than 40% utilized.
if (airTime->channelUtilizationPercent() < 40) {
// Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < 25) {
NodeInfo *node2 = service.refreshMyNodeInfo(); // should guarantee there is now a position
@ -198,7 +196,7 @@ int32_t PositionModule::runOnce()
}
}
} else {
DEBUG_MSG("Channel utilization is >40 percent. Skipping this opportunity to send.\n");
DEBUG_MSG("Channel utilization is >25 percent. Skipping this opportunity to send.\n");
}
}