# Different button press behaviour between versions

**URL:** <https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540>\
**Category:** Questions\
**Created:** [June 17, 2023, 8:04am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540 "2023-06-17T08:04:13Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 17, 2023, 8:04am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/1 "2023-06-17T08:04:13Z")

</div>

I have two hand-made WLED installations, one running WLED SR version 0.13.3 and the other a self-compiled version of WLED version 0.14.0-b1 with the AudioReactive Usermod.

For both, I’d like to setup a physical button that cycles through playlists. Each button press should move to the next playlist. I have this successfully running on 0.13.3 SR, to do so I have the following:

1. Setup a new Preset (ID#2) with the API Command: `P1=10&P2=14&PL=~` - the playlists are in presets 10-14
2. In Config/Time & Macros - for Button 0 short press, I’ve put in `2` to select the above command.

Using the button on the device successfully cycles through playlists.

I’ve done basically the same thing in my custom compiled 14.0-b1 installation and every button goes to the first playlist and never iterates up. In this case:

1. There is a preset (ID#99) with the API Command `P1=20&P2=22&PL=~` - the playlists are in presets 20, 21 & 22.
2. In Config/Time & Macros - for Button 0 short press, I’ve put in `99` to select the above command/preset

Both devices have GPIO #17 set for the button press - both with Pushbutton as the type. The hardware is the same (though obviously built seperately). For the 0.14 installation, I’ve tried both with and without the internal resistor. Both are running an ESP32 dev board.

Feels like I’ve missed something obvious. Any help?

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [June 17, 2023, 1:14pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/2 "2023-06-17T13:14:07Z")

</div>

You may want to use 0.14.0-b3 where I addressed button bug.

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 17, 2023, 9:42pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/3 "2023-06-17T21:42:29Z")

</div>

> [@blazoncek](#):
>
> You may want to use 0.14.0-b3

B1 is the latest tag in GitHub? What should I be grabbing - current master or a branch?

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [June 17, 2023, 11:54pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/4 "2023-06-17T23:54:58Z")

</div>

Latest code, not release. Main.

---

<div class="post-metadata">

**Author:** ![Jinx](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jinx](https://wled.discourse.group/u/Jinx)\
**Post date:** [June 18, 2023, 12:53am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/5 "2023-06-18T00:53:54Z")

</div>

> **[wled-install.github.io/bin\_dir/1\_Standard\_version/Nightly\_build at main ·...](https://github.com/wled-install/wled-install.github.io/tree/main/bin_dir/1_Standard_version/Nightly_build)**
>
> main/bin\_dir/1\_Standard\_version/Nightly\_build

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 18, 2023, 4:09am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/6 "2023-06-18T04:09:26Z")

</div>

> [@tonyno](#):
>
> Latest code, not release. Main.

All good - so I checked out repo and built main. No change in the button behaviour and I now get LOTS of flickering during presets, especially during transitions between presets in a playlist. Seems to be worse when a preset uses all the LEDs (there are 279 in this layout). I’m only running at 2A when a power supply capable of 3A.

That all said, reflashing back to `0.14.0-b1` resolves the flickering - but obviously no button fix. Thar build is still a custom compile - with audioreactive usermod as I mentioned in original post.

Is the flickering a known beta 2/3 issue? It’s very likely I’m doing something wrong as this is the first board where I’ve had a crack at [Platform.IO](http://Platform.IO) and custom builds.

Fwiw - the flickering also appears in the peek display.

---

<div class="post-metadata">

**Author:** ![Jinx](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jinx](https://wled.discourse.group/u/Jinx)\
**Post date:** [June 18, 2023, 8:37pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/7 "2023-06-18T20:37:11Z")

</div>

You could try downloading the precompiled .bin from @srg74 [WLED-wemos-shield/resources/Firmware/@Aircoookie/v0.14.0-b3 at master · srg74/WLED-wemos-shield · GitHub](https://github.com/srg74/WLED-wemos-shield/tree/master/resources/Firmware/%40Aircoookie/v0.14.0-b3) Just grab the one with Sound Mod.

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 19, 2023, 12:29am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/8 "2023-06-19T00:29:04Z")

</div>

So I went ahead and [installed this one](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Firmware/%40Aircoookie/v0.14.0-b3/WLED_0.14.0-b3_esp32_sound_mod.bin).

Still flashing/flickering - still worse in transitions. Possibly not quite as bad as my build, but could be subjective. I made a video, but the compression in Google Photos hides the flashing of the UI.

FWIW - my LEDs have 9 segments. I’ve tried clearing the segments and treated the string as a single segment. Still flickers - it kind of looks like a brightness cycle up/down by 20% or so.

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [June 19, 2023, 1:16am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/9 "2023-06-19T01:16:49Z")

</div>

Check flickering in FAQ in KB.

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 19, 2023, 8:16am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/10 "2023-06-19T08:16:13Z")

</div>

That would suggest it’s hardware related. I’m not counting that out BUT… I’ve narrowed the different behaviour to [this commit](https://github.com/Aircoookie/WLED/commit/e00116551cb8efa18144b28e099694daf835f833).

Any builds using commits earlier don’t have the pulsing/flashing that I’m seeing. This one (and later) do have it.

@blazoncek any thoughts on the flashing/pulsing and the commit that introduced it? You mentioned earlier about a button fix - when was this committed? I don’t see any change in button behaviour (from my OP) on any build I’ve tried.

---

<div class="post-metadata">

**Author:** ![ALDIY](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aldiy/32/2716_2.png) [@ALDIY](https://wled.discourse.group/u/ALDIY)\
**Post date:** [June 19, 2023, 10:25am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/11 "2023-06-19T10:25:40Z")

</div>

I did test that few days back and it seems okay [Beta 3 by blazoncek · Pull Request #3238 · Aircoookie/WLED · GitHub](https://github.com/Aircoookie/WLED/pull/3238#issue-1747392745)

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [June 19, 2023, 11:08am UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/12 "2023-06-19T11:08:44Z")

</div>

NeoPixelBus 2.7.5 is mandatory for UCS890x chipset and as such we can’t go without it.  
It did introduce quite a few new features including new brightness bus and deprecated NePixelBrightnessBus which WLED was using.

So the flickering (which I am also seeing) can be attributed to NPB 2.7.5 but there are also many other factors that can contribute. I.e. usermods.

As for buttons, 0.14 introduced asynchronous loading of presets to combat (and avoid) preset corruption during saves. This _may have_ introduced the inability to cycle _playlists_ using button presses. IDK I never used it.

If you are familiar with compiling source, add a few debug printouts in `handlePreset()` and/or other preset handling functions. Playlist is just another preset but has a completely different workflow so it may be difficult to track down.

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 21, 2023, 12:13pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/13 "2023-06-21T12:13:46Z")

</div>

> [@blazoncek](#):
>
> If you are familiar with compiling source, add a few debug printouts in `handlePreset()` and/or other preset handling functions. Playlist is just another preset but has a completely different workflow so it may be difficult to track down.

Ok, so I’ve done a little digging and debugging. Worked out how to use NetDebug and found what I think is the problem.

Line 174 of presets.cpp

> <https://github.com/Aircoookie/WLED/blob/main/wled00/presets.cpp#L174>

It resets the `presetCycCurr` variable to the current preset. But the current preset is an actual display preset - not a playlist, so the incrementing has now been broken. eg.

- My playlists are number 20-22
- In playlist 20, I have preset 1 & 3
- Line 174 puts 1 or 3 into `presetCycCurr`
- Later in `parseNumber()` when it tries to increment… 1 or 3 + 1 is below `presetCycMin` so it returns that instead - in my case always 20. So it replays the same playlist over and over.

I’ve done a build commenting out line 174 and the behaviour returns to normal. Either clicking the Preset that has the incrementing command OR pressing the button on the device connected to the same preset correctly cycles through the playlists.

I’m not sure what that line is supposed to be doing so didn’t want to submit a patch to remove it. @blazoncek how do you want to proceed here? Should I log a bug and a PR and we can discuss there? Any hints on what that line is otherwise trying to do?

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [June 21, 2023, 3:52pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/14 "2023-06-21T15:52:36Z")

</div>

Just open an issue on Github with exact description as above.  
You can label it a bug and someone will take a look what else breaks if that line is removed.

---

<div class="post-metadata">

**Author:** ![djdrey909](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/djdrey909/32/5242_2.png) [@djdrey909](https://wled.discourse.group/u/djdrey909)\
**Post date:** [June 22, 2023, 12:23pm UTC](https://wled.discourse.group/t/different-button-press-behaviour-between-versions/8540/15 "2023-06-22T12:23:38Z")

</div>

Done

> <https://github.com/Aircoookie/WLED/issues/3260>
>
> \### What happened?
> 
> In my 0.13.x installation of WLED, you can create a preset w…ith the API command similar to \`P1=20&P2=22&PL=~\` that when triggered will cycle through playlists 20,21,22 and then back to 20. These can be triggered either from the WebUI by pressing the preset OR from an external button macro (among others).
> 
> In all the 0.14.x versions I've tried, this is no longer working. Instead it repeatedly triggers the first playlist in the list. So in the example above, the playlist in preset 20.
> 
> \### To Reproduce Bug
> 
> \* Create 3 new playlists via the UI. In this example using IDs 20, 21 & 22 for the presets. Put different presets within each playlist.
> \* Create a preset (can be any ID, but let's call it 3 in this example) that has the API command \`P1=20&P2=22&PL=~\` as the preset content
> \* Using the web interface, click on the new preset 3
> \* Playlist 20 will play
> \* Click playlist 3 again
> \* Playlist 20 will restart again
> 
> \### Expected Behavior
> 
> \* On the second click, playlist 21 should play. 
> \* On the third click, playlist 22 should play
> \* On the fourth, the cycle should restart and playlist 20 should play
> 
> \### Install Method
> 
> Self-Compiled
> 
> \### What version of WLED?
> 
> WLED 0.14.0-b3 (build 2306210)
> 
> \### Which microcontroller/board are you seeing the problem on?
> 
> ESP32
> 
> \### Relevant log/trace output
> 
> \_No response\_
> 
> \### Anything else?
> 
> \_No response\_
> 
> \### Code of Conduct
> 
> \- \[X\] I agree to follow this project's Code of Conduct
