Cant compile M5ez.h
-
Hi, I am a relative beginner to arduino, M5Stack and M5ez. I was trying to use M5ez in a test project however if I use #include <M5ez.h> then the sketch won't compile. Even the basic Hellow_World example included with the M5ez won't compile for me.
I have follow all steps in https://github.com/M5ez/M5ez
and installed both M5ez and ezTime library
I have selected the correct board.Now, I turn to you, the masters of M5ez. What did I do wrong?
---------------------------------------------- I get the following error ------------------------------------
Arduino:1.8.19 (Windows 10), Kort:"M5Stack-Core-ESP32, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None"C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In lambda function:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1133:38: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?
if(WIFI_REASON_ASSOC_FAIL == info.disconnected.reason) { ^~~~~~~~~~~~ eth_connected
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static void ezWifi::begin()':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1139:19: error: 'SYSTEM_EVENT_STA_DISCONNECTED' is not a member of 'arduino_event_id_t'
}, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static bool ezWifi::_connection(ezMenu*)':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:13: error: 'struct esp_wps_config_t' has no member named 'crypto_funcs'
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:29: error: 'g_wifi_default_wps_crypto_funcs' was not declared in this scope
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:29: note: suggested alternative: 'g_wifi_default_wpa_crypto_funcs'
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ g_wifi_default_wpa_crypto_funcs
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: no matching function for call to 'onEvent(void (&)(arduino_event_id_t, system_event_info_t))'
WiFi.onEvent(_WPShelper); ^
In file included from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiSTA.h:28,
from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFi.h:32, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src/M5ez.h:36, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1:
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:159:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventCb, arduino_event_id_t)' <near match>
wifi_event_id_t onEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); ^~~~~~~
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:159:21: note: conversion of argument 1 would be ill-formed:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: invalid conversion from 'void ()(arduino_event_id_t, system_event_info_t)' to 'WiFiEventCb' {aka 'void ()(arduino_event_id_t)'} [-fpermissive]
WiFi.onEvent(_WPShelper); ^
In file included from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiSTA.h:28,
from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFi.h:32, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src/M5ez.h:36, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1:
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:161:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventSysCb, arduino_event_id_t)' <near match>
wifi_event_id_t onEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); ^~~~~~~
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:161:21: note: conversion of argument 1 would be ill-formed:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: invalid conversion from 'void ()(arduino_event_id_t, system_event_info_t)' to 'WiFiEventSysCb' {aka 'void ()(arduino_event_t*)'} [-fpermissive]
WiFi.onEvent(_WPShelper); ^
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static void ezWifi::_WPShelper(arduino_event_id_t, system_event_info_t)':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1467:17: warning: comparison between 'enum arduino_event_id_t' and 'enum system_event_id_t' [-Wenum-compare]
if (event == SYSTEM_EVENT_STA_WPS_ER_PIN) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: At global scope:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:2238:2: warning: unknown escape sequence: '|'
"KB14|!?:;\#$^&#SP#KB15|*()_-+=|#Del#KB0|More#LCK:SYM|Lock#KB16|'"`@%\/#KB17|<>{}#Done", //KB13
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:2241:2: warning: unknown escape sequence: '#'
"'#"#`#@#%#/###Back", //KB16
^~~~~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Använd: C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi
Oanvänd: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "SD.h"
Använd: C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\SD
Oanvänd: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
Error compiling for board M5Stack-Core-ESP32.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.--------------------------------- End -----------------------------------------------------
-
Hello @EricR
you are not doing anything wrong. The issue is that the M5ez library has been written a while ago when Arduino ESP32 framework v1.x was the latest. However today we have Arduino ESP32 framework v2.x which moved some stuff around and by doing so broke some things.
I see three options to go forward:- adapt the M5ez to the latest Arduino ESP32 framework v2.x
- use Arduino ESP32 framework v1.x
- persuade Rop (the maintainer) to fix M5ez
The last option might be difficult as I haven't seen Rop in the M5Stack forums for a long time.
BTW: in
M5ez.h
there are some #defines - you probably don't need all of them. For instance disabling WPS like this#define M5EZ_WPSx
already reduces the errors.Thanks
Felix -
Hi @felmue and thank for you're quick respond
I was wondering about the framework. To the best of my understanding do I use the 1.8.19 framework. It is what the upper left corner tells at least. Should M5ez not work for me?
Do I have to reinstall Arduino IDE to "downgrade" to a framework that works?
Thanks again for you're time
-
Hello @EricR
sorry if I wasn't clear - I meant the Arduino ESP32 framework. (I've clarified my previous post.)
The Arduino ESP32 framework is installed via the Boards Manager. Normally the latest available version is installed. But any version can be selected and up-/downgraded to.
Please be aware that when you downgrade the Arduino ESP32 framework in the Arduino IDE, that this will affect all your ESP32 related projects, which might then fail to compile due to a too old Arduino ESP32 framework version.
BTW: 1.8.19 is the version of the Arduino IDE you are using.
Thanks
Felix -
Hello @EricR
without downgrading the Arduino ESP32 framework (e.g. using v2.0.3) I was able to compile M5ez with the following three modifications.
- In M5ez.h disable WPS by replacing
#define M5EZ_WPS
with#define M5EZ_WPSx
. - In M5ez.cpp replace
info.disconnected.reason
withinfo.wifi_sta_disconnected.reason
. - In M5ez.cpp replace
SYSTEM_EVENT_STA_DISCONNECTED
withARDUINO_EVENT_WIFI_STA_DISCONNECTED
.
Thanks
Felix - In M5ez.h disable WPS by replacing
-
Hi @felmue and thanks. This helps a lot.
-
@felmue said in Cant compile M5ez.h:
Hello @EricR
without downgrading the Arduino ESP32 framework (e.g. using v2.0.3) I was able to compile M5ez with the following three modifications.
- In M5ez.h disable WPS by replacing
#define M5EZ_WPS
with#define M5EZ_WPSx
. - In M5ez.cpp replace
info.disconnected.reason
withinfo.wifi_sta_disconnected.reason
. - In M5ez.cpp replace
SYSTEM_EVENT_STA_DISCONNECTED
withARDUINO_EVENT_WIFI_STA_DISCONNECTED
.
Thanks
FelixThanks a lot! I am starting again to program for M5Stack after a long time and I was having problems compiling M5ez and understanding where the problem was, but you solved this for me!
- In M5ez.h disable WPS by replacing
-
@felmue said in Cant compile M5ez.h:
Hello @EricR
without downgrading the Arduino ESP32 framework (e.g. using v2.0.3) I was able to compile M5ez with the following three modifications.
- In M5ez.h disable WPS by replacing
#define M5EZ_WPS
with#define M5EZ_WPSx
. - In M5ez.cpp replace
info.disconnected.reason
withinfo.wifi_sta_disconnected.reason
. - In M5ez.cpp replace
SYSTEM_EVENT_STA_DISCONNECTED
withARDUINO_EVENT_WIFI_STA_DISCONNECTED
.
Thanks
FelixThanks! Just like Crazyhorse I came back to my M5 after about a year break. Your info saved a noob days of misery!!!
- In M5ez.h disable WPS by replacing