Skip to content

Commit

Permalink
Report an unknown carriage in simulation mode
Browse files Browse the repository at this point in the history
This avoids the UI showing a particular carriage type when it's irrelevant for simulation.
  • Loading branch information
jonathanperret authored and dl1com committed Dec 9, 2024
1 parent 4bc241c commit 0ef0bc6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/main/python/main/ayab/engine/communication_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,22 @@ def req_info(self) -> None:
self.rx_msg_list.append(cnfInfo)

def req_init_API6(self, machine_val):
"""Send machine type."""
"""Send machine type and initial state report"""
cnfInit = bytes([Token.cnfInit.value, 0])
self.rx_msg_list.append(cnfInit)
indState = bytes(
[Token.indState.value, 0, 1, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 1]
[
Token.indState.value,
0, # success
1, # fsm state
0xFF,
0xFF, # left sensor value
0xFF,
0xFF, # right sensor value
0xFF, # carriage type (unknown)
0, # position
1, # direction
]
)
self.rx_msg_list.append(indState)

Expand Down
2 changes: 1 addition & 1 deletion src/main/python/main/ayab/tests/test_communication_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_req_init_API6(self):
assert bytes_read == expected_result
# indState shall be sent automatically, also
expected_result = (
bytes([Token.indState.value, 0, 1, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0, 1]),
bytes([Token.indState.value, 0, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 1]),
Token.indState,
0,
)
Expand Down

0 comments on commit 0ef0bc6

Please sign in to comment.