ArduinoMenu icon indicating copy to clipboard operation
ArduinoMenu copied to clipboard

Aproach for implementing password protected menu

Open d21d3q opened this issue 6 years ago • 5 comments

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?)

d21d3q avatar Jun 05 '18 16:06 d21d3q

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.

d21d3q avatar Jun 05 '18 19:06 d21d3q

yes, keypad hw (as buttons in general) still accessible, it seem desirable to do this outside menu system, no?

neu-rah avatar Jun 05 '18 20:06 neu-rah

there is some code on plugins folder (half abandoned) about custom menu controls cancelField handles input, and barField handles output

neu-rah avatar Jun 05 '18 21:06 neu-rah

https://github.com/neu-rah/ArduinoMenu/issues/285

neu-rah avatar Apr 17 '20 16:04 neu-rah

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

neu-rah avatar Oct 20 '20 13:10 neu-rah