fix: treat ROUTER_LATE like ROUTER for power management and defaults (#9815)
ROUTER_LATE is an infrastructure relay that should use the same power assumptions, interval defaults, and LoRa wake behavior as ROUTER. Without this, ROUTER_LATE uses client-class defaults and will not wake on LoRa activity from deep sleep, making it a broken relay. Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
Ben Meadors
parent
fe4e75eb66
commit
22031c5886
+8
-2
@@ -38,7 +38,10 @@ static bool isPowered()
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ? 1 : 0);
|
bool isRouter = ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||||
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)
|
||||||
|
? 1
|
||||||
|
: 0);
|
||||||
|
|
||||||
// If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON
|
// If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON
|
||||||
// We assume routers might be powered all the time, but from a low current (solar) source
|
// We assume routers might be powered all the time, but from a low current (solar) source
|
||||||
@@ -262,7 +265,10 @@ Fsm powerFSM(&stateBOOT);
|
|||||||
|
|
||||||
void PowerFSM_setup()
|
void PowerFSM_setup()
|
||||||
{
|
{
|
||||||
bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ? 1 : 0);
|
bool isRouter = ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||||
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)
|
||||||
|
? 1
|
||||||
|
: 0);
|
||||||
bool hasPower = isPowered();
|
bool hasPower = isPowered();
|
||||||
|
|
||||||
LOG_INFO("PowerFSM init, USB power=%d", hasPower ? 1 : 0);
|
LOG_INFO("PowerFSM init, USB power=%d", hasPower ? 1 : 0);
|
||||||
|
|||||||
+4
-1
@@ -45,7 +45,10 @@
|
|||||||
#define default_mqtt_tls_enabled false
|
#define default_mqtt_tls_enabled false
|
||||||
|
|
||||||
#define IF_ROUTER(routerVal, normalVal) \
|
#define IF_ROUTER(routerVal, normalVal) \
|
||||||
((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal))
|
((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER || \
|
||||||
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) \
|
||||||
|
? (routerVal) \
|
||||||
|
: (normalVal))
|
||||||
|
|
||||||
class Default
|
class Default
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -539,7 +539,8 @@ void enableModemSleep()
|
|||||||
|
|
||||||
bool shouldLoraWake(uint32_t msecToWake)
|
bool shouldLoraWake(uint32_t msecToWake)
|
||||||
{
|
{
|
||||||
return msecToWake < portMAX_DELAY && (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER);
|
return msecToWake < portMAX_DELAY && (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||||
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableLoraInterrupt()
|
void enableLoraInterrupt()
|
||||||
|
|||||||
Reference in New Issue
Block a user