mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-01 23:58:20 +00:00
19 lines
538 B
C++
19 lines
538 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace mesh {
|
|
namespace wifi {
|
|
|
|
// MeshCore stores WiFi power save as: 0=min, 1=none, 2=max. ESP32 WiFi and
|
|
// Bluetooth coexistence requires modem sleep, so "none" must fall back to the
|
|
// minimum sleep policy whenever Bluetooth is active.
|
|
inline uint8_t effectivePowerSave(uint8_t configured,
|
|
bool bluetooth_active) {
|
|
if (configured > 2) configured = 1;
|
|
return bluetooth_active && configured == 1 ? 0 : configured;
|
|
}
|
|
|
|
} // namespace wifi
|
|
} // namespace mesh
|