Skip to content

Commit

Permalink
Older VESC firmwares do not report the HW type
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauszus committed Feb 27, 2024
1 parent 42148a4 commit 8dcd684
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pybldc/pybldc.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,11 @@ def on_message_received(self, msg: can.Message) -> None:
self.packet_queue.put_nowait(data)
elif packet_id == CanPacketId.CAN_PACKET_PONG:
controller_id = msg.data[0]
self._hw_type = cast(HwType, msg.data[1])
if len(msg) > 1:
self._hw_type = cast(HwType, msg.data[1])
else:
# Older VESC firmwares do not report the HW type
self._hw_type = HwType.HW_TYPE_VESC
if controller_id == self._controller_id:
self.pong_event.set()

Expand Down

0 comments on commit 8dcd684

Please sign in to comment.