marvinroger / async-mqtt-client

📶 An Arduino for ESP8266 asynchronous MQTT client implementation
MIT License
837 stars 268 forks source link

error: 'SYSTEM_EVENT_STA_DISCONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_DISCONNECTED'? #303

Open lboue opened 3 months ago

lboue commented 3 months ago

Hello, I am facing the following building error with FullyFeatured-ESP32.ino. I think it's linked to events changes with arduino-esp32-3.0 branch.

D:\Dev\Arduino\Elecrow\CrowPanel_7.0\AsyncMqttClientTest\AsyncMqttClientTest\AsyncMqttClientTest.ino: In function 'void WiFiEvent(arduino_event_id_t)':
D:\Dev\Arduino\Elecrow\CrowPanel_7.0\AsyncMqttClientTest\AsyncMqttClientTest\AsyncMqttClientTest.ino:36:10: error: 'SYSTEM_EVENT_STA_GOT_IP' was not declared in this scope; did you mean 'IP_EVENT_STA_GOT_IP'?
   36 |     case SYSTEM_EVENT_STA_GOT_IP:
      |          ^~~~~~~~~~~~~~~~~~~~~~~
      |          IP_EVENT_STA_GOT_IP
D:\Dev\Arduino\Elecrow\CrowPanel_7.0\AsyncMqttClientTest\AsyncMqttClientTest\AsyncMqttClientTest.ino:42:10: error: 'SYSTEM_EVENT_STA_DISCONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_DISCONNECTED'?
   42 |     case SYSTEM_EVENT_STA_DISCONNECTED:
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |          WIFI_EVENT_STA_DISCONNECTED

Using library WiFi at version 2.0.0 in folder: C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\WiFi 
Using library Networking at version 1.0.0 in folder: C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\Network 
Using library AsyncMqttClient at version 0.9.0 in folder: D:\Dev\Arduino\Elecrow\CrowPanel_7.0\HA\libraries\AsyncMqttClient 
Using library AsyncTCP at version 1.1.4 in folder: D:\Dev\Arduino\Elecrow\CrowPanel_7.0\HA\libraries\AsyncTCP 
exit status 1

Compilation error: 'SYSTEM_EVENT_STA_GOT_IP' was not declared in this scope; did you mean 'IP_EVENT_STA_GOT_IP'?

Boot logs

21:59:00.181 -> ------------------------------------------
21:59:00.181 -> Software Info:
21:59:00.181 -> ------------------------------------------
21:59:00.181 ->   Compile Date/Time : Jun  5 2024 20:42:36
21:59:00.181 ->   Compile Host OS   : windows
21:59:00.181 ->   ESP-IDF Version   : v5.1.4-51-g442a798083-dirty
21:59:00.181 ->   Arduino Version   : 3.0.1
21:59:00.181 -> ------------------------------------------
21:59:00.181 -> Board Info:
21:59:00.181 -> ------------------------------------------
21:59:00.215 ->   Arduino Board     : ESP32S3_DEV
21:59:00.215 ->   Arduino Variant   : esp32s3
21:59:00.215 ->   Arduino FQBN      : esp32:esp32:esp32s3:UploadSpeed=921600,USBMode=hwcdc,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,CPUFreq=240,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=debug,PSRAM=opi,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
21:59:00.254 -> ============ Before Setup End ============

Could you help me to fix it?

Regards

lboue commented 3 months ago

Is there a way to make this library compatible with the 2 versions (arduino-esp32 2.0.x and 3.0.x) by testing in the code?

Building is OK with this testing branch for arduino-esp32-3.0 branch. See #304

The connection event appears correctly in the logs:

22:09:36.489 -> ============ After Setup End =============
22:09:38.635 -> [WiFi-event] event: 16
22:09:38.635 -> WiFi connected
22:09:38.635 -> IP address: 
22:09:38.635 -> 192.168.1.163
22:09:38.635 -> Connecting to MQTT...