Skip to content

Commit

Permalink
hardware type check
Browse files Browse the repository at this point in the history
  • Loading branch information
surgura committed Dec 4, 2023
1 parent 968bbb7 commit 71989c4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ def prepare(self) -> None:
print(f"Battery level is at {sensor_readings.battery/100.0}%.")

def run(self) -> None:
"""Run the brain and remote."""
"""
Run the brain and remote.
:raises NotImplementedError: When hardware type is not supported.
"""
control_period = 1 / self._config.control_frequency

start_time = time.time()
Expand All @@ -204,6 +208,8 @@ def run(self) -> None:
for pin, position in zip(pins, sensor_readings.pins)
},
)
case _:
raise NotImplementedError("Hardware type not supported.")

while (current_time := time.time()) - start_time < self._config.run_duration:
# Sleep until next control update
Expand Down Expand Up @@ -253,3 +259,5 @@ def run(self) -> None:
for pin, position in zip(pins, sensor_readings.pins)
},
)
case _:
raise NotImplementedError("Hardware type not supported.")

0 comments on commit 71989c4

Please sign in to comment.