You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I apply the changes in PR #138 manually this fixes the compiler error.
Didn't check if the library is full functionable.
Added
#include <WiFi.h>
to line 22 in EspMQTTClient.h
Hardware
Board type : ESP32
Board model : Lolin D32
Logs
Arduino IDE 1.8.19 and 2.x
Espressif esp32 3.01
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleWiFi()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:187:5: error: 'WiFi' was not declared in this scope
187 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:194:27: error: 'WiFi' was not declared in this scope
194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:194:44: error: 'WL_CONNECTED' was not declared in this scope; did you mean 'MQTT_CONNECTED'?
194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED);
| ^~~~~~~~~~~~
| MQTT_CONNECTED
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:215:27: error: 'WL_CONNECT_FAILED' was not declared in this scope; did you mean 'MQTT_CONNECT_FAILED'?
215 | if(WiFi.status() == WL_CONNECT_FAILED || millis() - _lastWifiConnectiomAttemptMillis >= _wifiReconnectionAttemptDelay)
| ^~~~~~~~~~~~~~~~~
| MQTT_CONNECT_FAILED
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleMQTT()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:325:9: error: 'WiFi' was not declared in this scope
325 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionEstablished()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:362:75: error: 'WiFi' was not declared in this scope
362 | Serial.printf("WiFi: Connected (%fs), ip : %s \n", millis()/1000.0, WiFi.localIP().toString().c_str());
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionLost()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:388:5: error: 'WiFi' was not declared in this scope
388 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::connectToWifi()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:555:3: error: 'WiFi' was not declared in this scope
555 | WiFi.mode(WIFI_STA);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:555:13: error: 'WIFI_STA' was not declared in this scope; did you mean 'WIFI_IF_STA'?
555 | WiFi.mode(WIFI_STA);
| ^~~~~~~~
| WIFI_IF_STA
The text was updated successfully, but these errors were encountered:
Thanks chrisweather, I have been having trouble connecting with my ESP32 with the other libraries, just no response, then I saw this library and tried it and got the same WiFi problem. I should learn to read the Bugs before I spend the time trying to fix something you already fixed. Thanks Again. I also think that there should be an #include "PubSubClient.h" in the header to make sure that tis library is also installed.
I know, that it can be fixed with this small change. There's also a PR for this fix for this library.
It would be more comfortable to simply install the library without any additional modifications.
Unfortunately this project seems to be orphaned.
Description of the problem
With Espressif esp32 2.0.17 everything works fine.
esp32 3.x includes breaking changes to wifi handling
https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html
When I apply the changes in PR #138 manually this fixes the compiler error.
Didn't check if the library is full functionable.
Added
#include <WiFi.h>
to line 22 in EspMQTTClient.h
Hardware
Logs
Arduino IDE 1.8.19 and 2.x
Espressif esp32 3.01
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleWiFi()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:187:5: error: 'WiFi' was not declared in this scope
187 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:194:27: error: 'WiFi' was not declared in this scope
194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:194:44: error: 'WL_CONNECTED' was not declared in this scope; did you mean 'MQTT_CONNECTED'?
194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED);
| ^~~~~~~~~~~~
| MQTT_CONNECTED
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:215:27: error: 'WL_CONNECT_FAILED' was not declared in this scope; did you mean 'MQTT_CONNECT_FAILED'?
215 | if(WiFi.status() == WL_CONNECT_FAILED || millis() - _lastWifiConnectiomAttemptMillis >= _wifiReconnectionAttemptDelay)
| ^~~~~~~~~~~~~~~~~
| MQTT_CONNECT_FAILED
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleMQTT()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:325:9: error: 'WiFi' was not declared in this scope
325 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionEstablished()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:362:75: error: 'WiFi' was not declared in this scope
362 | Serial.printf("WiFi: Connected (%fs), ip : %s \n", millis()/1000.0, WiFi.localIP().toString().c_str());
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionLost()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:388:5: error: 'WiFi' was not declared in this scope
388 | WiFi.disconnect(true);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::connectToWifi()':
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:555:3: error: 'WiFi' was not declared in this scope
555 | WiFi.mode(WIFI_STA);
| ^~~~
C:\ProgrammePortable\arduino-1.8.19\portable\sketchbook\libraries\EspMQTTClient\src\EspMQTTClient.cpp:555:13: error: 'WIFI_STA' was not declared in this scope; did you mean 'WIFI_IF_STA'?
555 | WiFi.mode(WIFI_STA);
| ^~~~~~~~
| WIFI_IF_STA
The text was updated successfully, but these errors were encountered: