-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing WiFi.h #include directive #138
Open
per1234
wants to merge
1
commit into
plapointe6:master
Choose a base branch
from
per1234:include-wifi_h
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The "EspMQTTClient" library references objects declared by the `WiFi.h` header in the "esp32" boards platform's bundled "WiFi" library. Previously, the "EspMQTTClient" library relied on its `#include` directive for the `WebServer.h` header of the "WiFiServer" library providing an `#include` directive for the `WiFi.h` header. This fragile code was broken by changes made in the version of the "WiFiServer" library bundled with the 3.0.0 release of the "esp32" boards platform, causing the library to no longer compile for ESP32-based boards: c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleWiFi()': c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp:187:5: error: 'WiFi' was not declared in this scope 187 | WiFi.disconnect(true); | ^~~~ c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp:194:27: error: 'WiFi' was not declared in this scope 194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED); | ^~~~ c:\Users\per\Documents\Arduino\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:\Users\per\Documents\Arduino\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:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleMQTT()': c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp:325:9: error: 'WiFi' was not declared in this scope 325 | WiFi.disconnect(true); | ^~~~ c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionEstablished()': c:\Users\per\Documents\Arduino\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:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::onWiFiConnectionLost()': c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp:388:5: error: 'WiFi' was not declared in this scope 388 | WiFi.disconnect(true); | ^~~~ c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp: In member function 'void EspMQTTClient::connectToWifi()': c:\Users\per\Documents\Arduino\libraries\EspMQTTClient\src\EspMQTTClient.cpp:555:3: error: 'WiFi' was not declared in this scope 555 | WiFi.mode(WIFI_STA); | ^~~~ c:\Users\per\Documents\Arduino\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 bug is solved by adding an `#include` directive for the `WiFi.h` header the "EspMQTTClient" library depends on.
Thanks for posting this! |
This issue, also if fixed by adding the WiFi.h library, couse the impossibility to set static IP Address by adding WiFi.config(local_IP, gateway, subnet, primaryDNS) in the setup of the program. It worked for sure until the 3.0.0 release of the "esp32" boards platform. Can you check and fix the library to manage static IP Address in some way? Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "EspMQTTClient" library references objects declared by the
WiFi.h
header in the "esp32" boards platform's bundled "WiFi" library.Previously, the "EspMQTTClient" library relied on its
#include
directive for theWebServer.h
header of the "WiFiServer" library providing an#include
directive for theWiFi.h
header:https://github.com/espressif/arduino-esp32/blob/2.0.17/libraries/WebServer/src/WebServer.h#L29
This fragile code was broken by changes (espressif/arduino-esp32@f2026f1) made in the version of the "WiFiServer" library bundled with the 3.0.0 release of the "esp32" boards platform:
causing the library to no longer compile for ESP32-based boards:
The bug is solved by adding an
#include
directive for theWiFi.h
header the "EspMQTTClient" library depends on.Fixes #142
Fixes #140
Originally reported at https://forum.arduino.cc/t/broken-dependencies/1266624