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

E-Ink Screensaver #3477

Merged
merged 26 commits into from
Mar 28, 2024
Merged

E-Ink Screensaver #3477

merged 26 commits into from
Mar 28, 2024

Conversation

todd-herbert
Copy link
Contributor

@todd-herbert todd-herbert commented Mar 23, 2024

On E-Ink devices, when screen-timeout is reached, a "screensaver frame" is drawn before updates are paused.
This prevents misleading, out-of-date information remaining on the display.
Addresses #3226

Tested on Heltec Wireless Paper V1.0 and V1.1. Would be good to confirm that everything is working as expecting on other E-Ink devices too.

(It's not toasters, I swear)

EInkScreensaver.mp4

@todd-herbert todd-herbert reopened this Mar 23, 2024
@todd-herbert todd-herbert changed the title Eink screensaver E-Ink Screensaver Mar 23, 2024
@todd-herbert todd-herbert marked this pull request as ready for review March 23, 2024 15:10
@GMart
Copy link

GMart commented Mar 24, 2024

I think it's a great idea, but I don't like that all the useful information other than the version goes away. Maybe, the screen could stay there, but just have text in the middle of the screen over everything that says "Screen paused"? So the info on the screen stays.
Or, since it's e-ink, when screen timeout happens, continue running the screen at half the regular update rate? Or maybe only when there is a position packet/direct message/something else?

@todd-herbert todd-herbert marked this pull request as draft March 24, 2024 09:00
@todd-herbert
Copy link
Contributor Author

I don't like that all the useful information other than the version goes away.

Is there any information in particular that you feel would be useful to remain on screen?

Or maybe only [update] when there is a position packet/direct message/something else?

I think what you're talking about might already be implemented with #3316
It's currently enabled for Heltec Wireless Paper and T-Echo, but hasn't been configured yet for any of the other E-Ink devices. It should be pretty straight-forward if you'd like to have a go.


At this point I'm thinking that the most diplomatic solution might be to make the screensaver behavior customizable by end-users via the app / cli. I've got this working tonight as a bit of proof of concept, but I'll have to talk to someone more knowledgable about whether it's an appropriate option, and about would it would take to expose the setting in the mobile apps.

@jimwhitelaw
Copy link
Contributor

I think it would be useful to have the node id remain visible on the screensaver. If you have multiple devices sleeping, you can determine at glance which is which.

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 25, 2024

I think it would be useful to have the node id remain visible on the screensaver. If you have multiple devices sleeping, you can determine at glance which is which.

Good call! I'll look at getting that onto the icon screen, maybe replacing the version number?


The new plan is: offer users a choice in the display preferences.

  • LOGO
    Similar to screen shown in original post

  • OVERLAY
    Some sort of minimal "heads up", drawn over the existing (pre-pause) screen image. Proof-of-concept working, but haven't thought about a design yet.

  • BLANK
    Just wipe the display

  • NONE
    No action taken (current behavior)

  • CUSTOM
    A custom GFX method, only built if method is set in variant's platformio.ini build_flags.
    Supports vendors and DIYers to make their own aesthetic choices.

    #define EINK_CUSTOM_SCREENSAVER helloWorld
    
    #ifdef EINK_CUSTOM_SCREENSAVER
    namespace einkCustomScreensavers
    {
      void helloWorld(OLEDDisplay *display)
      {
        display->setTextAlignment(TEXT_ALIGN_LEFT);
        display->drawString(30, 30, "Hello world!");
      }
    }
    #endif

Not sure if it'll go ahead or not; just waiting for input from the dev-team about it.

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 25, 2024

@jimwhitelaw

I think it would be useful to have the node id remain visible on the screensaver.

Node ID, "last 4 of Node ID" or short-name?

I'm thinking maybe short-name and "last 4 of NodeID"?

@jimwhitelaw
Copy link
Contributor

jimwhitelaw commented Mar 25, 2024

I think any id that fits nicely on the display. Last 4 is fine, short name is possibly friendlier. As long as sleeping units can be identified, you’re golden.

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 25, 2024

Following feedback on meshtastic/protobufs#474, scope of this pull-request is reduced. A single screensaver behavior will be implemented. Abandoned work-in-progress is mothballed as eink-screensaver-configurable branch.

After some time spent yesterday developing the different screensaver options, my personal opinion now is that the subtle overlay suggestion is best #3477 (comment). This also meets the criteria that nodes should be identifiable with the screen off #3477 (comment).

overlay

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 26, 2024

Tested Heltec Wireless Paper V1.0 and V1.1
No issues expected, but be aware that no testing has taken place with different resolutions / platforms.

@todd-herbert todd-herbert marked this pull request as ready for review March 26, 2024 12:36
@GUVWAF
Copy link
Member

GUVWAF commented Mar 26, 2024

I like the simple overlay, although depending on which screen it was showing, it may or may not show the ID of the node itself.

Formatting on the T-Echo looks good as well:
image

@GUVWAF
Copy link
Member

GUVWAF commented Mar 27, 2024

When you're testing, are you rebooting and then shutting down within roughly the first 30 seconds?

No, it was more than that. I set the screen timeout on 60 seconds, so I waited at least that. I just tested with several minutes in between and it still happens.

Do you have any suggestions here from a design point of view about where and how to display this info? Do you prefer "last 4" of node id, or short name?

To be honest for me displaying it on the screen is not so important, you can also mark the device itself with a sticker. I'm fine with the current approach.

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 27, 2024

No, it was more than that. I set the screen timeout on 60 seconds, so I waited at least that. I just tested with several minutes in between and it still happens.

Thanks for that info. I think I might have a fix, but not sure just yet. I should actually have a T-Echo turning up in the next day or two, so I can check then whether I've solved it or not.

To be honest for me displaying it on the screen is not so important, you can also mark the device itself with a sticker. I'm fine with the current approach.

I've modified the design slightly now to include short name, and I'm fairly pleased with how it looks. I'll push that in the near-future too.


There's a slight hold up on those final tweaks: I found a low-down bug in the system. When the screen class turns off, there are no more calls to display(), which is where the async-refresh code polls for completion. This means that when the screensaver is displayed, the panel's voltage generating hardware remains active.

A quick fix for this would be to use a blocking fast-refresh here, but I'd rather try tackle the problem at its source. I'm looking into inheriting the OSThread class, to allow polling after the screen is "turned off".

@caveman99
Copy link
Member

There is a variation of osthteads called the notified worker. It will not loop but execute a task when externally notified. Maybe this one is better suited.

@todd-herbert todd-herbert marked this pull request as ready for review March 28, 2024 07:49
@todd-herbert todd-herbert marked this pull request as draft March 28, 2024 07:55
@todd-herbert todd-herbert marked this pull request as ready for review March 28, 2024 09:02
@todd-herbert
Copy link
Contributor Author

overlay version two
Short name is displayed on overlay.

@todd-herbert todd-herbert marked this pull request as draft March 28, 2024 09:07
(No impact to code, but avoids future issues)
@todd-herbert todd-herbert marked this pull request as ready for review March 28, 2024 09:14
@todd-herbert todd-herbert marked this pull request as draft March 28, 2024 15:25
Should have just let it go, but here we are..
@todd-herbert todd-herbert marked this pull request as ready for review March 28, 2024 16:35
@todd-herbert
Copy link
Contributor Author

And for the third time tonight, I'm going to claim that everything is final now. Except that this time I'm going to bed so I have to leave it alone..

@thebentern thebentern merged commit 8187fa7 into meshtastic:master Mar 28, 2024
69 checks passed
@todd-herbert
Copy link
Contributor Author

Reference doc, for future maintenance:

Async Refresh (updated) Refresh Selection (updated) Screensaver
flowchart for async refresh flowchart for the determine mode method flowchart for E-Ink screensaver

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.

6 participants