diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py index f538df9a43f2997f33d302d713d4d3dc59eb52c3..13e98a3507a520c0f22afd0623c1464d46b4910e 100644 --- a/ohmpi/hardware_components/pwr_dps5005.py +++ b/ohmpi/hardware_components/pwr_dps5005.py @@ -72,7 +72,7 @@ class Pwr(PwrAbstract): return self._battery_voltage def current_max(self, value): - self.connection.write_register(0x0001, value * 10, 0) + self.connection.write_register(0x0001, value, 0) @property def pwr_state(self): diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py index 6eb7a3678254e2760101fc7d20685bf6936de820..dd397e4affb6bf5650d90311392f06c0d2207027 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -43,7 +43,7 @@ for k, v in rx_module.SPECS['rx'].items(): except Exception as e: print(f'Cannot set value {v} in RX_CONFIG[{k}]:\n{e}') -current_max = np.min([TX_CONFIG['current_max'], # TODO: replace 50 by a TX config +current_max = np.min([TX_CONFIG['current_max'], HARDWARE_CONFIG['pwr']['current_max'], # TODO: replace 50 by a TX config np.min(np.hstack((np.inf, [MUX_CONFIG[i].pop('current_max', np.inf) for i in MUX_CONFIG.keys()])))]) voltage_max = np.min([TX_CONFIG['voltage_max'], np.min(np.hstack((np.inf, [MUX_CONFIG[i].pop('voltage_max', np.inf) for i in MUX_CONFIG.keys()])))]) @@ -99,6 +99,7 @@ class OhmPiHardware: HARDWARE_CONFIG['pwr'].pop('model') HARDWARE_CONFIG['pwr'].update(**HARDWARE_CONFIG['pwr']) # NOTE: Explain why this is needed or delete me HARDWARE_CONFIG['pwr'].update({'ctl': HARDWARE_CONFIG['pwr'].pop('ctl', self.ctl)}) + HARDWARE_CONFIG['pwr'].update({'current_max': current_max}) if isinstance(HARDWARE_CONFIG['pwr']['ctl'], dict): ctl_mod = HARDWARE_CONFIG['pwr']['ctl'].pop('model', self.ctl) if isinstance(ctl_mod, str): @@ -135,6 +136,7 @@ class OhmPiHardware: if isinstance(self.tx, dict): self.tx = tx_module.Tx(**self.tx) self.tx.pwr = self.pwr + self.tx.pwr._current_max = current_max # Initialize Muxes self._cabling = kwargs.pop('cabling', {})