|
@@ -723,24 +723,28 @@ void wifi_setup() {
|
723
|
723
|
// https://github.com/espressif/arduino-esp32/issues/2501#issuecomment-513602522
|
724
|
724
|
debug.println("WiFi: connection work-around");
|
725
|
725
|
WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) {
|
726
|
|
- if (info.wifi_sta_disconnected.reason == 202) {
|
|
726
|
+ if (info.disconnected.reason == 202) {
|
727
|
727
|
esp_sleep_enable_timer_wakeup(10);
|
728
|
728
|
esp_deep_sleep_start();
|
729
|
729
|
delay(100);
|
730
|
730
|
}
|
731
|
|
- }, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
|
|
731
|
+ }, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
|
732
|
732
|
|
733
|
733
|
// Connect to WiFi AP
|
734
|
734
|
debug.println("WiFi: SSID=" WIFI_SSID);
|
735
|
735
|
debug.print("WiFi: connecting");
|
736
|
736
|
WiFi.mode(WIFI_STA);
|
737
|
737
|
WiFi.begin(WIFI_SSID, WIFI_PW);
|
738
|
|
- while (WiFi.status() != WL_CONNECTED) {
|
739
|
|
- debug.print(".");
|
|
738
|
+
|
|
739
|
+ int ws;
|
|
740
|
+ while ((ws = WiFi.status()) != WL_CONNECTED) {
|
|
741
|
+ debug.print(String(" ") + String(ws));
|
740
|
742
|
delay(LED_CONNECT_BLINK_INTERVAL);
|
741
|
743
|
digitalWrite(BUILTIN_LED_PIN, !digitalRead(BUILTIN_LED_PIN));
|
742
|
744
|
}
|
743
|
745
|
debug.println();
|
|
746
|
+
|
|
747
|
+ debug.println(String("WiFi: status=") + String(WiFi.status()));
|
744
|
748
|
|
745
|
749
|
// Set hostname workaround
|
746
|
750
|
debug.println("WiFi: set hostname work-around");
|
|
@@ -748,6 +752,9 @@ void wifi_setup() {
|
748
|
752
|
|
749
|
753
|
#endif
|
750
|
754
|
|
|
755
|
+ debug.print("WiFi: got IPv4: ");
|
|
756
|
+ debug.println(WiFi.localIP());
|
|
757
|
+
|
751
|
758
|
#ifdef ENABLE_INFLUXDB_LOGGING
|
752
|
759
|
// Setup InfluxDB Client
|
753
|
760
|
debug.println("WiFi: set InfluxDB database");
|