PyDMX icon indicating copy to clipboard operation
PyDMX copied to clipboard

Making the variable DMX_MAX_ADDRESS modifiable?

Open Speldosa opened this issue 2 years ago • 2 comments

I'm using a modified version of PyDMX in my program where I've changed the DMX_MAX_ADDRESS variable in core/dmx/constants.py from 512 to 96 (since I'm only using a single light with 96 addresses anyway). This makes my program run significantly faster.

Would it be possible and desirable to enable some sort of option where this value can be changed by the end user without they having to modify the source code?

Also, while on the topic: In core/dmx/light.py, DMX_MIN_ADDRESS and DMX_MAX_ADDRESS are being defined in the file itself rather than being imported from core/dmx/constants.py as is the case in core/dmx/interface.py and core/dmx/universe.py. I don't know if this is intentional (I guess not), but they are set to the same values as in core/dmx/constants.py anyway, so I guess they should be imported from there instead.

Speldosa avatar Aug 09 '22 00:08 Speldosa

You're right, looks like there's some clean-up I can do. And adding a mechanism for reduced slot count should be doable, and is still within the DMX spec (with certain provisos). I'll have a look at this, probably at the weekend.

JMAlego avatar Aug 09 '22 22:08 JMAlego

Hey there, can you try out the changes on branch feature/partial_serialise?

The changes should allow you to use universe.serialise(partial=True) to get a truncated serialisation e.g. automatically treating the max address as the highest address with a light specified for it.

I think this should give you the desired smaller updates. The drivers should support this also, though they don't enforce the break-to-break timing requirements from DMX. So, be warned you might get strange behaviour if you have break-to-break times less than 1204ms. I plan to add a "standards compliant" mode at some point which will enforce things like this (but be able to be turned off).

If the changes are sufficient I'll push an update to the package to PyPi.

JMAlego avatar Aug 15 '22 20:08 JMAlego

This enhancement has now been merged, closing this issue. Feel free to reopen if it has not resolved the problem.

JMAlego avatar Aug 16 '23 19:08 JMAlego