Open IARI opened 3 years ago
This is kind of one large proposal that covers a lot of comments I have had recently, and a few issues (segments: #116, custom triggers: kind of #120 #102). It's detailed - appreciate the thought that has gone in here!
We'll start with the easy bit: yes to something like this. I have had on my mind recently that I want to implement two big features in this plugin - segment control and custom effect triggers. There is currently zero guarantee of how or when either of those may happen, my hope is not too long but I have a ton of things on my 'ToDo' list that I think would be cool.
Several different types of trigger here - OctoPrint events, Gcode commands, Host @ commands. For each one, there's the right configuration for an 'effect'. Each type has handlers in the plugin, I sort of thought out this implementation already.
Something similar to how WLED does it, this manages segment control reasonably well. I haven't poked at how it does it but given it's on a completely different platform it may not be of much use. The idea here would that be for every event/trigger, any number of segments are assigned to it. Slightly different from what you were getting at, main difference is simplicity - I didn't think there is much need to separate triggers from the effects, so instead of 3 'configuration' sections you have just 2.
The approach I was thinking of taking with all of this was time - it was going to sit in my head for a while, and work through some problems before actually committing to anything. The second thing, is simplicity. The vast majority of users have just one LED strip, that should make some cool patterns above their printer. There's little need for them for such a complex configuration. Predefined effects must stay, I want an out of the box experience - I hate things that I have to configure for a while first to get it to work well.
That's the start, I might add some more comments later.
Ok, that didn't take long - more comments:
Yep, I suppose that getting into the project at the level, including the communication required would be a huge overhead. Just let me know, if there is anything you could use help with in a way that you feel would actually save you time.
Disclaimer
This proposal suggests some extensive changes which probably have already been suggested in one way or another and are certainly not on the plan in this fashion right now. However I hope, that this proposal still offers value to the process, and maybe could be a source of inspiration for the long term development. So in advance I want to make clear that
Maybe after reading it you're thinking "Who the fuck even is this guy and when does he even think anyone has the time for this, all of this is complete overkill" - and of course that's completely fine, throw it in the bin. However I hope this offers at least some thought-food ;) Anyways, as a software engineer I could offer support by evolving this idea into something that you see fit to be implemented in some more or less distant future.
Is your feature request related to a problem? Please describe. My problem is similar to what is described in #57 - however my setup is slightly different. Before I get into the details, let me explain my setup:
I have installed a WS2812b strip within the enclosure I built for my printer, which is cut into 8 parts. The parts are mounted on the along the side- and top edges of the enclosure cube. They I wired them together like this:
The intention was, that:
It should be possible to control both segments independently from each other.
Proposal
Describe the solution you'd like I propose
I would strive to separate the concept of effects from the conditions and their input values as follows:
Terminology:
segment - a (connected) subset of indices that correspond to a subset of the LEDs on the controlled strip. The user would be able to configure a list of segments, where each of them in the most basic form would consist of
start-index : int
end-index : int
name : string
The ranges of the segments should be disjunct, so the data representation could of course also be just one index per segment. The challenge here is to figure out a good UI, that allows the usercondition - represents a state that is entered by any of the events supported. Conditions could be:
effect-inputs:
factor: float
- a factor that would be multiplied with the value - that could act as a speed factor for the time-input.easing: Easing
- aside from the normal linear x->x option, a choice of classical easing functions could be applied here - but also square (for a 'blink' effect), or triangle (for a jojo effect)(parametric) effect can (for starters) take a single effect-input value that can assume values between 0 and 1, which can modulate the behavior over an input value.
from : color
to : color
hue: boolean
At any given time, all led's of the entire segment have the same color - make the color fade fromfrom
to theto
color over the input value. ifhue
is false, just fade by linearly interpolating the RGB values otherwise, interpolate HLS values of the colors. this would cover: Rainbow, Pulse, Blink, Solid Colorfrom : color
to : color
width: float
hue: boolean
Like the regular gradient - but instead of over the input, make the color fade across the segment led's. The input-value then modulates the offset for the start-led. Optionally, with thewidth: float
factor, the width of the gradient across the segment can be multiplied, so while the defaultwidth=1
would spread the gradient once,width=0.5
would have the gradient spread 2 times, andwidth=2
would spread only half of the gradient visible across the segment, where the other parts of it become visible over time, as the starting point is modulated. this would cover: Rainboy cyclefrom : color
to : color
hue: boolean
easing: Easing
Display the gradient behaves like the current progress bar - "Single pixel" mode can be toggled.this would cover: Color Wipe, Color Wipe 2, Bounce, Bounce solo, everything that the current progress effects (including #70 'single pixel' mode) do and more. Aside from the above effects, which are quite generic and can achieve a variety of cool things, of course, there could be other more specialized effects like
effect configuration effect configurations put all the aforementioned concepts together. The user would be able to configure a list of these configurations. A single effect configuration consists of:
Given the aforementioned concepts, I hope that a basic intuition for the semantics has emerged. Given a particular effect configuration, whenever the plugin decides to execute it's effect on it's segment, I call that effect configuration active. A remaining questions is, how exactly the plugin decides which effect configurations should be active at what times, in a way that deals with possible conflicts in a sensible way. (WIP, TODO: add suggestion)
Why should this be implemented? I believe that there are many benefits and possible use-cases for a generic approach like this. This could
I like the idea of experimenting with my setup - maybe i want to change the led-wiring tomorrow. Maybe introduce another strip?