WLED icon indicating copy to clipboard operation
WLED copied to clipboard

Add brightness ramping for button long press

Open Aircoookie opened this issue 4 years ago • 11 comments

Is your feature request related to a problem? Please describe. Brightness setting not possible without remote control

Describe the solution you'd like Support brightness ramping (gradually brighter, then off and repeat) for button long press

Additional context By Sam on Discord

Aircoookie avatar Jun 28 '20 12:06 Aircoookie

I've had a idea that will be better than gradually brighter, then off and repeat.

So when you hold it, it ramps up to max and when it gets to max it stops, you then have to let go of the button and hold it again for it to go down and then stop at min brightness.

This makes more sense otherwise it will be a pain to get it at min/max brightness, its more intuitive IMO.

samster395 avatar Jun 29 '20 12:06 samster395

That is actually an excellent idea! I have had another problem with allowing the user to hold the button for longer than a few seconds, which is that it would interfere with the "press button for 7sec to open recovery AP" functionality, which would also be solved by your proposal. Thanks!

Aircoookie avatar Jun 29 '20 16:06 Aircoookie

If the numerical increment with number would wrap around you could do something like this now with say double click attached to A=~64. Not sure why that doesn’t wrap. Maybe we could allow an optional “w” to indicate numerical wrap around, like A=~64w?

Update: this small change enables wrap-around for numeric increments, and works great with something like A=~40 on button double-click:

modified   wled00/set.cpp
@@ -367,2 +367,5 @@ bool updateVal(const String* req, const char* key, byte* val, byte minv, byte ma
-      if (out > maxv) out = maxv;
-      if (out < minv) out = minv;
+      if (out > maxv) {
+        out = minv + (out - maxv) - 1;
+      } else if (out < minv) {
+        out = maxv - (minv - out) + 1;
+      }

jdtsmith avatar Feb 19 '21 01:02 jdtsmith

I'm looking at whether I can convert my custom light firmware to WLED. Here's how I've implemented this feature in mine, and I quite like it in practice.

Short press toggles between off and maximum brightness. This also sets a "current fade direction" to either increase or decrease, respectively.

Long press ramps the brightness in whatever the current fade direction is, while held. Upon release, it also toggles the fade direction, allowing you to make additional fine adjustments. Long press never wraps around between min and max, as that would be quite visually jarring (if you want visually jarring, use the short press).

Lenbok avatar Mar 04 '21 22:03 Lenbok

I'd like to have this feature on segment basis! I'm trying to setup 3 individual segments: ID 0 LED 0 - 180 SK6812 RGBW ID 1 LED 180 PWM white ID 2 LED 181 PWM white

Segment 0 is controlled via playlists. Segment 1 and 2 are two areas in one room and each controlled via GPIOs: short click: toggle segment long click and hold: dim segment brightness (not main brightness because of seg0) double click: reset segment brightness to 100%

My attempt for long click is not working: [{"id":1,"on":true,"bri":"~-10"}]}

h07d0q avatar Aug 11 '22 21:08 h07d0q

I think this feature is very important because it is the missing part that transforms the software button in a real life button. Not me, but my wife and all other "normal" people expects to dim with long press and toggle on/off with short press. A different behavior is confusing the end user. I think a led strip used in a home should appear as a normal lamp first, with standard controls, then you can turn on special effects and let the surprise exploding. Please, consider this for managing the enhancement priority. I think is very high, and maybe it's not simply my point of view. Thank you!

evazzoler avatar Aug 20 '22 19:08 evazzoler

Long press brightness change is implemented on button 1.

blazoncek avatar Aug 20 '22 19:08 blazoncek

Long press brightness change is implemented on button 1.

Ops... Thank you! I missed that information! Where can I find more informations about button 1?

evazzoler avatar Aug 20 '22 19:08 evazzoler

I've had a idea that will be better than gradually brighter, then off and repeat.

So when you hold it, it ramps up to max and when it gets to max it stops, you then have to let go of the button and hold it again for it to go down and then stop at min brightness.

This makes more sense otherwise it will be a pain to get it at min/max brightness, its more intuitive IMO.

@blazoncek ah yes, I see, nice, ideally it would work like this tho

samster395 avatar Aug 20 '22 19:08 samster395

Long press brightness change is implemented on button 1.

Ops... I missed that information! Where can I find more informations about button 1?

It's the default button 1 long press action, so just change the button you use to button 1

samster395 avatar Aug 20 '22 19:08 samster395

@ToXIc-Dev agreed, perhaps in next iteration.

blazoncek avatar Aug 21 '22 05:08 blazoncek