Skip to content

Commit

Permalink
wifi: revert to no fpm settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Mar 9, 2023
1 parent be9de1d commit 0ab8c85
Showing 1 changed file with 3 additions and 74 deletions.
77 changes: 3 additions & 74 deletions code/espurna/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ constexpr WiFiSleepType_t sleep() {
return WIFI_SLEEP_MODE;
}

constexpr sleep_type_t forcedSleep() {
return MODEM_SLEEP_T;
}

constexpr uint8_t forcedSleepPin() {
return GPIO_NONE;
}

constexpr GPIO_INT_TYPE forcedSleepLevel() {
return GPIO_PIN_INTR_LOLEVEL;
}

} // namespace build

namespace ap {
Expand Down Expand Up @@ -101,25 +89,12 @@ PROGMEM_STRING(None, "none");
PROGMEM_STRING(Modem, "modem");
PROGMEM_STRING(Light, "light");

PROGMEM_STRING(Low, "low");
PROGMEM_STRING(High, "high");

static constexpr espurna::settings::options::Enumeration<WiFiSleepType_t> WiFiSleepTypeOptions[] PROGMEM {
{WIFI_NONE_SLEEP, None},
{WIFI_MODEM_SLEEP, Modem},
{WIFI_LIGHT_SLEEP, Light},
};

static constexpr espurna::settings::options::Enumeration<sleep_type_t> ForcedSleepTypeOptions[] PROGMEM {
{MODEM_SLEEP_T, Modem},
{LIGHT_SLEEP_T, Light},
};

static constexpr espurna::settings::options::Enumeration<GPIO_INT_TYPE> ForcedSleepLevelOptions[] PROGMEM {
{GPIO_PIN_INTR_LOLEVEL, Low},
{GPIO_PIN_INTR_HILEVEL, High},
};

} // namespace options
} // namespace settings

Expand Down Expand Up @@ -158,24 +133,6 @@ String serialize(WiFiSleepType_t sleep) {
return serialize(wifi::settings::options::WiFiSleepTypeOptions, sleep);
}

template <>
sleep_type_t convert(const String& value) {
return convert(wifi::settings::options::ForcedSleepTypeOptions, value, wifi::build::forcedSleep());
}

String serialize(sleep_type_t sleep) {
return serialize(wifi::settings::options::ForcedSleepTypeOptions, sleep);
}

template <>
GPIO_INT_TYPE convert(const String& value) {
return convert(wifi::settings::options::ForcedSleepLevelOptions, value, wifi::build::forcedSleepLevel());
}

String serialize(GPIO_INT_TYPE interrupt) {
return serialize(wifi::settings::options::ForcedSleepLevelOptions, interrupt);
}

template <>
IPAddress convert(const String& value) {
IPAddress out;
Expand Down Expand Up @@ -472,9 +429,6 @@ namespace keys {

PROGMEM_STRING(TxPower, "wifiTxPwr");
PROGMEM_STRING(Sleep, "wifiSleep");
PROGMEM_STRING(ForcedSleep, "wifiFrcSleep");
PROGMEM_STRING(ForcedSleepPin, "wifiFrcSleepPin");
PROGMEM_STRING(ForcedSleepLevel, "wifiFrcSleepLvl");

} // namespace keys

Expand All @@ -486,18 +440,6 @@ WiFiSleepType_t sleep() {
return getSetting(keys::Sleep, wifi::build::sleep());
}

sleep_type_t forcedSleep() {
return getSetting(keys::ForcedSleep, wifi::build::forcedSleep());
}

uint8_t forcedSleepPin() {
return getSetting(keys::ForcedSleepPin, wifi::build::forcedSleepPin());
}

GPIO_INT_TYPE forcedSleepLevel() {
return getSetting(keys::ForcedSleepLevel, wifi::build::forcedSleepLevel());
}

namespace query {
namespace internal {

Expand Down Expand Up @@ -2237,7 +2179,7 @@ void configure() {
namespace settings {
namespace query {

static constexpr std::array<espurna::settings::query::Setting, 13> Settings PROGMEM {
static constexpr std::array<espurna::settings::query::Setting, 10> Settings PROGMEM {
{{wifi::ap::settings::keys::Ssid, wifi::ap::settings::ssid},
{wifi::ap::settings::keys::Passphrase, wifi::ap::settings::passphrase},
{wifi::ap::settings::keys::Captive, wifi::ap::settings::query::internal::captive},
Expand All @@ -2247,10 +2189,7 @@ static constexpr std::array<espurna::settings::query::Setting, 13> Settings PROG
{wifi::sta::scan::settings::keys::Enabled, wifi::sta::scan::settings::query::enabled},
{wifi::sta::scan::periodic::settings::keys::Threshold, wifi::sta::scan::periodic::settings::query::threshold},
{wifi::settings::keys::TxPower, espurna::wifi::settings::query::internal::txPower},
{wifi::settings::keys::Sleep, espurna::wifi::settings::query::internal::sleep},
{wifi::settings::keys::ForcedSleep, espurna::wifi::settings::query::internal::forcedSleep},
{wifi::settings::keys::ForcedSleepPin, espurna::wifi::settings::query::internal::forcedSleepPin},
{wifi::settings::keys::ForcedSleepLevel, espurna::wifi::settings::query::internal::forcedSleepLevel}}
{wifi::settings::keys::Sleep, espurna::wifi::settings::query::internal::sleep}}
};

// indexed settings for 'sta' connections
Expand Down Expand Up @@ -2793,17 +2732,7 @@ State handleAction(State& state, Action action) {
wifi::sta::disable();
wifi::disable();
publish(wifi::Event::Mode);

const auto type = settings::forcedSleep();
if (!wifi::sleep(type)) {
wifi::action(wifi::Action::TurnOn);
break;
}

if (type == LIGHT_SLEEP_T) {
wifi::action(wifi::Action::TurnOn);
break;
}
break;
}
break;

Expand Down

0 comments on commit 0ab8c85

Please sign in to comment.