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

Ticker.h error for "rfb_ticker.attach_ms" - ITEAD_SONOFF_RFBRIDGE #1586

Closed
kiralikbeyin opened this issue Feb 26, 2019 · 4 comments · Fixed by #1693
Closed

Ticker.h error for "rfb_ticker.attach_ms" - ITEAD_SONOFF_RFBRIDGE #1586

kiralikbeyin opened this issue Feb 26, 2019 · 4 comments · Fixed by #1693
Labels
Arduino Core 2.5.0 Breaking changes in the newest Core version bug
Milestone

Comments

@kiralikbeyin
Copy link

Espurna Version [1.13.4] 2019-02-23
rc2.5.0

ITEAD_SONOFF_RFBRIDGE

rfbridge.ino line 264
_rfb_ticker.attach_ms(RF_SEND_DELAY, _rfbSend);
to
_rfb_ticker.attach_ms(RF_SEND_DELAY, _rfbSendMe);

rfbridge.ino line 221
void _rfbSend() {
to
void _rfbSendMe() {

@reaper7
Copy link
Contributor

reaper7 commented Feb 26, 2019

complete error log for this issue (arduino 1.8.8 on windows 10):

C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\rfbridge.ino: In function 'void _rfbSend(byte*, unsigned char)':

rfbridge:266:54: error: no matching function for call to 'Ticker::attach_ms(int, <unresolved overloaded function type>)'

         _rfb_ticker.attach_ms(RF_SEND_DELAY, _rfbSend);

                                                      ^

C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\rfbridge.ino:266:54: note: candidates are:

In file included from C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\mqtt.ino:16:0:

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Ticker/Ticker.h:60:7: note: void Ticker::attach_ms(uint32_t, Ticker::callback_function_t)

  void attach_ms(uint32_t milliseconds, callback_function_t callback)

       ^

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Ticker/Ticker.h:60:7: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'Ticker::callback_function_t {aka std::function<void()>}'

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Ticker/Ticker.h:78:7: note: template<class TArg> void Ticker::attach_ms(uint32_t, void (*)(TArg), TArg)

  void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)

       ^

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Ticker/Ticker.h:78:7: note:   template argument deduction/substitution failed:

C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\rfbridge.ino:266:54: note:   candidate expects 1 argument, 2 provided

         _rfb_ticker.attach_ms(RF_SEND_DELAY, _rfbSend);

                                                      ^

C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\rfbridge.ino:266:54: note:   candidate expects 1 argument, 0 provided

C:\PROGRAMY\arduino_projekty\espurna_dev\code\espurna\rfbridge.ino:266:54: note:   candidate expects 3 arguments, 2 provided

exit status 1
no matching function for call to 'Ticker::attach_ms(int, <unresolved overloaded function type>)'

Renaming _rfbSend to different name like _rfbSendNoParams solves problem.

@kiralikbeyin
Copy link
Author

Also light.ino have "attach_ms" function

line 694
_light_transition_ticker.attach_ms(LIGHT_TRANSITION_STEP, _lightProviderUpdate);

@reaper7
Copy link
Contributor

reaper7 commented Feb 26, 2019

@kiralikbeyin - yes but procedure _lightProviderUpdate not have variants with parameters.

_rfbSend has three variants

  1. void _rfbSend()
  2. void _rfbSend(byte * code, unsigned char times)
  3. void _rfbSend(byte * message)

@xoseperez xoseperez added bug Arduino Core 2.5.0 Breaking changes in the newest Core version labels Feb 26, 2019
@xoseperez xoseperez added this to the 1.13.6 milestone Feb 26, 2019
@mcspr
Copy link
Collaborator

mcspr commented Feb 27, 2019

Just a note about this:
If I remember right, new ticker API does some things via std::function which really does not like overloaded functions. Renaming works, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arduino Core 2.5.0 Breaking changes in the newest Core version bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants