neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
933 stars 189 forks source link

Exit from the Alert Screen #318

Open Astar75256 opened 3 years ago

Astar75256 commented 3 years ago

Hi. Tell me how I can track the exit status from the Alert Screen. I have a small piece of code with an Alert screen, in this mode I have the opportunity to enable the firmware update mode in the ESP-32.

result alert(menuOut& o, idleEvent e) {
    if (e == idling) {
        o.setCursor(0, 0);
        o.print("Firmware update");
        o.setCursor(0, 1);
        o.print("IP address:");
        o.setCursor(0, 2);
        o.print("192.168.4.2");
        o.setCursor(0, 3);
        o.print("Enter in browser.");
    }
    return proceed;
}

But I cannot figure out how to track the state of exiting this mode, that is, exiting the Alert Screen. Thank you in advance.

neu-rah commented 3 years ago

Hi! The alert screen will exit either by pressing select or escape but those will not be related with the return value, the return is by now ignored (for a long list of reasons).

I think that you want a confirmation dialog, no?

please take a look at this example: https://github.com/neu-rah/ArduinoMenu/blob/fb3de986f267309a43d7d90b6a7dfb1e47b6de91/examples/Confirm/Confirm/Confirm.ino

hope it helps :)