Skip to content

Commit

Permalink
reuse pub client, remove pwm_hz
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Oct 27, 2024
1 parent 2835dbb commit 64d8a38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 5 additions & 1 deletion pioreactor/background_jobs/stirring.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ def __init__(

pin: pt.GpioPin = hardware.PWM_TO_PIN[channel]
self.pwm = PWM(
pin, config.getfloat("stirring.config", "pwm_hz"), unit=self.unit, experiment=self.experiment
pin,
config.getfloat("stirring.config", "pwm_hz"),
unit=self.unit,
experiment=self.experiment,
pubsub_client=self.pub_client,
)
self.pwm.lock()
self.duty_cycle_lock = Lock()
Expand Down
6 changes: 0 additions & 6 deletions pioreactor/utils/pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ def __init__(

self._pwm = SoftwarePWMOutputDevice(self.pin, self.hz)

with local_intermittent_storage("pwm_hz") as cache:
cache[self.pin] = self.hz

self.logger.debug(
f"Initialized GPIO-{self.pin} using {'hardware' if self.using_hardware else 'software'}-timing, initial frequency = {self.hz} hz."
)
Expand Down Expand Up @@ -291,9 +288,6 @@ def clean_up(self) -> None:
with local_intermittent_storage("pwm_dc") as cache:
cache.pop(self.pin)

with local_intermittent_storage("pwm_hz") as cache:
cache.pop(self.pin)

gpio_helpers.set_gpio_availability(self.pin, True)

self.logger.debug(f"Cleaned up GPIO-{self.pin}.")
Expand Down

0 comments on commit 64d8a38

Please sign in to comment.