Skip to content

Commit

Permalink
CCP: fix upload response size and getting seed (#2009)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjhogan authored Sep 4, 2024
1 parent aac60b8 commit 93776fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/ccp.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def exchange_station_ids(self, device_id_info: bytes = b"") -> ExchangeStationId
def get_seed(self, resource_mask: int) -> bytes:
if resource_mask > 255:
raise ValueError("resource mask must be less than 256")
self._send_cro(COMMAND_CODE.GET_SEED)
self._send_cro(COMMAND_CODE.GET_SEED, bytes([resource_mask]))
resp = self._recv_dto(0.025)
# protected = resp[0] == 0
seed = resp[1:]
Expand Down Expand Up @@ -221,15 +221,15 @@ def upload(self, size: int) -> bytes:
if size > 5:
raise ValueError("size must be less than 6")
self._send_cro(COMMAND_CODE.UPLOAD, bytes([size]))
return self._recv_dto(0.025)
return self._recv_dto(0.025)[:size]

def short_upload(self, size: int, addr_ext: int, addr: int) -> bytes:
if size > 5:
raise ValueError("size must be less than 6")
if addr_ext > 255:
raise ValueError("address extension must be less than 256")
self._send_cro(COMMAND_CODE.SHORT_UP, bytes([size, addr_ext]) + struct.pack(f"{self.byte_order.value}I", addr))
return self._recv_dto(0.025)
return self._recv_dto(0.025)[:size]

def select_calibration_page(self) -> None:
self._send_cro(COMMAND_CODE.SELECT_CAL_PAGE)
Expand Down

0 comments on commit 93776fd

Please sign in to comment.