MattIPv4 / MattIPv4/PyDMXControl
val in self.channels.items() can be float
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 143
- Forks
- 23
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in _Controller.py bei der Schleife über die Kanalwerte und untersuche, wie Werte aus self.channels.items() _transmit erreichen. Reproduziere den Fall eines konstanten Streams, der einen float erzeugt, und überprüfe anschließend, dass die gewählte Behandlung gültige DMX-Frame-Daten erhält und verhindert, dass die Konvertierung in bytearray fehlschlägt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- embedded-iot
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100