From 47437cb415252b1aaf8a061988072eabe35b04c7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 18 Mar 2021 23:42:24 -0400 Subject: make translate; fix display pins --- locale/circuitpython.pot | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) (limited to 'locale') diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index eea693dc6..97d46debd 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -338,6 +338,10 @@ msgstr "" msgid "All UART peripherals are in use" msgstr "" +#: shared-bindings/pwmio/PWMOut.c +msgid "All channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "" @@ -667,7 +671,7 @@ msgstr "" msgid "Cannot unambiguously get sizeof scalar" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c +#: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -749,11 +753,7 @@ msgstr "" msgid "Could not initialize UART" msgstr "" -#: ports/esp32s2/common-hal/pwmio/PWMOut.c ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not initialize channel" -msgstr "" - -#: ports/esp32s2/common-hal/pwmio/PWMOut.c ports/stm/common-hal/pwmio/PWMOut.c +#: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Could not initialize timer" msgstr "" @@ -777,7 +777,7 @@ msgstr "" msgid "Could not set address" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c +#: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" msgstr "" @@ -1026,7 +1026,7 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c +#: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -1254,10 +1254,6 @@ msgstr "" msgid "Invalid frequency" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Invalid frequency supplied" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "Invalid memory access." msgstr "" @@ -1303,10 +1299,6 @@ msgstr "" msgid "Invalid pins" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Invalid pins for PWMOut" -msgstr "" - #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c #: shared-bindings/displayio/FourWire.c msgid "Invalid polarity" @@ -1559,18 +1551,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: ports/esp32s2/common-hal/pwmio/PWMOut.c -msgid "No more channels available" -msgstr "" - -#: ports/esp32s2/common-hal/pwmio/PWMOut.c -msgid "No more timers available" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "No more timers available on this pin." -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -2124,11 +2104,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "" -"Timer was reserved for internal use - declare PWM pins earlier in the program" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "To exit, please reset the board without " msgstr "" @@ -3737,6 +3712,7 @@ msgstr "" #: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_funhouse/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h -- cgit v1.2.3 From 1512ca520b3e78ebc5cf6d9e031ac24c9206f1bb Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 19 Mar 2021 09:57:21 -0400 Subject: Fix PWMOut non-error handling and never reset --- locale/circuitpython.pot | 4 ---- ports/esp32s2/boards/adafruit_funhouse/board.c | 2 ++ ports/esp32s2/common-hal/pwmio/PWMOut.c | 6 ++++-- shared-bindings/pwmio/PWMOut.c | 2 ++ shared-module/displayio/Display.c | 10 +++++----- 5 files changed, 13 insertions(+), 11 deletions(-) (limited to 'locale') diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 97d46debd..9148569ec 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -753,10 +753,6 @@ msgstr "" msgid "Could not initialize UART" msgstr "" -#: ports/esp32s2/common-hal/pwmio/PWMOut.c -msgid "Could not initialize timer" -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not re-init channel" msgstr "" diff --git a/ports/esp32s2/boards/adafruit_funhouse/board.c b/ports/esp32s2/boards/adafruit_funhouse/board.c index b1f685d03..810b61dbe 100644 --- a/ports/esp32s2/boards/adafruit_funhouse/board.c +++ b/ports/esp32s2/boards/adafruit_funhouse/board.c @@ -33,6 +33,8 @@ #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" +#include "esp_log.h" + displayio_fourwire_obj_t board_display_obj; #define DELAY 0x80 diff --git a/ports/esp32s2/common-hal/pwmio/PWMOut.c b/ports/esp32s2/common-hal/pwmio/PWMOut.c index 84b2ef658..d662e1dbe 100644 --- a/ports/esp32s2/common-hal/pwmio/PWMOut.c +++ b/ports/esp32s2/common-hal/pwmio/PWMOut.c @@ -92,7 +92,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, } } if (timer_index == INDEX_EMPTY) { - // Running out of timers isn't pin related on ESP32S2 so we can't re-use error messages + // Running out of timers isn't pin related on ESP32S2. return PWMOUT_ALL_TIMERS_IN_USE; } @@ -115,7 +115,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, self->tim_handle.clk_cfg = LEDC_AUTO_CLK; if (ledc_timer_config(&(self->tim_handle)) != ESP_OK) { - mp_raise_ValueError(translate("Could not initialize timer")); + return PWMOUT_INITIALIZATION_ERROR; } self->chan_handle.channel = channel_index; @@ -148,6 +148,8 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, void common_hal_pwmio_pwmout_never_reset(pwmio_pwmout_obj_t *self) { never_reset_tim[self->tim_handle.timer_num] = true; never_reset_chan[self->chan_handle.channel] = true; + + never_reset_pin_number(self->pin_number); } void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) { diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c index b70b0c741..01b5bf77a 100644 --- a/shared-bindings/pwmio/PWMOut.c +++ b/shared-bindings/pwmio/PWMOut.c @@ -103,6 +103,8 @@ STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args, self->base.type = &pwmio_pwmout_type; pwmout_result_t result = common_hal_pwmio_pwmout_construct(self, pin, duty_cycle, frequency, variable_frequency); switch (result) { + case PWMOUT_OK: + break; case PWMOUT_INVALID_PIN: mp_raise_ValueError(translate("Invalid pin")); break; diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 63e098e08..9117a50b7 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -111,7 +111,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, self->backlight_inout.base.type = &mp_type_NoneType; if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) { // Avoid PWM types and functions when the module isn't enabled - #if (CIRCUITPY_PULSEIO) + #if (CIRCUITPY_PWMIO) pwmout_result_t result = common_hal_pwmio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false); if (result != PWMOUT_OK) { self->backlight_inout.base.type = &digitalio_digitalinout_type; @@ -173,14 +173,14 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, bool ok = false; // Avoid PWM types and functions when the module isn't enabled - #if (CIRCUITPY_PULSEIO) + #if (CIRCUITPY_PWMIO) bool ispwm = (self->backlight_pwm.base.type == &pwmio_pwmout_type) ? true : false; #else bool ispwm = false; #endif if (ispwm) { - #if (CIRCUITPY_PULSEIO) + #if (CIRCUITPY_PWMIO) common_hal_pwmio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t)(0xffff * brightness)); ok = true; #else @@ -410,7 +410,7 @@ STATIC void _update_backlight(displayio_display_obj_t *self) { if (supervisor_ticks_ms64() - self->last_backlight_refresh < 100) { return; } - // TODO(tannewt): Fade the backlight based on it's existing value and a target value. The target + // TODO(tannewt): Fade the backlight based on its existing value and a target value. The target // should account for ambient light when possible. common_hal_displayio_display_set_brightness(self, 1.0); @@ -428,7 +428,7 @@ void displayio_display_background(displayio_display_obj_t *self) { void release_display(displayio_display_obj_t *self) { common_hal_displayio_display_set_auto_refresh(self, false); release_display_core(&self->core); - #if (CIRCUITPY_PULSEIO) + #if (CIRCUITPY_PWMIO) if (self->backlight_pwm.base.type == &pwmio_pwmout_type) { common_hal_pwmio_pwmout_reset_ok(&self->backlight_pwm); common_hal_pwmio_pwmout_deinit(&self->backlight_pwm); -- cgit v1.2.3