ArduinoMenu
ArduinoMenu copied to clipboard
Aproach for implementing password protected menu
How would you some kind of lock screen? I was thinking about using keypad (4x4) can I delegate some keys for navigation, and others as input (and pass them into event handlers?)
quick code lookup and I think that navigation would need to generate some event for passing non navigation keys from keypad. I guess that it would have to take palce somewhere here Or just custom menu item which has own navigation.
Another option is to read directly i main loop keypad (one can read it several times while key is pressed) and manipulate navigation (enable/disable), force displayed node.
yes, keypad hw (as buttons in general) still accessible, it seem desirable to do this outside menu system, no?
there is some code on plugins folder (half abandoned) about custom menu controls cancelField handles input, and barField handles output
https://github.com/neu-rah/ArduinoMenu/issues/285
we are closer to this as we have textField
and the question was post again, this time on the gitter...
I would do it as a separate routine, but one can adapt a field to do it, all it need is to print *
instead or the character, except when editing, where the current character is shown.. something like this:
class passField:public textField {
public:
using textField::textField;
Used printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr=0) override;
};
and provide a proper override for printTo
function
the current implementation is here: https://github.com/neu-rah/ArduinoMenu/blob/master/src/items.cpp#L188
for a quick start i would copy the current implementation and replace https://github.com/neu-rah/ArduinoMenu/blob/master/src/items.cpp#L222 with a simple print of "*", latter i would remove the text cursor, guess we don't need it... and possibly some other things.. as one can also prevent the pass from being peek by just showing edit on the last character, or allow only edit on last and delete