-
Notifications
You must be signed in to change notification settings - Fork 0
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
Comments
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 I do not know about 8266 but on an arduino, the To use your own timing function, your custom timing function need to have no argument and return an I think the problem here relies on the fact that, for the arduino platform, I think you could solve the issue by changing the definition of CounterFunctionPointer from Please try this and tell me if this as indeed solved the compilation problem. |
Maybe I'll get back to it, right now I'm using Ticker V4.0. |
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.
`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\DAVIDD 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\DAVIDD 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\DAVIDD 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\DAVIDD "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\DAVIDD "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\DAVIDD 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(µs)
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). ` |
Hi.
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.
Have you tried the proposed solution above ? I think it would solve the issue. |
I think so. I made the change and now Countdown compiles with no error.
Thanks for the suggestion
…Sent from my iPhone
David Duehren
On Apr 1, 2021, at 1:17 PM, Antoine Beauchamp ***@***.***> wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
* Fixed issue #5: error: invalid conversion from 'long unsigned int (*)()' to 'SoftTimer::CounterFunctionPointer {aka unsigned int (*)()}' [-fpermissive]
Hi. I have also made corrections in win32Arduino (the unit test library) to change the return type of |
Hi Antoine,
I made the change in my local version and will wait for your official release.
Thanks
…Sent from my iPhone
David Duehren
On Apr 9, 2021, at 9:43 AM, Antoine Beauchamp ***@***.***> wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
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 |
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(µs)
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"
/**************************************************
**************************************************/
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...");
}
//did we waited long enough ?
else if (delayTimer.hasTimedOut() && !ledTimer.hasTimedOut())
{
Serial.println("turning LED ON...");
}
//should the LED be turned OFF ?
else if (delayTimer.hasTimedOut() && ledTimer.hasTimedOut())
{
Serial.println("turning LED OFF...");
}
}>
and
</*
*/
#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>
The text was updated successfully, but these errors were encountered: