Thanks ESP_Sprite
I agree with you on the use
int8_t instead of
char, because there is difference in compiling for Arduino and ESP32: for example if char variable = -1 this instruction mYArray[variable+1]; works in Arduino and crash on ESP32.
For the functions with default variable this is the fragment that works for Arduino:
Code: Select all
...
// .h source
unsigned long clocker(bool ms=false);
...
// .cpp source
unsigned long handleEvents::clocker(bool ms=false) { // returns time at seconds or at milliseconds if ms=true
static unsigned long millisOld = 0;
if (millisOld > millis()) {*ag_Clock += secondsTimerCount;}
millisOld = millis();
if (!ms) return (*ag_Clock)+millis()/1000;
return (*ag_Clock)*1000+millis();
}
Compiling for ESP32 this is the errors list
Code: Select all
Arduino: 1.8.12 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
handleEvents.cpp:14:50: error: default argument given for parameter 1 of 'long unsigned int handleEvents::clocker(bool)' [-fpermissive]
unsigned long handleEvents::clocker(bool ms=false) { // returns time at seconds or at milliseconds if ms=true
^
In file included from sketch\handleEvents.cpp:9:0:
sketch\handleEvents.h:60:17: note: previous specification in 'long unsigned int handleEvents::clocker(bool)' here
unsigned long clocker(bool ms=false);
^
exit status 1
default argument given for parameter 1 of 'long unsigned int handleEvents::clocker(bool)' [-fpermissive]
For completeness the compilation is not aborted in a first attempt where the default declaration was only on the .h script