WLED icon indicating copy to clipboard operation
WLED copied to clipboard

Button 0 press would erase configuration and presets

Open flux242 opened this issue 1 year ago • 20 comments

I have soldered a touch button to the ESP01. As I configured the pin and Push type. The first time I touched the button it erased all my stored settings. After some research is was clear to me that I should have used PushInverted type of button because wled expects that a button would pull pin to the ground. But after restoring configuration I tried to change the button type to Inverted and upon saving it would still erase my settings again because I couldn't switch into the settings screen within 12 seconds after wled booting!!! So, it is not possible to restore configuration from a file and change button setting in the GUI! And this is anything but well defined UI

So, to prevent this from happening one could reset the button timer upon configuration changes Alternatively one could expose button timers in the GUI, so that one could disable/enable 6/12 sec timers or even redefine its actions

flux242 avatar Jul 19 '24 07:07 flux242

Assign your GPIO to button 1.

blazoncek avatar Jul 19 '24 07:07 blazoncek

really? How should it help in the situation described?

flux242 avatar Jul 19 '24 08:07 flux242

Use custom compilation.

EDIT: Disconnect button, boot WLED, reconfigure, reconnect button.

blazoncek avatar Jul 19 '24 08:07 blazoncek

really? Desolder the button instead of resetting the timer in software? Sounds like a plan

flux242 avatar Jul 19 '24 09:07 flux242

Do some prototyping 1st, then solder.

Or use my other proposal.

blazoncek avatar Jul 19 '24 09:07 blazoncek

really? Desolder the button instead of resetting the timer in software? Sounds like a plan

In fact, it is. Especially when considering this:

  • having a pull-down on GPIO 0 is normally not a good idea, as boards often have a built-in pull-up on that pin
  • if GPIO 0 is low on boot, the board goes into firmware download mode
  • there is no "button timer" in WLED. So its not so simple to reset a timer in the software, which doesn't even exist.

softhack007 avatar Jul 19 '24 10:07 softhack007

really? Have I ever mentioned GPIO0? And no timer exists they say huh? What's that then


      if (b == 0 && dur > WLED_LONG_AP) { // long press on button 0 (when released)
        if (dur > WLED_LONG_FACTORY_RESET) { // factory reset if pressed > 10 seconds
          WLED_FS.format();
          #ifdef WLED_ADD_EEPROM_SUPPORT
          clearEEPROM();
          #endif
          doReboot = true;
        } else {
          WLED::instance().initAP(true);
        }
      } else if (!buttonLongPressed[b]) { //short press
        //NOTE: this interferes with double click handling in usermods so usermod needs to implement full button handling
        if (b != 1 && !macroDoublePress[b]) { //don't wait for double press on buttons without a default action if no double press macro set
          shortPressAction(b);
        } else { //double press if less than 350 ms between current press and previous short press release (buttonWaitTime!=0)

flux242 avatar Jul 19 '24 13:07 flux242

if you still don't get it, I'll reiterate: Having a function of erasing EEPROM on a button is dangerous because it happens without any warning! And nobody should be punished by loosing all the settings simply because buttons aren't properly configured. Resetting AP pass is OK and that's why I don't want to use Button1 which lacks this functionality. Even if there's a timer reset for a button before applying new settings, the buttons itself could stuck because of some mechanical issue or because of overheating.

flux242 avatar Jul 19 '24 13:07 flux242

if you still don't get it, I'll reiterate:

I don't need a teacher who reiterates lessons. And I don't need someone who beliefs he can read the source code to me. PERIOD.

softhack007 avatar Jul 19 '24 14:07 softhack007

if you still don't get it, I'll reiterate:

I don't need a teacher. And I don't need some dabbler who beliefs he can read the source code to me. PERIOD.

I wasn't even referencing you with that one because it would make no sense

flux242 avatar Jul 19 '24 14:07 flux242

correct. And it does not make sense for any other maintainer here, too.

softhack007 avatar Jul 19 '24 14:07 softhack007

I do not get why are you so fussed about a clearly described button 0 functionality.

Note: Button 0 has two, built-in functions. 1. Hold it down for >6 seconds and the Wi-Fi settings will be reset to default. 2. Hold it down for >12 seconds and flash memory is erased.

Taken from KB.

If you've soldered your button to a default GPIO (0, which is also a strapping pin) prior to flashing you wouldn't have lost anything as you wouldn't be able to save anything.

If you did it afterwards (or changed GPIO) you were notified about its functionality in the KB.

RTFM as they say.

blazoncek avatar Jul 19 '24 20:07 blazoncek

its amazing you still not getting what i'm talking about but insist that i wrongly soldered something to something! I care less too, because i simply removed that erase timer completely locally and i'm fine. RTFM huh? Keep telling this to everyone for better user experience

flux242 avatar Jul 20 '24 03:07 flux242

Hi all. The same problem on wemos d1 mini with esp8266 and touch button (ttp223). ttp223 is connected to a 3.3 V supply. Actions:

  1. connect the board and download the firmware WLEDMM_0.14.1-b32.41_esp8266_4MB_S using flash_download_tool_3.9.5
  2. I connect to the wled in AP mode, assign a button to port 4, and an output to the LEDs to port 5. and connect to the WIFI network. I save the settings.
  3. Turn off the power and solder the button
  4. I connect again, the LEDs light up yellow.
  5. I press the touch button: the blue LED on the board blinks, the board reboots, all settings are empty. I tried assigning a button to ports 0, 2, 4, 5, 1, 13, 15, 16 - the result is the same. I tried disconnecting the pull-up resistors - the result was the same. I tried the inverted mode on ttp223 and on ESP - the settings also went off. I tried to watch the signals with an oscilloscope - without pressing 0V, with pressing 3.3V, there was no noise. Tried 2 different copies of the board - same problem What else can you think of to solve the problem?

akluchnikov avatar Aug 13 '24 14:08 akluchnikov

buttons interface is fubar. First of all they attached some dangerous effects to button0 without mentioning that in the gui! Now they say use other buttons but that isn't working either because on all buttons except button0 action is repeated automatically for long presses. So if I would want to cycle through presets with short press and switch on/off with long one it wouldn't work. And the only way to get it working is to remove all hidden actions from button0 and then use it

flux242 avatar Aug 14 '24 10:08 flux242

buttons interface is fubar. First of all they [...]

Who is "they" ? As my grandpa used to say - "they" are selling cucumbers on the market 😉 .

🆒 cool down ... no need to get emotional. This is a community project, not a product made by a professional company. So no need to fight for your right.

softhack007 avatar Aug 14 '24 10:08 softhack007

those who don't even admit that there's a problem with buttons

flux242 avatar Aug 14 '24 17:08 flux242

those who don't even admit that there's a problem with buttons

There isn't. 🤣 That is a core functionality built into WLED since 0.12.

blazoncek avatar Aug 14 '24 18:08 blazoncek

The behaviour is explained already in our KB https://kno.wled.ge/features/macros/#buttons

Note: Button 0 has two, built-in functions. 1. Hold it down for >6 seconds and the Wi-Fi settings will be reset to default. 2. Hold it down for >12 seconds and flash memory is erased.

softhack007 avatar Aug 15 '24 07:08 softhack007

thanks for the answers! Yes, I already realized that this is not a bug, but a feature. But for some reason I have never encountered this, although I have already assembled 20+ devices using the same scheme...

akluchnikov avatar Aug 15 '24 08:08 akluchnikov

Hey! This issue has been open for quite some time without any new comments now. It will be closed automatically in a week if no further activity occurs. Thank you for using WLED! ✨

github-actions[bot] avatar Dec 13 '24 12:12 github-actions[bot]