Hello Rui,
this is the code in which the error is located:
//——————————————————
void WiFiEvent(WiFiEvent_t event)
{
Serial.printf(“[WiFi-event] event: %d\n”, event);
switch(event)
{
case SYSTEM_EVENT_STA_GOT_IP:
Serial.println(“WiFi connected”);
Serial.println(“IP address: “);
Serial.println(WiFi.localIP());
connectToMqtt();
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
Serial.println(“WiFi lost connection”);
xTimerStop(mqttReconnectTimer, 0); // ensure we don’t reconnect to MQTT while reconnecting to Wi-Fi
xTimerStart(wifiReconnectTimer, 0);
break;
}
}
//——————————————————
and this is the error I get if I try to compile:
marked is the line “switch(event)” in the code
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_SCAN_DONE’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_START’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_STOP’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_CONNECTED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_AUTHMODE_CHANGE’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_LOST_IP’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_SUCCESS’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_FAILED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_TIMEOUT’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_PIN’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_START’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_STOP’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_STACONNECTED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_STADISCONNECTED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_STAIPASSIGNED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_AP_PROBEREQRECVED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_GOT_IP6’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_ETH_START’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_ETH_STOP’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_ETH_CONNECTED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_ETH_DISCONNECTED’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_ETH_GOT_IP’ not handled in switch [-Werror=switch]
MQTT_Client_ESP32_Nr_1:63: error: enumeration value ‘SYSTEM_EVENT_MAX’ not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
exit status 1
enumeration value ‘SYSTEM_EVENT_WIFI_READY’ not handled in switch [-Werror=switch]
To me, with my limited programing skills, it looks like there are events that are not used which cause the error.
Thanks, Peter
Hello Peter, can you provide a few more details?
- Which Arduino IDE version do you have installed?
- Which ESP32 board are you using?
- When did you install the ESP32 board add-on?
Thanks,
Rui
Hello Rui,
- Arduino IDE version 1.8.5
- ESP32 board = Geekcreit® ESP32 Development Board WiFi+Bluetooth Ultra Low Power Consumption Dual Cores ESP-32 ESP-32S Board fom Banggood
- I used this board and Arduino IDE before (my question to NTPClient)
Thanks,
Peter
Hi Peter,
I honestly can’t figure out why it’s giving you that error, I’ve tried to go back and re-install everything from scratch with the latest versions and I can’t replicate that error on my end.
Can you re-install the ESP32 add-on following the new method to ensure you have the latest version of the ESP32 add-on? https://rntlab.com/installing-the-esp32-board-in-arduino-ide-windows-mac-os-x-and-linux/
I also recommend updating the libraries to ensure you’re using the latest version:
Thanks for your patience,
Rui
HELLO RUI,
it’s me who has to thank a lot for your patience!
What I have done:
1. delete AsyncTCP, load it using your Link and copy it into the Library (was same Version), restart Arduino IDE
check/compile > same errors as before
2. delete async_,mqtt_client, load it using your Linkand copy it into the Library (was same Version), restart Arduino IDE
check/compile > same errors as before
3. delete Arduino.app (was v.1.8.5), download Arduino.app v.1.8.5,
install ESP32 following https://rntlab.com/installing-the-esp32-board-in-arduino-ide-windows-mac-os-x-and-linux/
4. restart Arduino.app, check/compile > same errors as before
It seems to me, that I have some “Skeletons in the Closet”, but how to find them.
In the File “/Users/peterkern/Library/Arduino15/preferences.txt” are Information stored, which are not valid anymore, like Path to external SSD.
Thanks a lot
Peter
That’s definitely weird and I don’t seem to figure out what’s happening (or find anyone else having that problem).
Can you compile previous examples from the Wi-Fi module (the web server projects)?
Can you try this project and let me know if it works for you with your current installation? https://rntlab.com/esp32-web-server-control-outputs/
I’m trying to figure out, if it’s a problem with the WiFi.h library.
Hello Rui,
I added some lines …
void WiFiEvent(WiFiEvent_t event)
{
Serial.printf(“[WiFi-event] event: %d\n”, event);
switch(event)
{
case SYSTEM_EVENT_STA_GOT_IP:
Serial.println(“WiFi connected”);
Serial.println(“IP address: “);
Serial.println(WiFi.localIP());
connectToMqtt();
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
Serial.println(“WiFi lost connection”);
xTimerStop(mqttReconnectTimer, 0); // ensure we don’t reconnect to MQTT while reconnecting to Wi-Fi
xTimerStart(wifiReconnectTimer, 0);
break;
case SYSTEM_EVENT_WIFI_READY:
Serial.println(“SYSTEM_EVENT_WIFI_READY”);
break;
case SYSTEM_EVENT_SCAN_DONE:
Serial.println(“SYSTEM_EVENT_SCAN_DONE”);
break;
case SYSTEM_EVENT_STA_START:
Serial.println(“SYSTEM_EVENT_STA_START”);
break;
case SYSTEM_EVENT_STA_STOP:
Serial.println(“SYSTEM_EVENT_STA_STOP”);
break;
case SYSTEM_EVENT_STA_CONNECTED:
Serial.println(“SYSTEM_EVENT_STA_CONNECTED”);
break;
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
Serial.println(“SYSTEM_EVENT_STA_AUTHMODE_CHANGE”);
break;
case SYSTEM_EVENT_STA_LOST_IP:
Serial.println(“SYSTEM_EVENT_STA_LOST_IP”);
break;
case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
Serial.println(“SYSTEM_EVENT_STA_WPS_ER_SUCCESS”);
break;
case SYSTEM_EVENT_STA_WPS_ER_FAILED:
Serial.println(“SYSTEM_EVENT_STA_WPS_ER_FAILED”);
break;
case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT:
Serial.println(“SYSTEM_EVENT_STA_WPS_ER_TIMEOUT”);
break;
case SYSTEM_EVENT_STA_WPS_ER_PIN:
Serial.println(“SYSTEM_EVENT_STA_WPS_ER_PIN”);
break;
case SYSTEM_EVENT_AP_START:
Serial.println(“SYSTEM_EVENT_AP_START”);
break;
case SYSTEM_EVENT_AP_STOP:
Serial.println(“SYSTEM_EVENT_AP_STOP”);
break;
case SYSTEM_EVENT_AP_STACONNECTED:
Serial.println(“SYSTEM_EVENT_AP_STACONNECTED”);
break;
case SYSTEM_EVENT_AP_STADISCONNECTED:
Serial.println(“SYSTEM_EVENT_AP_STADISCONNECTED”);
break;
case SYSTEM_EVENT_AP_STAIPASSIGNED:
Serial.println(“SYSTEM_EVENT_AP_STAIPASSIGNED”);
break;
case SYSTEM_EVENT_AP_PROBEREQRECVED:
Serial.println(“SYSTEM_EVENT_AP_PROBEREQRECVED”);
break;
case SYSTEM_EVENT_GOT_IP6:
Serial.println(“SYSTEM_EVENT_GOT_IP6”);
break;
case SYSTEM_EVENT_ETH_START:
Serial.println(“SYSTEM_EVENT_ETH_START”);
break;
case SYSTEM_EVENT_ETH_STOP:
Serial.println(“SYSTEM_EVENT_ETH_STOP”);
break;
case SYSTEM_EVENT_ETH_CONNECTED:
Serial.println(“SYSTEM_EVENT_ETH_CONNECTED”);
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
Serial.println(“SYSTEM_EVENT_ETH_DISCONNECTED”);
break;
case SYSTEM_EVENT_ETH_GOT_IP:
Serial.println(“SYSTEM_EVENT_ETH_GOT_IP”);
break;
case SYSTEM_EVENT_MAX:
Serial.println(“SYSTEM_EVENT_MAX”);
break;
}
}
Now the old Errors are gone, but new are displayed:
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiClient.cpp: In member function ‘virtual uint8_t WiFiClient::connected()’:
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiClient.cpp:440:13: warning: unused variable ‘res’ [-Wunused-variable]
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
^
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiMulti.cpp: In member function ‘uint8_t WiFiMulti::run(uint32_t)’:
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiMulti.cpp:129:27: warning: variable ‘mac’ set but not used [-Wunused-but-set-variable]
uint8_t * mac;
^
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiSTA.cpp: In static member function ‘static void WiFiSTAClass::_smartConfigCallback(uint32_t, void*)’:
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiSTA.cpp:686:30: warning: unused variable ‘type’ [-Wunused-variable]
smartconfig_type_t * type = (smartconfig_type_t *)result;
^
/Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi/src/WiFiSTA.cpp:697:26: warning: unused variable ‘ip’ [-Wunused-variable]
ip4_addr_t * ip = (ip4_addr_t *)result;
^
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp: In constructor ‘AsyncMqttClient::AsyncMqttClient()’:
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:30:18: warning: missing initializer for member ‘AsyncMqttClientInternals::ParsingInformation::maxTopicLength’ [-Wmissing-field-initializers]
, _nextPacketId(1) {
^
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:30:18: warning: missing initializer for member ‘AsyncMqttClientInternals::ParsingInformation::topicBuffer’ [-Wmissing-field-initializers]
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:30:18: warning: missing initializer for member ‘AsyncMqttClientInternals::ParsingInformation::packetType’ [-Wmissing-field-initializers]
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:30:18: warning: missing initializer for member ‘AsyncMqttClientInternals::ParsingInformation::packetFlags’ [-Wmissing-field-initializers]
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:30:18: warning: missing initializer for member ‘AsyncMqttClientInternals::ParsingInformation::remainingLength’ [-Wmissing-field-initializers]
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:40:61: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
sprintf(_generatedClientId, “esp32%06x”, ESP.getEfuseMac());
^
/Users/peterkern/Documents/Arduino/Sketchbook/libraries/async_mqtt_client/src/AsyncMqttClient.cpp:40:61: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
cc1plus: some warnings being treated as errors
Mehrere Bibliotheken wurden für “WiFi.h” gefunden
Benutzt: /Users/peterkern/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi
Nicht benutzt: /Applications/Arduino_1.8.5/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
Fehler beim Kompilieren für das Board DOIT ESP32 DEVKIT V1.
I know, that the last Error “several libraries for “WiFi.h” found can be solved by deleting the WiFi library in the Arduino IDE.
Perhaps this Informations help you to get me the hint.
Thanks a lot
Peter
For what I can tell, it’s a problem with your WiFi.h library.
Both the ESP32 and Arduino board use the WiFi.h library. However, those libraries are different for the ESP32 and Arduino. If you’re having trouble compiling ESP32 code that uses the WiFi.h library, you must remove the Arduino WiF lilibrary from your Arduino IDE installation.
If you go to your Arduino installation: arduino-1.8.5\libraries
Does it appear a folder WiFi? Remove that folder from the libraries folder, because that’s the Arduino WiFi library.
After removing that folder, your code should compile. Let me know your results.
Hello Rui,
what I have done:
– deleted /Users/peterkern/Library/Arduino15 to get a fresh installation
– only “https://dl.espressif.com/dl/package_esp32_index.json” as Entry in Additional Board URLs
– moved all libraries from “/Applications/Arduino_1.8.5/Arduino.app/Contents/Java/libraries” to “/Users/peterkern/Documents/Arduino/Sketchbook/libraries” to have better Control about Duplicates
– loaded Sketch “ESP32_WiFi_Multisensor” and it compiled without Fault
– loaded Sketch “MQTT_Client_ESP32_Nr_1” and got Faults
– searched the WEB again and found the Solution in “https://www.bountysource.com/issues/58009182-esp32-websocketserver-example-does-not-compile-wstype_error” > “I solved the problem modify in the preferences-> compiler warnigs-> to default”. I did it, as it was All, and it compiled without an Error.
It is a PIA, that a faulty Preference can eat so much Time.
Rui, thanks a lot for your help
Peter
Sorry about all the trouble, but those specific scenarios are very hard to debug. I’m glad you made it work and thanks for posting the solution.
Regards,
Rui
Hello!
I got the same fault as Peter got and for me it was the same soulution, to change the preferences-> compiler warnigs-> to default. Then it compiled with no problem!
Regards Anders