Skip to content

ui: add some parameters to the cli (mostly regarding eink behaviour) - #3687

Open
fdlamotte wants to merge 3 commits into
meshcore-dev:devfrom
fdlamotte:display_prefs
Open

fdlamotte wants to merge 3 commits into
meshcore-dev:devfrom
fdlamotte:display_prefs

Conversation

@fdlamotte

Copy link
Copy Markdown
Collaborator

Some get/set cli commands to tweak display behaviour :

  • ui.show_clock
  • ui.auto_off_delay
  • ui.backlight_delay
  • ui.backlight_on_keys
  • ui.backlight_on_msgs
  • ui.auto_off_blank
  • ui.auto_off_keep_msgs
  • ui.max_partial

The two first are common to all displays (but second works only if there is enough room).

Other options are for einks, to control backlight and refresh behaviour

Comment thread examples/companion_radio/MyMesh.cpp Outdated
if (memcmp(command, "set ui.show_clock", 17) == 0) {
_prefs.ui_show_clock = atoi(&command[17]) ? 1 : 0;
savePrefs();
sprintf(reply, "> ui.show_clock is now %d", _prefs.ui_show_clock);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make each of the replies briefer, like most (and the ones further down). eg just "> now %d"

Comment thread examples/companion_radio/MyMesh.cpp Outdated
if (memcmp(command, "set ui.auto_off_delay", 21) == 0) {
_prefs.ui_auto_off_delay = atoi(&command[21]);
savePrefs();
sprintf(reply, "> ui.auto_off_delay is now %d seconds", _prefs.ui_auto_off_delay);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here...


if (_display != NULL) {
_display->turnOn();
_display->setMaxPartialRefresh(_node_prefs->ui_max_partial);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice setMaxPartialRefresh() is always called after every turnOn(), which to me indicates that the EPD driver class should have this in its turnOn() impl. And that the ui_max_partial pref is more like config which gets passed to the display instance somehow (at start, and for simplicity could require reboot to apply).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ideally I would have grabbed the parameter directly from the prefs, but it is not easily accessible so I found this shortcut to add a method and set it at every turnOn from the loop (not to send it more often). Note that at the moment if the user uses auto_off_delay=0, then the screen is never turned on and the parameter is never applied ... so user needs to turn screen off and on manually for the parameter to be applied.

It could also be sent at start, but I personally don't like to reboot to have parameters set since it forces the user to sync the node after reboot. Tell me what behaviour you prefer and I'll implement it this way ...

About passing parameters, turnOff could also have a blank parameter that could be false by default (instead of having a blankScreen method ... but I didn't want to impact all the display drivers by making the change (maybe it can be done in a subtle way ... I'll see for that)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified DisplayDriver so turnOn and turnOff accept optional parameters, on turnOn you can specify partial_refresh_count and on turnOff you can give the precision wether you want to blank screen or not

@akalinin-softvelum

Copy link
Copy Markdown

Tested on my T-Echo (dev + this PR, companion USB build). All ui.* get/set work and survive reboot. Things I noticed:

  • T-Echo and M8 define EINK_SCREENOFF_BLANK, but NodePrefs checks UI_SCREENOFF_BLANK, so blanking is now off by default on these boards.
  • ui.max_partial is uint8 without a range check (300 → 44, -1 → 255), and the periodic full refresh can no longer be disabled (-1 did that before). 0 gives a full wipe on every frame. On T-Echo each full wipe blocks the loop ~2.5 s, so I'd like a way to turn it off.
  • Backlight with the touch button: the light now stays on for ui.backlight_delay after release; before, it was only on while touching. Could 0 mean "only while touched" instead of "always off"?
  • Minor: set ui.auto_off_delay abc silently sets 0 (= never off); the doc doesn't say 0 means never.

IMHO: on T-Echo the previous behaviour was better: no periodic full refresh, backlight only while touching, no blanking. The full refreshes (with the freeze) and the lingering backlight are really annoying in daily use, so I'd prefer them off by default.

@fdlamotte

Copy link
Copy Markdown
Collaborator Author

Thanks very much for the feedback (feedback is always apreciated)

Tested on my T-Echo (dev + this PR, companion USB build). All ui.* get/set work and survive reboot. Things I noticed:

  • T-Echo and M8 define EINK_SCREENOFF_BLANK, but NodePrefs checks UI_SCREENOFF_BLANK, so blanking is now off by default on these boards.
  • ui.max_partial is uint8 without a range check (300 → 44, -1 → 255), and the periodic full refresh can no longer be disabled (-1 did that before). 0 gives a full wipe on every frame. On T-Echo each full wipe blocks the loop ~2.5 s, so I'd like a way to turn it off.

Ok, it should be possible to set full refresh to 0, so it's an error on my side ... will make it int32_t so we can have broader range and negative value (meaning disabled)

I will also disable it by default. You're totally right on this one, periodic full refresh is a counter measure to tearing. I was against it when I lived in europe because I didn't see the point (I had no tearing). Now I leave in a tropical country and none of my eink screen work without full refreshes ;) don't know if it is because of temperature or humidity but I need it to get my screens working ... but this should be an opt-in option, not opt-out (and as we have a doc we can explain how to get the best of one's node)

  • Backlight with the touch button: the light now stays on for ui.backlight_delay after release; before, it was only on while touching. Could 0 mean "only while touched" instead of "always off"?

Yes, it should probably, because user can disable backlight on keys, so there is no point in making 0 as always off (the thing is I've been asked to

  • Minor: set ui.auto_off_delay abc silently sets 0 (= never off); the doc doesn't say 0 means never.

IMHO: on T-Echo the previous behaviour was better: no periodic full refresh, backlight only while touching, no blanking. The full refreshes (with the freeze) and the lingering backlight are really annoying in daily use, so I'd prefer them off by default.

Yes, this behaviour was the one I set and the one I liked most when I did the UI for techo, so I can only agree with you

We can make defaults on TEcho work as before, so users are not lost with the new settings ...

@fdlamotte

Copy link
Copy Markdown
Collaborator Author

latest commit addresses cli interface responses (as asked by @ripplebiz) and some behaviour discussed with @akalinin-softvelum

  • max_partial=0 now disable automatic full-refresh (can be triggered), have not dealt with over and underflowed values ... as user can disable it and real value is displayed once set via cmdline
  • when backlight_delay=0, backlight button still works (and there is no delay)
  • backlight_delay=-1 turns backlight always on < -1 display is turned off
  • defaults should be close to historical behaviour

and it seems I made a mess again in my PR when rebasing it to resolve conflict ... but it should disapear once the PR is pulled ;)

@ripplebiz

Copy link
Copy Markdown
Member

latest commit addresses cli interface responses (as asked by @ripplebiz) and some behaviour discussed with @akalinin-softvelum

  • max_partial=0 now disable automatic full-refresh (can be triggered), have not dealt with over and underflowed values ... as user can disable it and real value is displayed once set via cmdline
  • when backlight_delay=0, backlight button still works (and there is no delay)
  • backlight_delay=-1 turns backlight always on < -1 display is turned off
  • defaults should be close to historical behaviour

and it seems I made a mess again in my PR when rebasing it to resolve conflict ... but it should disapear once the PR is pulled ;)

thanks, looks ok to me.

This branch has not been deployed

No deployments
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.

3 participants