瀏覽代碼

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

Thomas Buck 2 年之前
父節點
當前提交
6e16d0483c
共有 2 個文件被更改,包括 12 次插入5 次删除
  1. 1
    1
      platformio.ini
  2. 11
    4
      src/WifiStuff.cpp

+ 1
- 1
platformio.ini 查看文件

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

+ 11
- 4
src/WifiStuff.cpp 查看文件

@@ -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");

Loading…
取消
儲存