mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-01 03:47:23 +03:00
Migrate from astyle to clang-format (#8464)
This commit is contained in:
committed by
Max Prokhorov
parent
46190b61f1
commit
19b7a29720
@ -17,7 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <include/WiFiState.h> // WiFiState structure details
|
||||
#include <include/WiFiState.h> // WiFiState structure details
|
||||
|
||||
WiFiState state;
|
||||
|
||||
@ -26,7 +26,7 @@ const char* password = STAPSK;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(74880);
|
||||
//Serial.setDebugOutput(true); // If you need debug output
|
||||
// Serial.setDebugOutput(true); // If you need debug output
|
||||
Serial.println("Trying to resume WiFi connection...");
|
||||
|
||||
// May be necessary after deepSleep. Otherwise you may get "error: pll_cal exceeds 2ms!!!" when trying to connect
|
||||
@ -36,17 +36,14 @@ void setup() {
|
||||
// Here you can do whatever you need to do that doesn't need a WiFi connection.
|
||||
// ---
|
||||
|
||||
ESP.rtcUserMemoryRead(RTC_USER_DATA_SLOT_WIFI_STATE, reinterpret_cast<uint32_t *>(&state), sizeof(state));
|
||||
ESP.rtcUserMemoryRead(RTC_USER_DATA_SLOT_WIFI_STATE, reinterpret_cast<uint32_t*>(&state), sizeof(state));
|
||||
unsigned long start = millis();
|
||||
|
||||
if (!WiFi.resumeFromShutdown(state)
|
||||
|| (WiFi.waitForConnectResult(10000) != WL_CONNECTED)) {
|
||||
if (!WiFi.resumeFromShutdown(state) || (WiFi.waitForConnectResult(10000) != WL_CONNECTED)) {
|
||||
Serial.println("Cannot resume WiFi connection, connecting via begin...");
|
||||
WiFi.persistent(false);
|
||||
|
||||
if (!WiFi.mode(WIFI_STA)
|
||||
|| !WiFi.begin(ssid, password)
|
||||
|| (WiFi.waitForConnectResult(10000) != WL_CONNECTED)) {
|
||||
if (!WiFi.mode(WIFI_STA) || !WiFi.begin(ssid, password) || (WiFi.waitForConnectResult(10000) != WL_CONNECTED)) {
|
||||
WiFi.mode(WIFI_OFF);
|
||||
Serial.println("Cannot connect!");
|
||||
Serial.flush();
|
||||
@ -64,7 +61,7 @@ void setup() {
|
||||
// ---
|
||||
|
||||
WiFi.shutdown(state);
|
||||
ESP.rtcUserMemoryWrite(RTC_USER_DATA_SLOT_WIFI_STATE, reinterpret_cast<uint32_t *>(&state), sizeof(state));
|
||||
ESP.rtcUserMemoryWrite(RTC_USER_DATA_SLOT_WIFI_STATE, reinterpret_cast<uint32_t*>(&state), sizeof(state));
|
||||
|
||||
// ---
|
||||
// Here you can do whatever you need to do that doesn't need a WiFi connection anymore.
|
||||
|
Reference in New Issue
Block a user