@@ -211,7 +211,7 @@ We see that the `__init__` requires the two parameters for PWM: `hz` and an `ini
211211We next initialize the PWM code (this is still in the ` __init__ ` ) that controls the PWM outputs on the HAT, and add more imports:
212212
213213``` python
214- from pioreactor.hardware import PWM_TO_PIN
214+ from pioreactor.hardware import get_pwm_to_pin_map
215215from pioreactor.utils.pwm import PWM
216216from pioreactor.config import config
217217
@@ -220,7 +220,7 @@ from pioreactor.config import config
220220
221221 def __init__ (...)
222222 ...
223-
223+ PWM_TO_PIN = get_pwm_to_pin_map()
224224 pwm_pin = PWM_TO_PIN [config.get(" PWM_reverse" , " motor_driver" )]
225225 self .pwm = PWM(pwm_pin, self .hz)
226226 self .pwm.lock()
@@ -319,7 +319,7 @@ import json
319319
320320from pioreactor.config import config
321321from pioreactor.background_jobs.base import BackgroundJob
322- from pioreactor.hardware import PWM_TO_PIN
322+ from pioreactor.hardware import get_pwm_to_pin_map
323323from pioreactor.utils.pwm import PWM
324324from pioreactor.utils import clamp
325325
@@ -338,6 +338,7 @@ class MotorDriver(BackgroundJob):
338338 self ._initial_duty_cycle = initial_duty_cycle
339339 self .duty_cycle = initial_duty_cycle
340340
341+ PWM_TO_PIN = get_pwm_to_pin_map()
341342 self .pwm_pin = PWM_TO_PIN [config.get(" PWM_reverse" , " motor_driver" )]
342343
343344 self .pwm = PWM(self .pwm_pin, self .hz)
0 commit comments