jostlowe / Pico-DMX

A library for inputting and outputting the DMX512-A lighting control protocol from a Raspberry Pi Pico
BSD 3-Clause "New" or "Revised" License
193 stars 22 forks source link

Waiting to send Dmx packets needed? #42

Closed SutliffeProductions closed 7 months ago

SutliffeProductions commented 1 year ago

in the output example code, the lines:

while (dmx.busy()){ / Do nothing while the DMX frame transmits / }

are used. Are these needed?, as I'm trying to receive serial data over USB at the same time, and this while loop makes it multiple seconds until that data can be read and any acknowledgement sent back. you mention the library is not blocking, however this piece of code vastly slows down the execution of this program. I'm not a great programmer, so my serial read code isn't greatly optimised, but it functions well if this while loop is not in place. I can send my code if need be.

Thanks,

jostlowe commented 1 year ago

Hi!

The while loop is not necessary!

The call to dmx.busy() does not do anything important other than check if the frame is sent in its entirety. You might want to call it at least once to check if the frame has been transmitted before transmitting a new one, or you might get funny/corrupted data on your DMX line.

Hope that answered your question!