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

Library incompatible with newest version of Ticker library #9

Open
dduehren opened this issue Mar 7, 2021 · 15 comments
Open

Library incompatible with newest version of Ticker library #9

dduehren opened this issue Mar 7, 2021 · 15 comments

Comments

@dduehren
Copy link

dduehren commented Mar 7, 2021

`n file included from D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:29:0:

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.h: In constructor 'LoggerRoutine::LoggerRoutine(Logger&, float)':

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.h:44:20: error: no matching function for call to 'Ticker::Ticker()'

   period(period){}; 

                ^

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.h:44:20: note: candidates are:

In file included from D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.h:32:0,

             from D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:29:

D:\David\MyDocuments\Arduino\libraries\Ticker/Ticker.h:74:2: note: Ticker::Ticker(fptr, uint32_t, uint32_t, resolution_t)

Ticker(fptr callback, uint32_t timer, uint32_t repeat = 0, resolution_t resolution = MICROS);

^

D:\David\MyDocuments\Arduino\libraries\Ticker/Ticker.h:74:2: note: candidate expects 4 arguments, 0 provided

D:\David\MyDocuments\Arduino\libraries\Ticker/Ticker.h:62:7: note: Ticker::Ticker(const Ticker&)

class Ticker {

   ^

D:\David\MyDocuments\Arduino\libraries\Ticker/Ticker.h:62:7: note: candidate expects 1 argument, 0 provided

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp: In function 'void routine(LoggerRoutine*)':

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:33:17: error: 'class Ticker' has no member named 'attach'

logRun->ticker.attach(logRun->period,routine,logRun);

             ^

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp: In member function 'bool LoggerRoutine::begin(bool)':

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:41:10: error: 'class Ticker' has no member named 'attach'

ticker.attach(period, routine, this);

      ^

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp: In member function 'void LoggerRoutine::setPeriod(float, bool)':

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:53:10: error: 'class Ticker' has no member named 'detach'

ticker.detach();

      ^

D:\David\MyDocuments\Arduino\libraries\ESP_Logger\src\logger_routine.cpp:54:10: error: 'class Ticker' has no member named 'attach'

ticker.attach(period, routine, this);

      ^`
@fabianoriccardi
Copy link
Owner

Hi David,
I need to know which version of board you are using (esp8266 or esp32) and the version of the core. I had just tested the latest version of esp8266 and esp32 and both works.

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@fabianoriccardi
Copy link
Owner

okI had used version arduino8266 version 2.7.4 to test the library. All the examples seem to compiled and work properly. Can you send me the code that do not compile?

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@fabianoriccardi
Copy link
Owner

Usually when you are reporting a bug you shouldn't report all your project, but only the relevant part. However, I think that the problem is in the class declaration: you missed to include LoggerSPIFFS in mush_logger.h:

#define <logger_spiffs.h>  

Moreover, you can't initiate a class member like you have done:

LoggerSPIFFS mushLog("/log/Mushlog.log");

This is wrong. You should only declare it:

LoggerSPIFFS mushLog;

And initialize the members in the constructor of MushLogger.

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@dduehren
Copy link
Author

dduehren commented Mar 14, 2021 via email

@fabianoriccardi
Copy link
Owner

In this case, you have to know what initializer list is (you can search on google). Basically you must initialize all the members that do not have a default constructor (like LoggerSPIFFS) at the begin of your constructor. Example:

Mush_Logger::Mush_Logger(): mushLog("path/to/file"){
// Your code
}

@fabianoriccardi
Copy link
Owner

I found out a bit of time to revise this library... I think I will integrate a circular logger in next release.

@dduehren
Copy link
Author

dduehren commented Mar 28, 2021 via email

@dduehren
Copy link
Author

dduehren commented Mar 28, 2021 via email

@fabianoriccardi
Copy link
Owner

fabianoriccardi commented Mar 29, 2021

Hi thanks for availability. I have already started to write a skeleton of the library, and I can see some similarity with yours.

I will extend the virtual class Logger with a "Logger Rotate" class (or something similar) to make this extension more coherent to the rest of the library.

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

2 participants