8000 Using MenuRenderer::updateTime with FreeRTOS on Arduino Mega may miss timeouts · Issue #321 · forntoh/LcdMenu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Using MenuRenderer::updateTime with FreeRTOS on Arduino Mega may miss timeouts #321

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

Open
1 task done
zonouzi opened this issue Mar 6, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@zonouzi
Copy link
zonouzi commented Mar 6, 2025

What happened?

Hi, when I used your library LcdMenu along with FreeRTOS for Arduino, with "lcd keypad shield".

Image

I have noted that despite calling MenuRenderer::updateTimer regularly, the display won't timeout. I'm using LcdMenu version 5.8.0.
I checked the source of this function, and I realized that to find the timeout, you have used the following:
millis() != startTime + DISPLAY_TIMEOUT
As this check is for equality, it may be missed specially with busy systems (as I undestood, so if I'm wrong please let me know). So I have defined a boolean variable named "isShowing", and changed the "!=" sign to "<", and used the following logic:

void MenuRenderer::updateTimer() {
    if (millis() < startTime + DISPLAY_TIMEOUT) { // !=
	    return;
    }
	if (isShowing) {
		startTime = millis();
		LOG(F("MenuRenderer::timeout"));
		display->hide();
		isShowing = false;
		display->setBacklight(isShowing);
	}
}

I also initialized "isShowing" with "true" (in header file in definition, begin and in restartTime function), and solved my problem.

Version

  • I have checked that I am using the latest version of the library.

What environment are you seeing the problem in?

Arduino

Board type

Arduino Mega 2560

Relevant log output

@zonouzi zonouzi added the bug Something isn't working label Mar 6, 2025
@zonouzi zonouzi changed the title Using MenuRenderer::updateTime with FreeRTOS on Arduino Mega mayl miss timeouts Using MenuRenderer::updateTime with FreeRTOS on Arduino Mega may miss timeouts Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
0