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

clearTimer() does not work in 1.6.5 ( it does in 1.6.4 ) #14

Closed
mm108 opened this issue Jul 2, 2021 · 4 comments
Closed

clearTimer() does not work in 1.6.5 ( it does in 1.6.4 ) #14

mm108 opened this issue Jul 2, 2021 · 4 comments

Comments

@mm108
Copy link

mm108 commented Jul 2, 2021

hi,

TimerLib.clearTimer();

no longer works in 1.6.5. I have tried it with the below 2 sample programs. The test devices are ESP32.

clearTimer() works on version 1.6.4.

I have tried with both setInterval and setTimeout.

Example 1 (setInterval)

#include "Arduino.h"
#include "uTimerLib.h"

volatile unsigned long int prevMillis = 0;
volatile unsigned long int actMillis = 0;

void timed_function() {
  Serial.println(actMillis - prevMillis);
  prevMillis = actMillis;
  TimerLib.clearTimer();
}

void setup() {
  Serial.begin(115200);
  Serial.println("Timer started!");
  TimerLib.setInterval_s(timed_function, 2);
  prevMillis = millis();
}

void loop() {
  actMillis = millis();
}

Example 2 (setTimeout)

#include "Arduino.h"
#include "uTimerLib.h"

volatile unsigned long int prevMillis = 0;
volatile unsigned long int actMillis = 0;

void timed_function() {
  Serial.println(actMillis - prevMillis);
  TimerLib.clearTimer();
}

void setup() {
  Serial.begin(115200);
  Serial.println("Timer started!");
  TimerLib.setTimeout_s(timed_function, 2);
  prevMillis = millis();
}

void loop() {
  actMillis = millis();
}
@Naguissa
Copy link
Owner

Naguissa commented Jul 2, 2021

Fixed! Created 1.6.6 release.

@mm108
Copy link
Author

mm108 commented Jul 2, 2021

Wow, fantastic! Thank you.

@mm108 mm108 closed this as completed Jul 2, 2021
@Naguissa
Copy link
Owner

Naguissa commented Jul 2, 2021

I just was on the computer and that notification arrived; it was quite easy... ;-)

@mm108
Copy link
Author

mm108 commented Jul 2, 2021

I just was on the computer and that notification arrived; it was quite easy... ;-)

Right place at the right time! ... :-D Cool, thanks once again.

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