Merge pull request #6338 from jepler/fix-display-invalid-sh1107

Fix display invalid sh1107
This commit is contained in:
Dan Halbert 2022-05-13 20:33:43 -04:00 committed by GitHub
commit 936f5bf23e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/displayio/Display.c
msgid "%q must be 1 when %q is True"
msgstr ""
#: py/argcheck.c shared-bindings/gifio/GifWriter.c
msgid "%q must be <= %d"
msgstr ""

View File

@ -14,6 +14,7 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C
CIRCUITPY_NVM = 1
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_ONEWIREIO = 0
CIRCUITPY_ZLIB = 0
MCU_SERIES = F4

View File

@ -170,14 +170,20 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
mp_raise_ValueError(translate("Display rotation must be in 90 degree increments"));
}
const bool sh1107_addressing = args[ARG_SH1107_addressing].u_bool;
const mp_int_t color_depth = args[ARG_color_depth].u_int;
if (sh1107_addressing && color_depth != 1) {
mp_raise_ValueError_varg(translate("%q must be 1 when %q is True"), MP_QSTR_color_depth, MP_QSTR_SH1107_addressing);
}
primary_display_t *disp = allocate_display_or_raise();
displayio_display_obj_t *self = &disp->display;
;
self->base.type = &displayio_display_type;
common_hal_displayio_display_construct(
self,
display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation,
args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool,
color_depth, args[ARG_grayscale].u_bool,
args[ARG_pixels_in_byte_share_row].u_bool,
args[ARG_bytes_per_cell].u_bool,
args[ARG_reverse_pixels_in_byte].u_bool,
@ -194,7 +200,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
args[ARG_auto_refresh].u_bool,
args[ARG_native_frames_per_second].u_int,
args[ARG_backlight_on_high].u_bool,
args[ARG_SH1107_addressing].u_bool
sh1107_addressing
);
return self;

View File

@ -74,7 +74,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
self->first_manual_refresh = !auto_refresh;
self->data_as_commands = data_as_commands;
self->backlight_on_high = backlight_on_high;
self->SH1107_addressing = SH1107_addressing;
self->SH1107_addressing = SH1107_addressing && color_depth == 1;
self->native_frames_per_second = native_frames_per_second;
self->native_ms_per_frame = 1000 / native_frames_per_second;