Skip to content

Commit

Permalink
fix estimate duty cycle not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Nov 29, 2024
1 parent c8caec3 commit 351adfd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pioreactor/background_jobs/stirring.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ def action_to_do_after_od_reading(self):
self.poll_and_update_dc(2)

def initialize_dodging_operation(self):
if config.getfloat("od_reading.config", "samples_per_second") >= 0.2:
self.logger.warning(
"Recommended to decrease `samples_per_second` to ensure there is time to start/stop stirring. Try 0.15 or less."
)

self.set_duty_cycle(0)
self.rpm_check_repeated_thread = RepeatedTimer(
1_000,
Expand Down Expand Up @@ -424,7 +429,8 @@ def poll_and_update_dc(self, poll_for_seconds: Optional[float] = None) -> None:
return

result = self.pid.update(self._measured_rpm)
self.set_duty_cycle(self._estimate_duty_cycle + result)
self._estimate_duty_cycle += result
self.set_duty_cycle(self._estimate_duty_cycle)

def on_ready_to_sleeping(self) -> None:
self.rpm_check_repeated_thread.pause()
Expand Down

0 comments on commit 351adfd

Please sign in to comment.