Просмотр исходного кода

ref: update MQTT broker address and I2C polling interval; enhance docstring for inserted cell update

Silas Gruen 5 месяцев назад
Родитель
Сommit
260e4fbac0
2 измененных файлов с 5 добавлено и 8 удалено
  1. 4 7
      config/config.yaml
  2. 1 1
      src/controllers/measurement_controller.py

+ 4 - 7
config/config.yaml

@@ -1,6 +1,6 @@
 mqtt:
   debug: false
-  broker_address: "localhost"
+  broker_address: "10.1.1.131"
   port: 1883
   subscribe_prefix: "cells_inserted"
   publish_prefix: "measurement_done"
@@ -12,7 +12,7 @@ mqtt:
 i2c:
   debug: false
   bus_number: 1
-  polling_interval_ms: 100  # Pause between polling I2C devices
+  polling_interval_ms: 250  # Pause between polling I2C devices
   retry_count: 3  # Number of retries for failed I2C communications # TODO implement
   timeout_ms: 100  # Timeout for I2C communications # TODO implement
 
@@ -33,11 +33,8 @@ measurement:
 
 devices:
   - id: 1
-    i2c_address: 0x48
-    num_slots: 3
-  # - id: 8
-  #   i2c_address: 0x41
-  #   num_slots: 4
+    i2c_address: 0x20
+    num_slots: 4
 
 logging:
   level: "DEBUG"

+ 1 - 1
src/controllers/measurement_controller.py

@@ -104,7 +104,7 @@ class MeasurementController:
         cell.add_measurement(measure_values)
 
     def _update_inserted_cell(self, insertion_info: InsertedCell):
-        """Update the inserted cell id for a device."""
+        """Fetch cell info from server, create new Cell with it and insert it into the device's slot."""
         cell_info = self.http_service.fetch_cell_info(insertion_info.cell_id)
         min_volt = int(max(cell_info['cell_type']['min_voltage'], self.config['measurement']['min_voltage'])*1000)  # Convert to mV
         max_volt = int(min(cell_info['cell_type']['max_voltage'], self.config['measurement']['max_voltage'])*1000)  # Convert to mV