Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Convert the code to run as Python3, since Python2 has been unsupported for over 4 years.
Most of the fixes involve
serial.Serial.read
andstruct.pack
now returning abytes
object instead of a string. I've tested a few of the commands on my GMC-500+ and in a Python3 interpreter with the-b
flag which additionally warns about comparingstr
tobytes
(an easy pitfall otherwise).I also went ahead and simplified many cases of e.g.:
to just:
I have not tested all the available commands, but I can confirm that reading data off the device and into a CSV file is working. I do notice some artifacts at the tail end of the flash memory dump, there's a long run of CPS=255 which I assume is from a parsing error. I don't know if this behaviour is present before these Python3 fixes.