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

[FR] add display sleep #23896

Closed
luxflow opened this issue Mar 13, 2022 · 11 comments
Closed

[FR] add display sleep #23896

luxflow opened this issue Mar 13, 2022 · 11 comments
Labels
C: LCD & Controllers T: Feature Request Features requested by users.

Comments

@luxflow
Copy link
Contributor

luxflow commented Mar 13, 2022

Is your feature request related to a problem? Please describe.

No response

Are you looking for hardware support?

No response

Describe the feature you want

As I know there is "lcd backlight timeout" feature #23768
And there is "touch screen backlight timeout" feature #22617

I have two request regarding above features

First, Lcd backlight timeout feature only works when LCD_BACKLIGHT_PIN is defined
I think marlin can leverage u8g sleep feature to implement backlight feature without using additional PIN
I wrote some POC code for this and tested on ssd1309 lcd (unfortunately I'm not expert in embedded programming nor marlin. sorry in advance)
https://github.com/MarlinFirmware/Marlin/compare/bugfix-2.0.x...luxflow:lcd_sleep?expand=1
But problem is that not all devices support u8g sleep feature and there is no function in u8g to check if device support sleep in advance (maybe this problem can be solved #define use_lcd_sleep 1 macro in conditionals_lcd.h)

Second, as I mentioned earlier, there are two backlight timeout for lcd and touch screen
it would be nice to unifying these timeout feature into one universal feature such as #define DISPLAY_TIMEOUT 30 if possible

I need display sleep feature to save my oled from burn-in

Let me know if I misunderstand something
Thanks for reading my issue

Additional context

No response

@luxflow luxflow added the T: Feature Request Features requested by users. label Mar 13, 2022
@borland1
Copy link
Contributor

I would like to see this basic display feature implemented.

Are you assigning a dummy backlight pin in order to enable sleep_on/sleep_off in your pull request code?

I believe SSD1306 ( also 128x64 OLED) uses same command set as SSD1309.

@thisiskeithb
Copy link
Member

I can see the obvious benefit for OLED screens, but as far as I'm aware, most of the traditional RepRapDiscount full graphic smart controllers available have power wired directly the LCD, so there's no way to turn it off without modding or a new design.

@luxflow
Copy link
Contributor Author

luxflow commented Mar 14, 2022

I would like to see this basic display feature implemented.

Are you assigning a dummy backlight pin in order to enable sleep_on/sleep_off in your pull request code?

I believe SSD1306 ( also 128x64 OLED) uses same command set as SSD1309.

I forgot to mention how my PR is implemented,
if LCD_BACKLIGHT_PIN is defined, use that PIN (current bugfix-2.0.x behavior)
if not defined, use u8g sleep, if device support sleep feature, then it works

To check if device support sleep, check below page, see if U8G_DEV_MSG_SLEEP_ON is used
https://github.com/MarlinFirmware/U8glib-HAL/tree/master/src/clib
ssd1306 supports sleep

I think universal display sleep can be implement using following ways in order

  1. (if sleep is supported) sleep
  2. (if brightness is supported) brightness control using additional pin

@borland1
Copy link
Contributor

borland1 commented Mar 14, 2022

Thanks for the reply, but I still don't understand how you have modifed your the Configuration.h or Configuration_adv.h file to enable the sleep feature on your SSD1309 display.

Your above referenced PR does not appear to propose modifying the config files, so I assume you are enabling the TOUCH_IDLE_SLEEP ( screen timeout ) feature with this line:

#define TOUCH_IDLE_SLEEP 300

Was expecting to see somthing like this....

// OLED ScreenTimeout for displays supporting U8g graphics SLEEP function
#define SCREEN_TIMEOUT 300

then where appropriate, in marlinui.cpp or elsewhere,..

#if ENABLED( SCREEN_TIMEOUT ) 
    #define LCD_BACKLIGHT_TIMEOUT
    #define TOUCH_IDLE_SLEEP SCREEN_TIMEOUT

@luxflow
Copy link
Contributor Author

luxflow commented Mar 15, 2022

I used #define LCD_BACKLIGHT_TIMEOUT 30 to timeout my screen
I'm not sure what screen type you use, if you're touch screeen it will not works since LCD_BACKLIGHT_TIMEOUT only applied in non-touch screen. As I said first in issue, since marlin has 2 implementation for touch, non-touch backlight timeout, have to modify both. My PR dosen't have sleep implementation for TOUCH screen currently..

@borland1
Copy link
Contributor

borland1 commented Mar 15, 2022

I was thinking about testing your PR files code on my printer, which has an OLED display, but since you did not upload your bugfix-2.0.x Configuration.h and Configuration_adv.h files or since the PR does not modify the Configuration.h file, I couldn't figure out how you have the sleep feature enabled.

My custom printer is using a 2.4" OLED ( SSD1309 ), but have Marlin configured as MKS_12864OLED_SSD1306, and menu navigation is with a rotary encoder. No touch screen.

@luxflow
Copy link
Contributor Author

luxflow commented Mar 15, 2022

I was thinking about testing your PR files code on my printer, which has an OLED display, but since you did not upload your bugfix-2.0.x Configuration.h and Configuration_adv.h files or since the PR does not modify the Configuration.h file, I couldn't figure out how you have the sleep feature enabled.

My custom printer is using a 2.4" OLED ( SSD1309 ), but have Marlin configured as MKS_12864OLED_SSD1306, and menu navigation is with a rotary encoder. No touch screen.

just add #define LCD_BACKLIGHT_TIMEOUT 10 in Configuration_adv.h (and have to use my PR firmware). that's what I changed in my config

@borland1
Copy link
Contributor

borland1 commented Mar 16, 2022

I was able to successfully test your Pull Request code on my printer with OLED display using PlatformIO.

Test Results: Display sleeps after the set timeout period. Rotation or a button press of the rotary encoder knob wakes the display from sleep. Same behavior while printing. Additionally, adds a LCD Timeout menu to the Configuration Menu, which allows changing the default timeout setting (in seconds) set by Configuration.h. Setting this value to '0' disables the Timeout feature.

If you don't mind waiting a few days, I can provide code suggestions for implementation with OLED displays to your PR, and also for Configuration.h.

@borland1
Copy link
Contributor

Submitted PR #23927 for review.

borland1 added a commit to borland1/Marlin that referenced this issue Mar 20, 2022
Merge with FR MarlinFirmware#23896  Sanity Checks for Screen Support Feature,  Changes adds checks for unsupported displays.
@thisiskeithb
Copy link
Member

Submitted PR #23927 for review

Closing since there’s now a PR.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: LCD & Controllers T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests

3 participants