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

[NEW] Add LCD timeout #15

Closed
forntoh opened this issue Mar 16, 2021 · 3 comments · Fixed by #104
Closed

[NEW] Add LCD timeout #15

forntoh opened this issue Mar 16, 2021 · 3 comments · Fixed by #104
Labels
enhancement Improve readability/performance/maintainability good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@forntoh
Copy link
Owner

forntoh commented Mar 16, 2021

The library should include an optional timeout.

void setTimeout(uint8_t timeout);
  • When the time elapses, the LCD is cleared and the backlight is switched off.
  • The LCD's state will be restored when a key is pressed (or if action invokes paint()).
  • When the timeout is set to zero, the LCD stays on as long as it is powered.
  • If no timeout is provided, a default of 5s is used.

Benefit

  • Save energy 🤷‍♂️🚮⚡
@forntoh forntoh added enhancement Improve readability/performance/maintainability good first issue Good for newcomers labels Mar 16, 2021
@strikar21
Copy link

strikar21 commented Dec 13, 2021

define before setup:

unsigned long currentMillis;
unsigned long startMillis;
unsigned long period = 10*1000; //( FOR 10 second Delay)

inside the void loop function:

  currentMillis = millis();
  if (currentMillis - startMillis >= period) {
    menu.lcd->setBacklight(LOW);
    menu.hide();
  }
  if (button != '0') {
    menu.lcd->setBacklight(HIGH);
    menu.show();
    startMillis = millis();
  }

@forntoh forntoh added the help wanted Extra attention is needed label Feb 2, 2022
@jiriks74
Copy link

I have a working implementation in my project. I should have some free time in the coming weeks so I could try to rewrite it into the library. Hopefully you'll see a pr from me soon ;)

@forntoh
Copy link
Owner Author

forntoh commented Apr 4, 2023

@jiriks74 Any progress with this? 🙂

@forntoh forntoh added this to the LcdMenu 3.2.0 milestone Jun 16, 2023
forntoh added a commit that referenced this issue Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve readability/performance/maintainability good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants