Handle individual pump unit toggles
This commit is contained in:
@@ -204,6 +204,18 @@ class ReactorDashboard:
|
||||
current = self.reactor.turbine_unit_active[index]
|
||||
self._queue_command(ReactorCommand(turbine_units={index + 1: not current}))
|
||||
|
||||
def _toggle_primary_pump_unit(self, index: int) -> None:
|
||||
if index < 0 or index >= len(self.reactor.primary_pump_units):
|
||||
return
|
||||
current = self.reactor.primary_pump_units[index]
|
||||
self._queue_command(ReactorCommand(primary_pumps={index + 1: not current}))
|
||||
|
||||
def _toggle_secondary_pump_unit(self, index: int) -> None:
|
||||
if index < 0 or index >= len(self.reactor.secondary_pump_units):
|
||||
return
|
||||
current = self.reactor.secondary_pump_units[index]
|
||||
self._queue_command(ReactorCommand(secondary_pumps={index + 1: not current}))
|
||||
|
||||
def _request_reset(self) -> None:
|
||||
self.reset_requested = True
|
||||
if self.sim:
|
||||
|
||||
@@ -369,6 +369,32 @@ class Reactor:
|
||||
elif active and not any(self.secondary_pump_units):
|
||||
self.secondary_pump_units = [True] * len(self.secondary_pump_units)
|
||||
|
||||
def _toggle_primary_pump_unit(self, index: int, active: bool) -> None:
|
||||
if index < 0 or index >= len(self.primary_pump_units):
|
||||
LOGGER.warning("Ignoring primary pump index %s", index)
|
||||
return
|
||||
if self.primary_pump_units[index] == active:
|
||||
return
|
||||
self.primary_pump_units[index] = active
|
||||
LOGGER.info("Primary pump %d %s", index + 1, "enabled" if active else "stopped")
|
||||
if active:
|
||||
self._set_primary_pump(True)
|
||||
elif not any(self.primary_pump_units):
|
||||
self._set_primary_pump(False)
|
||||
|
||||
def _toggle_secondary_pump_unit(self, index: int, active: bool) -> None:
|
||||
if index < 0 or index >= len(self.secondary_pump_units):
|
||||
LOGGER.warning("Ignoring secondary pump index %s", index)
|
||||
return
|
||||
if self.secondary_pump_units[index] == active:
|
||||
return
|
||||
self.secondary_pump_units[index] = active
|
||||
LOGGER.info("Secondary pump %d %s", index + 1, "enabled" if active else "stopped")
|
||||
if active:
|
||||
self._set_secondary_pump(True)
|
||||
elif not any(self.secondary_pump_units):
|
||||
self._set_secondary_pump(False)
|
||||
|
||||
def _set_turbine_state(self, active: bool, index: int | None = None) -> None:
|
||||
if index is None:
|
||||
for idx in range(len(self.turbine_unit_active)):
|
||||
|
||||
Reference in New Issue
Block a user