MattIPv4 / MattIPv4/PyDMXControl
val in self.channels.items() can be float
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 143
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi fellow,
thanks a looot for your library. Real nice work.
I ran into an issue (can't tell you the origin), but by using a constant stream following line in _Controller.py might create a float, which later on will crash the program:
# Get all channels values
for key, val in self.channels.items():
# If channel in frame
if key - first < len(self.__frame):
self.__frame[key - first] = int(val[0])`
i placed an int() around the val[0]. Not sure if that's in general a good idea.
but it fixed the issue, that otherwise at this call would break the runtime.
def _transmit(self, frame: List[int], first: int):
# Convert to a bytearray and pad the start of the frame
# We're transmitting direct DMX data here, so a frame must start at channel 1, but can end early
try:
data = bytearray(([0] * (first - 1)) + frame)
# The first byte in the type, and is `0` for normal DMX data
data.insert(0, 0)
# Write
self.__device.send_break(100e-6)
sleep(10e-6)
self.__device.write(data)
except:
print("bad request")`
```
as you see I made a try / except for myself.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in _Controller.py, nel ciclo dei valori dei canali, e verifica come i valori di self.channels.items() arrivano a _transmit. Riproduci il caso di uno stream costante che produce un float, quindi verifica che la gestione scelta preservi dati di frame DMX validi e impedisca il fallimento della conversione in bytearray.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- embedded-iot
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100