|
|
@@ -23,15 +23,16 @@ class I2CService:
|
|
|
if self.debug:
|
|
|
return [DeviceStatus.EMPTY for _ in range(num_slots)]
|
|
|
|
|
|
- status_list = self.bus.read_block_data(i2c_adress, self.status_register)
|
|
|
+ logger.debug(f"Requesting status list (i2c_adress: {i2c_adress}, register: {self.status_register})")
|
|
|
+ status_list = self.bus.read_i2c_block_data(i2c_adress, self.status_register, num_slots)
|
|
|
logger.debug(f"Received status list: {status_list} (i2c_adress: {i2c_adress})")
|
|
|
- return [DeviceStatus(value) for value in status_list[:num_slots]]
|
|
|
+ return [DeviceStatus(value) for value in status_list]
|
|
|
|
|
|
def request_measure_values(self, i2c_adress: int, slot_id: int) -> MeasureValues:
|
|
|
"""Request the cell values of a specific slot."""
|
|
|
if self.debug:
|
|
|
return MeasureValues(4.2, 3.6, 1.5)
|
|
|
- measure_values:MeasureValues = self.bus.read_block_data(i2c_adress, self.cell_data_register, slot_id) # TODO [SG]: How do i specify the slot?
|
|
|
+ measure_values:MeasureValues = self.bus.read_i2c_block_data(i2c_adress, self.cell_data_register, 3, slot_id) # TODO [SG]: How do i specify the slot?
|
|
|
logger.debug(f"Received measure values: {measure_values} (i2c_adress: {i2c_adress}, slot_id: {slot_id})")
|
|
|
return measure_values
|
|
|
|