try-except for creating pwm instances
This commit is contained in:
@@ -1221,13 +1221,16 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
if gpio in pwm:
|
||||
pwm_object = pwm[gpio]
|
||||
old_pwm_value = pwm['duty_cycle'] if 'duty_cycle' in pwm else -1
|
||||
if not self.to_int(old_pwm_value) == self.to_int(pwm_value):
|
||||
pwm['duty_cycle'] = pwm_value
|
||||
self._logger.debug("Changing duty cycle: %s", pwm_value)
|
||||
self._logger.debug("PWM Object is: %s", pwm_object)
|
||||
pwm_object.ChangeDutyCycle(pwm_value)
|
||||
self._logger.debug(
|
||||
"Writing PWM on gpio: %s value %s", gpio, pwm_value)
|
||||
|
||||
|
||||
pwm['duty_cycle'] = pwm_value
|
||||
self._logger.debug("Changing duty cycle: %s", pwm_value)
|
||||
self._logger.debug("PWM Object is: %s", pwm_object)
|
||||
pwm_object.ChangeDutyCycle(pwm_value)
|
||||
self._logger.debug(
|
||||
"Writing PWM on gpio: %s value %s", gpio, pwm_value)
|
||||
|
||||
|
||||
self.update_ui()
|
||||
if queue_id is not None:
|
||||
self.stop_queue_item(queue_id)
|
||||
|
||||
Reference in New Issue
Block a user