From 433a19b6dab6a60b8b2d3f55558c82e05f00b7bf Mon Sep 17 00:00:00 2001 From: Martin O'Hanlon Date: Wed, 3 May 2023 11:32:30 +0100 Subject: [PATCH 1/5] fixed test_pwm_output_device_alt_values --- tests/test_picozero.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_picozero.py b/tests/test_picozero.py index f47ee5d..d1cbcd0 100644 --- a/tests/test_picozero.py +++ b/tests/test_picozero.py @@ -179,8 +179,10 @@ def test_pwm_output_device_alt_values(self): self.assertEqual(d.freq, 200) d.off() - # pwm returns 1 less than the duty_factor unless the duty is set to the maximum 65535 - self.assertEqual(d._pwm.duty_u16(), 9999) + # prior to micropython v1.20 PWM returned 1 less than the duty_factor + # unless the duty was set to the maximum 65535 + # self.assertEqual(d._pwm.duty_u16(), 9999) + self.assertEqual(d._pwm.duty_u16(), 10000) self.assertAlmostEqual(d.value, 0, places=2) d.on() From 195d7721351d00c4d5495a79a29dde105d55f4a3 Mon Sep 17 00:00:00 2001 From: Martin O'Hanlon Date: Wed, 3 May 2023 11:51:32 +0100 Subject: [PATCH 2/5] fix recalcuating bound time --- picozero/picozero.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/picozero/picozero.py b/picozero/picozero.py index 5323602..19e3221 100644 --- a/picozero/picozero.py +++ b/picozero/picozero.py @@ -1598,7 +1598,7 @@ def _pin_change(self, p): while ticks_ms() < stop: # keep checking, reset the stop if the value changes if p.value() != last_state: - stop = ticks_ms() + self._bounce_time + stop = ticks_ms() + (self._bounce_time * 1000) last_state = p.value() # re-enable the interupt From 6b01440b48b3d8de23c5d77df040ed6dc66e1fc7 Mon Sep 17 00:00:00 2001 From: Martin O'Hanlon Date: Fri, 12 May 2023 15:11:25 +0100 Subject: [PATCH 3/5] v 0.4.2 --- docs/changelog.rst | 6 ++++++ docs/conf.py | 2 +- picozero/__init__.py | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index eb5e05e..78a08eb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,12 @@ Change log .. currentmodule:: picozero +0.4.2 - 2023-05-12 +------------------ + ++ Bug fix relating to DigitalInputDevice bounce times ++ Updated tests after a change in micropython 1.20+ + 0.4.1 - 2022-12-22 ------------------ diff --git a/docs/conf.py b/docs/conf.py index 3afb34a..7438ce6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ def __getattr__(cls, name): author = 'Raspberry Pi Foundation' # The full version, including alpha/beta/rc tags -release = '0.4.1' +release = '0.4.2' # -- General configuration --------------------------------------------------- diff --git a/picozero/__init__.py b/picozero/__init__.py index 8e8fb43..794583e 100644 --- a/picozero/__init__.py +++ b/picozero/__init__.py @@ -1,6 +1,6 @@ __name__ = "picozero" __package__ = "picozero" -__version__ = '0.4.1' +__version__ = '0.4.2' __author__ = "Raspberry Pi Foundation" from .picozero import ( diff --git a/setup.py b/setup.py index 03755d7..bd087cb 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ __project__ = 'picozero' __packages__ = ['picozero'] __desc__ = 'A beginner-friendly library for using common electronics components with the Raspberry Pi Pico. ' -__version__ = '0.4.1' +__version__ = '0.4.2 __author__ = "Raspberry Pi Foundation" __author_email__ = 'learning@raspberrypi.org' __license__ = 'MIT' From 409939acab69a720a3218948b8cf0be7423fbda1 Mon Sep 17 00:00:00 2001 From: Martin O'Hanlon Date: Sun, 14 May 2023 15:00:33 +0100 Subject: [PATCH 4/5] fix version no --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd087cb..73f6af5 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ __project__ = 'picozero' __packages__ = ['picozero'] __desc__ = 'A beginner-friendly library for using common electronics components with the Raspberry Pi Pico. ' -__version__ = '0.4.2 +__version__ = '0.4.2' __author__ = "Raspberry Pi Foundation" __author_email__ = 'learning@raspberrypi.org' __license__ = 'MIT' From d8bc0ab5af50f59c7e8ba5224b089bc430a0f42a Mon Sep 17 00:00:00 2001 From: Stephen Manz Date: Tue, 7 May 2024 17:44:42 -0600 Subject: [PATCH 5/5] LED() documentation has "pin" rather than "pwm" for second parameter :param int pin: is in two places. The second place should be :param bool pwm: --- picozero/picozero.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/picozero/picozero.py b/picozero/picozero.py index 19e3221..e03ed01 100644 --- a/picozero/picozero.py +++ b/picozero/picozero.py @@ -596,7 +596,7 @@ def LED(pin, pwm=True, active_high=True, initial_value=False): :param int pin: The pin that the device is connected to. - :param int pin: + :param bool pwm: If `pwm` is :data:`True` (the default), a :class:`PWMLED` will be returned. If `pwm` is :data:`False`, a :class:`DigitalLED` will be returned. A :class:`PWMLED` can control the brightness of the LED but