[BUG] Test mode fails to open if firmware version has no suffix
Closed this issue · 2 comments
Environment
AYAB software version: 1.0-dev
Computer/OS: macOS Sonoma 14.5
Knitting machine: KH-910
AYAB hardware: AYAB shield
Describe the bug
When I click the "Tools/Test AYAB Device" menu item, nothing seemingly happens. But all the UI and the menus are grayed out, so all I can do is quit the app.
Additional context
An exception is raised in communication.py
:
Traceback (most recent call last):
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/thread.py", line 40, in run
self.function(*self.args, **self.kwargs)
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/engine.py", line 176, in run
output = self.control.operate(operation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/control.py", line 294, in operate
result = dispatch(self, operation)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/engine_fsm.py", line 215, in _API6_confirm_test
token, param = control.check_serial_API6()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/control.py", line 159, in check_serial_API6
msg, token, param = self.com.update_API6()
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/communication.py", line 199, in update_API6
return self.parse_API6(self.read_API6())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/engine/communication.py", line 207, in parse_API6
return msg, t, msg[1]
~~~^^^
IndexError: index out of range
I tracked this down to be caused by the firmware I had uploaded having an empty version suffix (i.e. no -beta1
, -rc6
…). In my case the full version had defaulted to 0.0.0
because that was a locally-made development build, but this will also happen when official firmware releases have a full version number without a suffix, e.g. 1.0.0
.
It turns out the desktop app can't deal with a testRes
message having no content.
AllYarnsAreBeautiful/ayab-firmware#201 should prevent the firmware from sending empty strings, but it's still not great that the desktop app goes into a zombie state when receiving a well-formed (if empty) message.
As mentioned above this is "fixed" in 1.0.0-beta1
since the firmware no longer sends empty messages. Even though the message handling could be improved in the app, I'm closing this since it can't be easily reproduced anymore.