Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: invalid conversion from 'long unsigned int (*)()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int (*)()}' [-fpermissive] #5

Closed
dduehren opened this issue Feb 23, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@dduehren
Copy link

I got this error running a slightly modified version of one of your examples running it on an 8266. Hard to see how my small mods could have caused this. Here's more of the compiler ouput <D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h: In constructor 'SoftTimerMillis::SoftTimerMillis()':

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:122:40: error: invalid conversion from 'long unsigned int ()()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int ()()}' [-fpermissive]

SoftTimerMillis() : SoftTimer(&millis)

                                    ^

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:36:3: error: initializing argument 1 of 'SoftTimer::SoftTimer(SoftTimer::CounterFunctionPointer)' [-fpermissive]

SoftTimer(CounterFunctionPointer iCntFuncPtr);

^
D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h: In constructor 'SoftTimerMicros::SoftTimerMicros()':

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:131:40: error: invalid conversion from 'long unsigned int ()()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int ()()}' [-fpermissive]

SoftTimerMicros() : SoftTimer(&micros)

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:36:3: error: initializing argument 1 of 'SoftTimer::SoftTimer(SoftTimer::CounterFunctionPointer)' [-fpermissive]

SoftTimer(CounterFunctionPointer iCntFuncPtr);>

Here's the code
<#include <SoftTimers.h>
#include "Arduino_DebugUtils.h"

// My libraries
#include "boardconfig.h"

/**************************************************

  • Wait 1 second, turn on a LED for 0.3 second.
    **************************************************/
    SoftTimer delayTimer; //millisecond timer
    SoftTimer ledTimer; //millisecond timer

void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);

//update timers
delayTimer.setTimeOutTime(1000); // 1 second.
ledTimer.setTimeOutTime(2000); // 2 second.

//start counting now
delayTimer.reset();
ledTimer.reset();
}

void loop() {
if (!delayTimer.hasTimedOut())
{
Serial.println("waiting...");

//reset LED timer so that is does not time out before delayTimer
ledTimer.reset();

}

//did we waited long enough ?
else if (delayTimer.hasTimedOut() && !ledTimer.hasTimedOut())
{
Serial.println("turning LED ON...");

//turn ON the LED
digitalWrite(ledPin, HIGH);

}

//should the LED be turned OFF ?
else if (delayTimer.hasTimedOut() && ledTimer.hasTimedOut())
{
Serial.println("turning LED OFF...");

//turn OFF the LED
digitalWrite(ledPin, LOW);

//restart both timers
delayTimer.reset();
ledTimer.reset();

}
}>
and
</*

  • Board config library
    */
    #ifndef BOARDCONFIG_H
    #define BD_VER 1 // set to board version being targetted
    #ifndef D5
    #if defined(ESP8266)
    #define D0 (16)
    #define D1 (5)
    #define D2 (4)
    #define D3 (0)
    #define D4 (2)
    #define D5 (14)
    #define D6 (12)
    #define D7 (13)
    #define D8 (15)
    #define TX (1)
    #define RX (3)
    #elif defined(ESP32)
    #define D5 (18)
    #define D6 (19)
    #define D7 (23)
    #define D8 (5)
    #define TX (1)
    #endif
    #endif

if BD_VER == 1

const int sclPin = D1;
const int sdaPin = D2;
const int fanPin = D3;
const int ledPin = D4;
const int piezoPin = D5;
const int thPin = D6;
const int h2oPin = D7;
const int adcPin = A0;

elif BD_VER == 2

const int sclPin = D1;
const int sdaPin = D2;
const int fanPin = D3;
const int ledPin = D4;
const int swrxPin = D5;
const int swtxPin = D6;
const int openPin = D7;
const int dirPin = D8;
const int adcPin = A0;

else

const int ledPin = D0;
const int sclPin = D1;
const int sdaPin = D2;
const int fanPin = D3;
const int fanspdPin = D4;
const int swrxPin = D5;
const int swtxPin = D6;
const int openPin = D7;
const int dirPin = D8;
const int adcPin = A0; //Connected to fault output of switch to fan
#endif //BD_VER logic
#endif BOARDCONFIG_H>

@end2endzone
Copy link
Owner

Hi. Thank you for trying out the library.

Looking at the error you pasted, it seems that your code is trying to use a custom timing function because you are using a special constructor:

SoftTimerMillis() : SoftTimer(&millis);

(you probably created an instance of SoftTimerMillis in your example)

I do not know about 8266 but on an arduino, the millis() function is already linked with a SoftTimer instance so you do not have to specify your own timing function.
In other words, you can just do SoftTimer myTimer;.
Maybe this is something particular about 8266.

To use your own timing function, your custom timing function need to have no argument and return an uint32_t. This is not a native c++ type but a construction that can vary on each platform. Based on your error message SoftTimer::CounterFunctionPointer {aka unsigned int ()()}, it seems to be resolving to an unsigned int.
However, the millis() function is returning an long unsigned int. This is somewhat strange to me as I am more used to deal the term unsigned first followed by either int or long. Anyway, I think long unsigned int is the same as an unsigned long which is not the same type (and possibly not the same size) as an unsigned int.
This is why the compiler is complaining about the problem. It tell you that both type are not identical. With the -fpermissive compilor flag, it could copy the unsigned long to the unsigned int but there is a possibility of truncating the value since one type is bigger than the other.

I think the problem here relies on the fact that, for the arduino platform, uint32_t resolves to an unsigned long (or that unsigned int and unsigned long are the same size) and that matches the return type of the millis() function.
When programming for the 8266, uint32_t and the return type of millis() don't match.

I think you could solve the issue by changing the definition of CounterFunctionPointer from uint32_t to unsigned long.

Please try this and tell me if this as indeed solved the compilation problem.

@dduehren
Copy link
Author

Maybe I'll get back to it, right now I'm using Ticker V4.0.

@dduehren
Copy link
Author

dduehren commented Apr 1, 2021

I came back to look at this and just tried to compile your countdown example - no modifications and got similar result. Have you tried running your examples on an 8266? I'm not trying to make my own private timer, at least not yet. I just want to run some of your examples and they don't run on the 9266.

  • David

`Arduino: 1.8.13 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\David Duehren\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\David Duehren\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\David\MyDocuments\Arduino\libraries -fqbn=esp8266:esp8266:nodemcuv2:xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -vid-pid=10C4_EA60 -ide-version=10813 -build-path C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572 -warnings=none -build-cache C:\Users\DAVIDD1\AppData\Local\Temp\arduino_cache_51041 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python3.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.mkspiffs.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs-2.5.0-4-b40a506.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mklittlefs.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.mklittlefs-2.5.0-4-fe5bb56.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-4-b40a506.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -verbose D:\David\MyDocuments\Arduino\libraries\SoftTimers\examples\Countdown\Countdown.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\David Duehren\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\David Duehren\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\David\MyDocuments\Arduino\libraries -fqbn=esp8266:esp8266:nodemcuv2:xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -vid-pid=10C4_EA60 -ide-version=10813 -build-path C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572 -warnings=none -build-cache C:\Users\DAVIDD1\AppData\Local\Temp\arduino_cache_51041 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python3.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.mkspiffs.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs-2.5.0-4-b40a506.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mklittlefs.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.mklittlefs-2.5.0-4-fe5bb56.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-4-b40a506.path=C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -verbose D:\David\MyDocuments\Arduino\libraries\SoftTimers\examples\Countdown\Countdown.ino

Using board 'nodemcuv2' from platform in folder: C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4

Using core 'esp8266' from platform in folder: C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4

Detecting libraries used...

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/lwip2/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD="ESP8266_NODEMCU"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu" "C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572\sketch\Countdown.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for SoftTimers.h: [SoftTimers@1.3.0]

ResolveLibrary(SoftTimers.h)

-> candidates: [SoftTimers@1.3.0]

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/lwip2/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD="ESP8266_NODEMCU"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu" "-ID:\David\MyDocuments\Arduino\libraries\SoftTimers\src" "C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572\sketch\Countdown.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/lwip2/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\DAVIDD~1\AppData\Local\Temp\arduino_build_185572/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD="ESP8266_NODEMCU"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu" "-ID:\David\MyDocuments\Arduino\libraries\SoftTimers\src" "D:\David\MyDocuments\Arduino\libraries\SoftTimers\src\SoftTimers.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Generating function prototypes...

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/lwip2/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD="ESP8266_NODEMCU"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu" "-ID:\David\MyDocuments\Arduino\libraries\SoftTimers\src" "C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572\sketch\Countdown.ino.cpp" -o "C:\Users\DAVIDD~1\AppData\Local\Temp\arduino_build_185572\preproc\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\DAVIDD~1\AppData\Local\Temp\arduino_build_185572\preproc\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3" "C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/signing.py" --mode header --publickey "D:\David\MyDocuments\Arduino\libraries\SoftTimers\examples\Countdown/public.key" --out "C:\Users\DAVIDD~1\AppData\Local\Temp\arduino_build_185572/core/Updater_Signing.h"

"C:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/lwip2/include" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD="ESP8266_NODEMCU"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266" "-IC:\Users\David Duehren\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu" "-ID:\David\MyDocuments\Arduino\libraries\SoftTimers\src" "C:\Users\DAVIDD1\AppData\Local\Temp\arduino_build_185572\sketch\Countdown.ino.cpp" -o "C:\Users\DAVIDD~1\AppData\Local\Temp\arduino_build_185572\sketch\Countdown.ino.cpp.o"

In file included from D:\David\MyDocuments\Arduino\libraries\SoftTimers\examples\Countdown\Countdown.ino:1:0:

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h: In constructor 'SoftTimerMillis::SoftTimerMillis()':

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:122:40: error: invalid conversion from 'long unsigned int ()()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int ()()}' [-fpermissive]

SoftTimerMillis() : SoftTimer(&millis)

                                    ^

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:36:3: error: initializing argument 1 of 'SoftTimer::SoftTimer(SoftTimer::CounterFunctionPointer)' [-fpermissive]

SoftTimer(CounterFunctionPointer iCntFuncPtr);

^

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h: In constructor 'SoftTimerMicros::SoftTimerMicros()':

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:131:40: error: invalid conversion from 'long unsigned int ()()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int ()()}' [-fpermissive]

SoftTimerMicros() : SoftTimer(&micros)

                                    ^

D:\David\MyDocuments\Arduino\libraries\SoftTimers\src/SoftTimers.h:36:3: error: initializing argument 1 of 'SoftTimer::SoftTimer(SoftTimer::CounterFunctionPointer)' [-fpermissive]

SoftTimer(CounterFunctionPointer iCntFuncPtr);

^

Using library SoftTimers at version 1.3.0 in folder: D:\David\MyDocuments\Arduino\libraries\SoftTimers

exit status 1

Error compiling for board NodeMCU 1.0 (ESP-12E Module).

`

@end2endzone
Copy link
Owner

Hi.
Thank you for getting back to me and trying to debug the library.

Have you tried running your examples on an 8266?

No. I don't have access to an ESP8266. This makes the debugging of the problem complicated. I wish you could help me debug the library (see below) and have a solution that works on most platforms.

I think you could solve the issue by changing the definition of CounterFunctionPointer from uint32_t to unsigned long.
Please try this and tell me if this as indeed solved the compilation problem.

Have you tried the proposed solution above ? I think it would solve the issue.

@dduehren
Copy link
Author

dduehren commented Apr 2, 2021 via email

@end2endzone end2endzone added the bug Something isn't working label Apr 4, 2021
end2endzone added a commit that referenced this issue Apr 4, 2021
* Fixed issue #5: error: invalid conversion from 'long unsigned int (*)()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int (*)()}' [-fpermissive]
@end2endzone
Copy link
Owner

Hi.
I have changed the definition of CounterFunctionPointer to unsigned long. If you need to quickly download the library again, you can do so by downloading the code "as is" from https://github.com/end2endzone/SoftTimers/archive/refs/heads/master.zip.

I have also made corrections in win32Arduino (the unit test library) to change the return type of millis and micros functions to unsigned long (which is matching the official Arduino.h definition). This has actually created issues with SoftTimer unit tests. Please allow me a few days to fix theses problem and I will create an official new release of the library that includes the fix for this issue.

@dduehren
Copy link
Author

dduehren commented Apr 9, 2021 via email

@end2endzone
Copy link
Owner

I have released version 2.0.0. The Arduino Library Manager should pickup this new release in a few days and allow you to download and install the library.

I will close this issue but if you ever have a problem related to this, don't hesitate to reopen

@dduehren
Copy link
Author

dduehren commented Apr 10, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants