Hi there,
I appeal to you because I stumble on a compilation error of a project of the course “SmartHome” from Random Nerd Tutorials in which I did not modify anything.
The error appears in the sketch that accompanies the book and in the project on GitHub
The reported error is as follows
enumeration value ‘SYSTEM_EVENT_WIFI_READY’ not handled in switch [-Werror=switch]
Can you help me ?
Many thanks in advance
Hi.
Do you have the latest version of the EPS32 boards installed?
Go to Tools > Boards > Boards Manager, search for ESP32. Then, update to the latest version.
Let me know if this solves the issue.
Regards,
Sara
Hello,
Thanks for (as always) responding so quickly.
In the map manager I have
ESP32 by Espressif v 1.0.6 which is the latest.
In preferences, I have
https://dl.espressif.com/dl/package_esp32_index.json
http://arduino.esp8266.com/stable/package_esp8266com_index.json
https://resource.heltec.cn/download/package_heltec_esp32_index.json
https://resource.heltec.cn/download/package_heltec_esp8266_index.json
I’ll add the path you give on page 135 and tell you what’s going on.
Sincerely,
Hi.
Check if the suggestion in this discussion solves the problem: https://github.com/Links2004/arduinoWebSockets/issues/319
Regards,
Sara
Hello,
Thanks for the quick response.
I followed the advice: set the compiler warning from “everything” to “default”
And it works 🙂
While waiting for your advice, I had commented out the lines between the two SYSTEM_EVENT of the connectToWiFi() function and I had added a Serial.pintln(WiFi.localIP()
I enclose the “serial port”
Connecting to Wi-Fi…
debogage WiFi-event:
[WiFi-event] event: 0
debogage WiFi-event:
[WiFi-event] event: 2
debogage WiFi-event:
[WiFi-event] event: 4
debogage WiFi-event:
[WiFi-event] event: 7
WiFi connected
IP address:
192.168.0.41
Connecting to MQTT…
192.168.0.41
Publishing on topic counter at QoS 1, packetId: 0
Publishing on topic counter at QoS 1, packetId: 0
Disconnected from MQTT.
Connecting to MQTT…
Publishing on topic counter at QoS 1, packetId: 0
Publishing on topic counter at QoS 1, packetId: 0
Disconnected from MQTT.
Connecting to MQTT…
Do you know what the 0 2 4 7 stand for?
One more last question:
How to check that we are well connected to MQTT?
Cordially,
Mark
Hi.
The numbers represent a Wi-fi event. You can check a complete list of all events on the table in this article: https://randomnerdtutorials.com/esp32-useful-wi-fi-functions-arduino/#10
The code works with callback functions, so if you’re not connected to MQTT, you’ll receive a message in the Serial Monitor: “Disconnected from MQTT”.
void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
Serial.println(“Disconnected from MQTT.”);
if (WiFi.isConnected()) {
xTimerStart(mqttReconnectTimer, 0);
}
}
Regards,
Sara