Skip to content

Commit

Permalink
Parsing also patch and dirty fields of cnfInfo message
Browse files Browse the repository at this point in the history
  • Loading branch information
dl1com committed Jul 5, 2023
1 parent 55cb669 commit 6acb89f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/python/ayab/engine/communication_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def open_serial(self, portname=None) -> bool:

def req_info(self) -> None:
"""Send a request for API version information."""
cnfInfo = bytes([Token.cnfInfo.value, 6, 1, 0]) # APIv6, FWv1.0
cnfInfo = bytes([Token.cnfInfo.value, 6, 1, 0, 0, 0]) # APIv6, FW v1.0.0
self.rx_msg_list.append(cnfInfo)

def req_init_API6(self, machine_val):
Expand Down
4 changes: 3 additions & 1 deletion src/main/python/ayab/engine/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def __log_cnfInfo(self, msg):
api = msg[1]
log = "API v" + str(api)
if api >= 5:
log += ", FW v" + str(msg[2]) + "." + str(msg[3])
log += ", FW v" + str(msg[2]) + "." + str(msg[3]) + "." + str(msg[4])
if msg[5] is not 0:
log += "-dirty"
self.logger.info(log)

def cnf_line_API6(self, line_number):
Expand Down
2 changes: 1 addition & 1 deletion src/main/python/ayab/tests/test_communication_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_req_start_API6(self):

def test_req_info(self):
expected_result = (bytes([Token.cnfInfo.value, 6, 1,
0]), Token.cnfInfo, 6)
0, 0, 0]), Token.cnfInfo, 6)
self.comm_dummy.req_info()
bytes_read = self.comm_dummy.update_API6()
assert bytes_read == expected_result
Expand Down

0 comments on commit 6acb89f

Please sign in to comment.