Skip to content

Commit 7ecaafe

Browse files
author
Martin O'Hanlon
committed
PWM channel error msg
1 parent e35bbda commit 7ecaafe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

picozero/picozero.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,13 @@ def _check_pwm_channel(self, pin_num):
364364
channel = PWMOutputDevice.PIN_TO_PWM_CHANNEL[pin_num]
365365
if channel in PWMOutputDevice._channels_used.keys():
366366
raise PWMChannelAlreadyInUse(
367-
f"PWM channel {channel} is already in use by pin {PWMOutputDevice._channels_used[channel]}. Use a different pin"
367+
"PWM channel {} is already in use by {}. Use a different pin".format(
368+
channel,
369+
str(PWMOutputDevice._channels_used[channel])
370+
)
368371
)
369372
else:
370-
PWMOutputDevice._channels_used[channel] = pin_num
373+
PWMOutputDevice._channels_used[channel] = self
371374

372375
def _state_to_value(self, state):
373376
return (state if self.active_high else self._duty_factor - state) / self._duty_factor

0 commit comments

Comments
 (0)