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

Build error. No Matching function call. #7

Open
Booli opened this issue May 30, 2017 · 4 comments
Open

Build error. No Matching function call. #7

Booli opened this issue May 30, 2017 · 4 comments

Comments

@Booli
Copy link

Booli commented May 30, 2017

Hey,

I'm trying to use this nifty library but getting an error. I can't find any real examples but reading the docs this should be the way to do it right?

11:02:32 Building the project | Processing...
[Tue May 30 11:02:32 2017] Processing nodemcuv2 (platform: espressif8266, board: nodemcuv2, framework: arduino)
--------------------------------------------------------------------------------
xtensa-lx106-elf-g++ -o "/Users/pim/physee/TestSerial/TestingSerial.ino.cpp" -x c++ -fpreprocessed -dD -E "/var/folders/bn/72tdqbq95vl27rvpm984507r0000gn/T/tmpdzlGWI"
Collected 27 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <EspSoftwareSerial> (/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial)
|-- <ESP8266WiFi> v1.0 (/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
|-- <TickerScheduler> (/Users/pim/.platformio/lib/TickerScheduler)
|   |-- <Ticker> v1.0 (/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker)
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/src/TestingSerial.ino.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker -I/Users/pim/.platformio/lib/TickerScheduler -I/Users/pim/physee/TestSerial /Users/pim/physee/TestSerial/TestingSerial.ino.cpp
xtensa-lx106-elf-ar rcs .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
xtensa-lx106-elf-ranlib .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/Esp.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Esp.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/FS.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/HardwareSerial.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/HardwareSerial.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/IPAddress.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/IPAddress.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/MD5Builder.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/MD5Builder.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/Print.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Print.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/Schedule.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Schedule.cpp
/Users/pim/physee/TestSerial/TestingSerial.ino: In function 'void setup()':
/Users/pim/physee/TestSerial/TestingSerial.ino:44:41: error: no matching function for call to 'TickerScheduler::add(int, int, void (&)(), int, bool)'
ts.add(0, 1000, AggregateData, 0, true);
^
/Users/pim/physee/TestSerial/TestingSerial.ino:44:41: note: candidate is:
In file included from /Users/pim/physee/TestSerial/TestingSerial.ino:6:0:
/Users/pim/.platformio/lib/TickerScheduler/TickerScheduler.h:80:10: note: bool TickerScheduler::add(uint8_t, uint32_t, tscallback_t, void*, boolean)
bool add(uint8_t i, uint32_t period, tscallback_t, void *, boolean shouldFireNow = false);
^
/Users/pim/.platformio/lib/TickerScheduler/TickerScheduler.h:80:10: note:   no known conversion for argument 3 from 'void()' to 'tscallback_t {aka std::function<void(void*)>}'
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/Stream.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Stream.cpp
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/FrameworkArduino/StreamString.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/Users/pim/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu /Users/pim/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/StreamString.cpp
*** [.pioenvs/nodemcuv2/src/TestingSerial.ino.o] Error 1
========================== [ERROR] Took 1.22 seconds ==========================
11:02:34 ERROR | it took 1.42s

Using Deviot, with PlatformIO build chain.

Extract of the code

// Reads the Serial in  _non blocking_ way! 
// Important for the loop handling in Arduino.
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <TickerScheduler.h>
#include "config.h"
#define rxPin D7
#define txPin D8

SoftwareSerial mySerial(rxPin, txPin); // RX, TX

char receivedChars[buffsize];   // an array to store the received data
char tempChars[buffsize];       // an array to store the received data
char recv_label[num_keywords][label_bytes]  = {0}; // {0} tells the compiler to initalize it with 0. 
char recv_value[num_keywords][value_bytes]  = {0}; // That does not mean it is filled with 0's
char value[num_keywords][value_bytes]       = {0};
static byte blockindex = 0;

bool new_data = false;
bool blockend = false;

String mac_address;

TickerScheduler ts(1);

void AggregateData();

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(19200);
  mySerial.begin(19200);
  Serial.println("<NodeMCU online...>");

  //Set our mac_address which we will later use as ID for API
  mac_address = WiFi.macAddress();
  mac_address.replace(":", "");
  mac_address.toLowerCase();
  Serial.println(mac_address);
  Serial.println(WiFi.SSID());

  // Setup the TickerScheduler
  // Add aggregate Ticker - ID(0)
  ts.add(0, 1000, AggregateData, 0, true);
}


void loop() {
    // This loop is setup to be non blocking.

    // Receive information on Serial from MPPT
    RecvWithEndMarker();
    HandleNewData();

    //Update the TickerScheduler
    ts.update();
}


void AggregateData() {
    Serial.println("I got hit! AggregateTime!");
}
@Toshik
Copy link
Owner

Toshik commented May 30, 2017

Ah. There was some rework with usage. I haven't updated readme yet.
Try this one:

t.add(0, 1000, [&](void*) { AggregateData(); }, nullptr, true);

or you can pass argument to callback by:

int arg = 1;
...
t.add(0, 1000, [&](void* arg) { ... }, &arg, true);
...
arg++;

@Booli
Copy link
Author

Booli commented May 30, 2017

That works! Thanks, although the syntax is really hard to read I must say.

@tretyakovsa
Copy link

Good idea! Make a working example of use.

@cmtmc
Copy link

cmtmc commented Mar 5, 2018

Hi Toshik,
May you please provide an example for passing argument to callback? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants