Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Missing default case in switch causes  #10

Closed
@jenschr

Description

@jenschr

Describe the bug

In the example file "FullyFeatured_ESP32.ino", the Switch case does not have a "default" to catch anything not handled.

Steps to Reproduce

Compile example "FullyFeatured_ESP32.ino" in Arduino IDE with board set to "Adafruit Feather ESP32-S2".

Expected behavior

Expected the file to compile without errors

Actual behavior

Error compiling....

Solution

Just add a default case for the WiFiEvent(WiFiEvent_t event) method outside the "if" so that both versions has a default so you don't hqve to handle all possible cases:

default: break;

Information

Arduino IDE version: 1.8.19
ESP32 Core Version 2.0.4
OS: OSX 11.6

Context:
Trying to make the basic example compile

Additional context

Relevant error message:

/Users/jensa/Documents/Arduino/FullyFeatured_ESP32/FullyFeatured_ESP32.ino: In function 'void WiFiEvent(arduino_event_id_t)':
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_SCAN_DONE' not handled in switch [-Werror=switch]
   switch (event)
          ^
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_STA_STOP' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_START' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_STOP' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_STACONNECTED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_STADISCONNECTED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_AP_GOT_IP6' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WIFI_FTM_REPORT' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_START' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_STOP' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_CONNECTED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_DISCONNECTED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_GOT_IP' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_ETH_GOT_IP6' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WPS_ER_SUCCESS' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WPS_ER_FAILED' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WPS_ER_TIMEOUT' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WPS_ER_PIN' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_WPS_ER_PBC_OVERLAP' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_SC_SCAN_DONE' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_SC_FOUND_CHANNEL' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_SC_GOT_SSID_PSWD' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_SC_SEND_ACK_DONE' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_INIT' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_DEINIT' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_START' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_END' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_CRED_RECV' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_CRED_FAIL' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_PROV_CRED_SUCCESS' not handled in switch [-Werror=switch]
FullyFeatured_ESP32:51:10: error: enumeration value 'ARDUINO_EVENT_MAX' not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
Multiple libraries were found for "WiFi.h"
 Used: /Users/jensa/Library/Arduino15/packages/esp32/hardware/esp32/2.0.4/libraries/WiFi
 Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
Using library WiFi at version 2.0.0 in folder: /Users/jensa/Library/Arduino15/packages/esp32/hardware/esp32/2.0.4/libraries/WiFi 
Using library AsyncMQTT_Generic at version 1.6.1 in folder: /Users/jensa/Documents/Arduino/libraries/AsyncMQTT_Generic 
Using library AsyncTCP at version 1.1.1 in folder: /Users/jensa/Documents/Arduino/libraries/AsyncTCP 
exit status 1
enumeration value 'ARDUINO_EVENT_WIFI_SCAN_DONE' not handled in switch [-Werror=switch]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions