Skip to content

Commit

Permalink
fix pwm sysfs access issue on slower systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgineer85 committed Nov 1, 2024
1 parent 7ced803 commit 385960c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions node/services/backends/io/gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def _set_hardware_clock(self, enable: bool = True):
Path(PWM_SYSFS / "export").write_text(f"{PWM_CHANNEL}\n")
time.sleep(0.1)

while not os.access(pwm_dir, os.F_OK):
logger.info("waiting for sysfs to be accessible after export...")
time.sleep(0.1)

Path(pwm_dir / "period").write_text(f"{PERIOD}\n")
Path(pwm_dir / "duty_cycle").write_text(f"{DUTY_CYCLE}\n")
Path(pwm_dir / "enable").write_text(f"{1 if enable else 0}\n")
Expand Down

0 comments on commit 385960c

Please sign in to comment.