Bannsaenger / node-red-contrib-artnet-controller

Node-RED nodes that controls lights via artnet. This is a complete solution for sending and receiving dmx-data via Art-Net without the need of additional hardware
MIT License
3 stars 1 forks source link

Chain transitions #4

Open JonnyTech opened 10 months ago

JonnyTech commented 10 months ago

I am trying to create an effect where a light pulses or breathes by ramping up and down between two values:

light starts to 50 fades up to 200 fades down to 50 repeats fade indefinitely

This payload does not work:

  "transition": "linear",
  "duration": 1000,
  "repeat": 100,
  "gap": 1000,
  "buckets": [
    {"channel": 0, "value": 50},
    {"channel": 0, "value": 200}
  ]

Nor does this:

  "transition": "linear",
  "duration": 1000,
  "repeat": 100,
  "gap": 1000,
  "buckets": [
    {"channel": 0, "value": 200}
  "buckets": [
    {"channel": 0, "value": 200}
  ]

Is is possible to chain payloads together to make it happen?

Just fade between two states like this:


{"channel": 0, "value": 50},
{"channel": 0, "value": 200},
{"channel": 0, "value": 50},
{"channel": 0, "value": 200},
{"channel": 0, "value": 50},
{"channel": 0, "value": 200},
...

Any help would be greatly appreciated.
Bannsaenger commented 10 months ago

Ok, i think you are looking for someting like this:

grafik

In one payload you can only define one transition. This means e.g.

msg.payload = {
    "transition": "linear",
    "duration": 1000,
    "repeat": 1,
    "gap": 0,
    "buckets": [
        {"channel": 1, "value": 255}
    ],
    "start_buckets": [
        {"channel": 1, "value": 50}
    ]
}

for a transition on channel 1 which does a ramp from value 50 to value 255 in 1 second.

If you send another payload with a transition on channel 1 or only a value on channel 1 within 1 second (as long as this transition lasts) the running transition will be stopped and removed from the scheduler.

For now it is only possible to do someting like this:

grafik

with the second payload:

msg.payload = {
    "transition": "linear",
    "duration": 1000,
    "repeat": 1,
    "gap": 0,
    "buckets": [
        {"channel": 1, "value": 50}
    ],
    "start_buckets": [
        {"channel": 1, "value": 255}
    ]
}

which does the ramp downwards.

Maybe i can add a feature to "mirror" the transition to do the wanted up- and down.

Ich hope this helps.

JonnyTech commented 10 months ago

Thank you, in fact that is very similar to my solution.

I was just wondering if the transition would send some feedback once done so that I could do this:

node.send({payload:"/* DMX payload 1 */"});
// wait for feedback response
node.send({payload:"/* DMX payload 2 */"});

Plus, can I send a channel range? Instead of:

"buckets": [
  {"channel": 1, "value": 0},
  {"channel": 2, "value": 0},
  {"channel": 3, "value": 0},
  ...
  {"channel": 512, "value": 0}
],

Is this possible?

"buckets": [
  {"channel": 1 .. 512, "value": 0}
],

I am sending out 5 full universes with a script to build the buckets but there is a lot of data being transmitted. Can it be simplified? Maybe to send an array of values?

Bannsaenger commented 10 months ago

To your first question: No you can't do it for now. But i think this can be done easily. I try to implement this in my next release. Maybe the second thing, with the range of channels, can also be implemented easily. I check these and come back to you.