Skip to content

Commit

Permalink
Don't powersave on Wifi (#5443)
Browse files Browse the repository at this point in the history
* Don't go into light sleep with wifi enabled

* Move

* Trunk
  • Loading branch information
thebentern authored Nov 25, 2024
1 parent 7c2b677 commit 58c957f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PowerFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "sleep.h"
#include "target_specific.h"

#if HAS_WIFI && !defined(ARCH_PORTDUINO)
#include "mesh/wifi/WiFiAPClient.h"
#endif

#ifndef SLEEP_TIME
#define SLEEP_TIME 30
#endif
Expand Down Expand Up @@ -377,9 +381,9 @@ void PowerFSM_setup()
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)
#ifdef ARCH_ESP32
// See: https://github.com/meshtastic/firmware/issues/1071
// Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiated through the
// modules
if ((isRouter || config.power.is_power_saving) && !isTrackerOrSensor) {
// Don't add power saving transitions if we are a power saving tracker or sensor or have Wifi enabled. Sleep will be initiated
// through the modules
if ((isRouter || config.power.is_power_saving) && !isWifiAvailable() && !isTrackerOrSensor) {
powerFSM.add_timed_transition(&stateNB, &stateLS,
Default::getConfiguredOrDefaultMs(config.power.min_wake_secs, default_min_wake_secs), NULL,
"Min wake timeout");
Expand Down

0 comments on commit 58c957f

Please sign in to comment.