From 3fc7d23049dd3d0240086724f542dfaddf03ffb2 Mon Sep 17 00:00:00 2001 From: "Dirk O. Kaar" Date: Sun, 13 Mar 2022 20:42:46 +0100 Subject: [PATCH] Apply suggested style fixes. --- .../examples/AutoSleepDemo/AutoSleepDemo.ino | 13 ++++++------ .../ForcedLightSleep/ForcedLightSleep.ino | 7 ++++--- .../ForcedModemSleep/ForcedModemSleep.ino | 5 +++-- .../examples/LowPowerDemo/LowPowerDemo.ino | 12 +++++------ tests/host/common/MockEsp.cpp | 20 ++++++------------- 5 files changed, 26 insertions(+), 31 deletions(-) diff --git a/libraries/esp8266/examples/AutoSleepDemo/AutoSleepDemo.ino b/libraries/esp8266/examples/AutoSleepDemo/AutoSleepDemo.ino index ae717ddbae..13f158ae09 100644 --- a/libraries/esp8266/examples/AutoSleepDemo/AutoSleepDemo.ino +++ b/libraries/esp8266/examples/AutoSleepDemo/AutoSleepDemo.ino @@ -35,9 +35,9 @@ // enter your WiFi configuration below const char* AP_SSID = "SSID"; // your router's SSID here -const char* AP_PASS = "PSK"; // your router's password here +const char* AP_PASS = "PSK"; // your router's password here -uint32_t timeout = 30E3; // 30 second timeout on the WiFi connection +uint32_t timeout = 30E3; // 30 second timeout on the WiFi connection esp8266::polledTimeout::oneShotMs wifiTimeout(timeout); // 30 second timeout on WiFi connection ESP8266WebServer server(80); @@ -63,7 +63,8 @@ void handleNotFound() { void setup() { Serial.begin(74880); - while (!Serial); + while (!Serial) + ; delay(100); Serial.println(); WiFi.mode(WIFI_STA); @@ -83,9 +84,9 @@ void setup() { } WiFi.setAutoReconnect(true); - //if (MDNS.begin("esp8266")) { - // Serial.println("MDNS responder started"); - //} + // if (MDNS.begin("esp8266")) { + // Serial.println("MDNS responder started"); + // } server.on("/", handleRoot); diff --git a/libraries/esp8266/examples/ForcedLightSleep/ForcedLightSleep.ino b/libraries/esp8266/examples/ForcedLightSleep/ForcedLightSleep.ino index 28fa6faf74..a373fcff5d 100644 --- a/libraries/esp8266/examples/ForcedLightSleep/ForcedLightSleep.ino +++ b/libraries/esp8266/examples/ForcedLightSleep/ForcedLightSleep.ino @@ -54,10 +54,11 @@ void wakeupCallback() { void setup() { Serial.begin(74880); - while (!Serial); + while (!Serial) + ; delay(100); - pinMode(LED_BUILTIN, OUTPUT); // activity and status indicator - digitalWrite(LED_BUILTIN, LOW); // turn on the LED + pinMode(LED_BUILTIN, OUTPUT); // activity and status indicator + digitalWrite(LED_BUILTIN, LOW); // turn on the LED pinMode(WAKE_UP_PIN, INPUT_PULLUP); // polled to advance tests, interrupt for Forced Light Sleep attachInterrupt(WAKE_UP_PIN, wakeupPinIsr, FALLING); } diff --git a/libraries/esp8266/examples/ForcedModemSleep/ForcedModemSleep.ino b/libraries/esp8266/examples/ForcedModemSleep/ForcedModemSleep.ino index cd2f62200d..6a99bd0860 100644 --- a/libraries/esp8266/examples/ForcedModemSleep/ForcedModemSleep.ino +++ b/libraries/esp8266/examples/ForcedModemSleep/ForcedModemSleep.ino @@ -35,9 +35,10 @@ void wakeupCallback() { void setup() { Serial.begin(74880); - while (!Serial); + while (!Serial) + ; delay(100); - pinMode(LED_BUILTIN, OUTPUT); // activity and status indicator + pinMode(LED_BUILTIN, OUTPUT); // activity and status indicator digitalWrite(LED_BUILTIN, LOW); // turn on the LED } diff --git a/libraries/esp8266/examples/LowPowerDemo/LowPowerDemo.ino b/libraries/esp8266/examples/LowPowerDemo/LowPowerDemo.ino index 9daa97db12..5bc076a4a0 100644 --- a/libraries/esp8266/examples/LowPowerDemo/LowPowerDemo.ino +++ b/libraries/esp8266/examples/LowPowerDemo/LowPowerDemo.ino @@ -289,9 +289,9 @@ void runTest7() { // WiFi.shutdown(nv->wss); // Forced Modem Sleep for a more Instant Deep Sleep, // and no extended RFCAL as it goes into Deep Sleep Serial.println(F("going into Deep Sleep now...")); - printMillis(); // show time difference across sleep - testPoint_HIGH; // testPoint set HIGH to track Deep Sleep period, cleared at startup() - ESP.deepSleep(10E6); // good night! D0 fires a reset in 10 seconds... + printMillis(); // show time difference across sleep + testPoint_HIGH; // testPoint set HIGH to track Deep Sleep period, cleared at startup() + ESP.deepSleep(10E6); // good night! D0 fires a reset in 10 seconds... // if you do ESP.deepSleep(0); it needs a RESET to come out of sleep (RTC is disconnected) // maximum timed Deep Sleep interval ~ 3 to 4 hours depending on the RTC timer, see the README // the 2 uA GPIO amperage during Deep Sleep can't drive the LED so it's not lit now, although @@ -309,7 +309,7 @@ void runTest8() { Serial.println(F("going into Deep Sleep now...")); Serial.flush(); // needs a delay(10) or Serial.flush() else it doesn't print the whole message testPoint_HIGH; // testPoint set HIGH to track Deep Sleep period, cleared at startup() - ESP.deepSleep(10E6); // good night! D0 fires a reset in 10 seconds... + ESP.deepSleep(10E6); // good night! D0 fires a reset in 10 seconds... Serial.println(F("What... I'm not asleep?!?")); // it will never get here } @@ -322,7 +322,7 @@ void runTest9() { Serial.println(F("going into Deep Sleep now...")); Serial.flush(); // needs a delay(10) or Serial.flush() else it doesn't print the whole message testPoint_HIGH; // testPoint set HIGH to track Deep Sleep period, cleared at startup() - ESP.deepSleepInstant(10E6); // good night! D0 fires a reset in 10 seconds... + ESP.deepSleepInstant(10E6); // good night! D0 fires a reset in 10 seconds... Serial.println(F("What... I'm not asleep?!?")); // it will never get here } @@ -335,7 +335,7 @@ void runTest10() { Serial.println(F("going into Deep Sleep now...")); Serial.flush(); // needs a delay(10) or Serial.flush() else it doesn't print the whole message testPoint_HIGH; // testPoint set HIGH to track Deep Sleep period, cleared at startup() - ESP.deepSleepInstant(10E6); // good night! D0 fires a reset in 10 seconds... + ESP.deepSleepInstant(10E6); // good night! D0 fires a reset in 10 seconds... Serial.println(F("What... I'm not asleep?!?")); // it will never get here } diff --git a/tests/host/common/MockEsp.cpp b/tests/host/common/MockEsp.cpp index 455f8824c6..4b6afa907f 100644 --- a/tests/host/common/MockEsp.cpp +++ b/tests/host/common/MockEsp.cpp @@ -100,9 +100,7 @@ bool EspClass::forcedModemSleep(uint32_t duration_us, void (*wakeupCb)()) return true; } -void EspClass::forcedModemSleepOff() -{ -} +void EspClass::forcedModemSleepOff() { } bool EspClass::forcedLightSleepBegin(uint32_t duration_us, void (*wakeupCb)()) { @@ -116,21 +114,15 @@ void EspClass::forcedLightSleepEnd(bool cancel) (void)cancel; } -void EspClass::autoModemSleep() { -} - -void EspClass::autoLightSleep() { -} +void EspClass::autoModemSleep() { } -void EspClass::autoSleepOff() { -} +void EspClass::autoLightSleep() { } -void EspClass::neverSleep() { -} +void EspClass::autoSleepOff() { } -void EspClass::neverSleepOff() { -} +void EspClass::neverSleep() { } +void EspClass::neverSleepOff() { } void EspClass::restart() {