Pico-DMX icon indicating copy to clipboard operation
Pico-DMX copied to clipboard

how to define START_CHANNEL during runtime?

Open stephanschulz opened this issue 1 year ago • 2 comments

Thank you for making this library.

I am starting the process of converting some of my Teensy code to work on a PICO. My project reads a dip switch to determine the DMX start channel.

In you example you define volatile uint8_t buffer[DMXINPUT_BUFFER_SIZE(START_CHANNEL, NUM_CHANNELS)]; befor the code starts. Is there a way to either change the buffer or set the buffer during void setup() ?

I guess more specifically i wonder if i can call dmxInput.begin(0, START_CHANNEL, NUM_CHANNELS); again after a dip switch change was noticed? Do i need to call dmxInput.end() first?

Thank you for your advice.

stephanschulz avatar Feb 06 '23 18:02 stephanschulz

Hi, and sorry for the late reply!

Yes, you can re-initialize a DMX input, but as you said, you need to call dmxInput.end() before calling dmxInput.begin(...) again

jostlowe avatar Mar 09 '23 08:03 jostlowe

the other approach is reading the whole universe (all 512 channels) and dynamically deciding which channels to use. (from https://github.com/jostlowe/Pico-DMX/issues/15#issuecomment-1278197448). If your DMX device is sending a partial universe (which my fader does) then this is, afaict, the only way of changing start channel with this library.

michaelglass avatar Feb 14 '24 11:02 michaelglass