Coder Social home page Coder Social logo

ticktwo's Issues

Order of operation

Hi

There appears to be an order of operation?

So I want to start the ticker when a function has been called. All of the examples have the ticker start in setup.

I have tried to move the start to the function but it doesn't appear to work.

If you call .update() before calling start the call back is never called. Is there a fix for this?

Example:

#include "TickTwo.h"

TickTwo timer4(blink, 500);

void setup()
{
}

void loop
{

  timer4.update();
  
  int input = 1;

  if (input == 1)
  {

    doSomeAction();
  }
}

void doSomeAction()
{

  timer4.start();
}

void blink()
{
  digitalWrite(LED_BUILTIN, ledState);
  ledState = !ledState;
}

No delays, eh?

It is easy for you to say no delays! I can control my own sources and use asynchronous solutions, but most hardware drivers and NTP packages contain delays, and it is too large a task for one person to rewrite them all. And a large number of tickers would it be when replacing all delays in the used libraries! What to do when there is no way to avoid delays in included hierarchies of packages? Even the most used I2C drivers are not asynchronous, but use delays.

Linking error

Hi there, I'm trying to use this on M5Stack Core2 (ESP32). I'm using platformio. I don't think this library is registered in the arduino libraries, so I downloaded the zip, renamed folder to "TickTwo" and moved the folder to the platformio "inlcude" folder. It compiles ok however fails on linking:

Linking .pio/build/M5Unified/firmware.elf
.pio/build/M5Unified/src/main.cpp.o:(.literal._Z5setupv+0x30): undefined reference to `TickTwo::start()'
.pio/build/M5Unified/src/main.cpp.o:(.literal._Z4loopv+0x6c): undefined reference to `TickTwo::update()'
.pio/build/M5Unified/src/main.cpp.o:(.literal.startup._GLOBAL__sub_I_leds+0x10): undefined reference to `TickTwo::TickTwo(std::function<void ()>, unsigned int, unsigned int, resolution_t)'
.pio/build/M5Unified/src/main.cpp.o:(.literal.exit._GLOBAL__sub_D_leds+0x0): undefined reference to `TickTwo::~TickTwo()'
.pio/build/M5Unified/src/main.cpp.o: In function `setup()':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::start()'
.pio/build/M5Unified/src/main.cpp.o: In function `loop()':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::update()'
.pio/build/M5Unified/src/main.cpp.o: In function `_GLOBAL__sub_I_leds':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::TickTwo(std::function<void ()>, unsigned int, unsigned int, resolution_t)'
.pio/build/M5Unified/src/main.cpp.o: In function `_GLOBAL__sub_D_leds':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::~TickTwo()'
collect2: error: ld returned 1 exit status
*** [.pio/build/M5Unified/firmware.elf] Error 1
=========================================================================== [FAILED] Took 7.03 seconds ===========================================================================

Environment    Status    Duration
-------------  --------  ------------
M5Unified      FAILED    00:00:07.028
====================================================================== 1 failed, 0 succeeded in 00:00:07.028 ======================================================================
The terminal process "platformio 'run', '--environment', 'M5Unified'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I'm probably doing something wrong, but not sure what. Do you have any suggestions please?

I can provide my code, but it uses the same format as your example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.