sensor_mqtt_v3_7.ino (12.8 KB)
Earlier this year, I created a simple ToF sensor using a XIAO_ESP32C3 using typical libraries. Health took me offline for a while, so now I'm getting back to my project. Which, after updating my libraries to current without imagining the consequences will no longer compile. Sigh.
I BELIEVE the issue is related to espMQTTClient now supporting direct WiFi configuration, but perhaps does NOT support some of the old WiFi methods, but I'm stumped on how to proceed.
The compiler complains about things like "WiFi not declared in this scope":
/Users/etimberl/Documents/Hobbies/Micro Controllers/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleWiFi()':
/Users/etimberl/Documents/Hobbies/Micro Controllers/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp:187:5: error: 'WiFi' was not declared in this scope
187 | WiFi.disconnect(true);
| ^~~~
/Users/etimberl/Documents/Hobbies/Micro Controllers/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp:194:27: error: 'WiFi' was not declared in this scope
194 | bool isWifiConnected = (WiFi.status() == WL_CONNECTED);
| ^~~~
/Users/etimberl/Documents/Hobbies/Micro Controllers/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
/Users/etimberl/Documents/Hobbies/Micro Controllers/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
/Users/etimberl/Documents/Hobbies/Micro Controllers/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp: In member function 'bool EspMQTTClient::handleMQTT()':
/Users/etimberl/Documents/Hobbies/Micro Controllers/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp:325:9: error: 'WiFi' was not declared in this scope
325 | WiFi.disconnect(true);
I'm not clear what I need to do to get back to working code here? It all seems to be about initializing, then checking the WiFi connection, but my addled brain can't seem to make sense of it..
Thoughts or suggestions? I'm planning on migrating to WIFImanager, and it would seem when I mix in espMQTTCLient without understanding the current situation, I might just end up right back here again?