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

Fix issue with functions scheduled from scheduled functions #6770

Merged
merged 2 commits into from
Nov 14, 2019

Conversation

dok-net
Copy link
Contributor

@dok-net dok-net commented Nov 13, 2019

Fixes #6764

Here's my take - unknowingly working in parallel to @d-a-v - on the same issue #6764.
Copy and pasted, then adapted, the code from run_scheduled_recurrent_functions

Also, extended the MCVE to end re-scheduling at one point, in order to show that the end condition still works:

#include "Arduino.h"
#include "Schedule.h"

void cp()
{
	static int c = 0;
	if ((c++ % 10000) == 0) Serial.printf(".");
	if (c < 100000) schedule_function(cp);
}

void setup()
{
	Serial.begin(115200);
	schedule_function(cp);
}

void loop()
{
	static int l = 0;
	if ((l++ % 10000) == 0) Serial.printf(":");
}

The result:

:.:.:.:.:.:.:.:.:.:::::::::::::::::::::::

@devyte devyte added this to the 2.6.1 milestone Nov 14, 2019
@devyte devyte changed the title Fixes #6764 Fix issue with functions scheduled from scheduled functions Nov 14, 2019
@devyte devyte merged commit 6f3c57b into esp8266:master Nov 14, 2019
@dok-net dok-net deleted the recursivescheduling branch November 14, 2019 09:36
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

Successfully merging this pull request may close these issues.

using schedule_function() within scheduled function prevents loop from running
2 participants