Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » clicked value during renderer.takeOverDisplay

Author: beve
16/10/2021 12:51:14
Hello,

Thank you for the work on this awesome lib.

I have a question about the "clicked" param passed to the callback of rendered.takeOverDisplay.
It seems that if the button is clicked, the value is set to RPRESS_PRESSED even if the button has been released. If the rotary encoder is rotated, the value is set back to RPRESS_NONE.

After some search i'm able to test if the button is clicked anytime with:

if ((clicked == RPRESS_NONE || clicked == RPRESS_PRESSED) && switches.isSwitchPressed(BUTTON_PIN)) {
  ...
} else if (clicked == RPRESS_HELD) {
  renderer.giveBackDisplay();
}


Am I doing things right ?

Author: davetcc
17/10/2021 09:39:18
This sounds like a bug, most people use the button click to exit the display take over, so I guess this has never been tried.

Please raise a bug in tcMenuLib for this. https://github.com/davetcc/tcMenuLib/issues

There are three possible values

RPRESS_NONE - the button is not pressed
RPRESS_PRESSED - the button is pressed
RPRESS_HELD - the button is held down.




Register / Login  |  Desktop view  |  Jump to top of page