Browse Source

revert back to older esp32 platform version. had issues getting a wifi ip.

Thomas Buck 2 years ago
parent
commit
6e16d0483c
2 changed files with 12 additions and 5 deletions
  1. 1
    1
      platformio.ini
  2. 11
    4
      src/WifiStuff.cpp

+ 1
- 1
platformio.ini View File

24
     https://github.com/RobTillaart/PCF8574
24
     https://github.com/RobTillaart/PCF8574
25
 
25
 
26
 [env:esp32_main]
26
 [env:esp32_main]
27
-platform = espressif32
27
+platform = platformio/espressif32@3.5.0
28
 board = esp32dev
28
 board = esp32dev
29
 framework = arduino
29
 framework = arduino
30
 build_flags = -D PLATFORM_ESP -D FUNCTION_CONTROL -D TWI_GPIO
30
 build_flags = -D PLATFORM_ESP -D FUNCTION_CONTROL -D TWI_GPIO

+ 11
- 4
src/WifiStuff.cpp View File

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

Loading…
Cancel
Save