diff --git a/setup.py-stubs b/setup.py-stubs index b09c47f739c2..9abfa348a939 100644 --- a/setup.py-stubs +++ b/setup.py-stubs @@ -43,7 +43,7 @@ setup( "root": "..", "relative_to": __file__, "local_scheme": local_scheme, - "git_describe_command": "tools/describe", + "git_describe_command": "tools/describe --long", }, zip_safe=False, ) diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 78e946823b1f..8b2f0bfdf8f7 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -169,8 +169,9 @@ bool displayio_display_core_show(displayio_display_core_t *self, displayio_group // force the circuit_python_splash out of any group (Note: could cause problems with the parent group) circuitpython_splash.x = 0; // reset position in case someone moved it. circuitpython_splash.y = 0; - supervisor_stop_terminal(); + supervisor_start_terminal(self->width, self->height); + root_group = &circuitpython_splash; } if (root_group == self->current_group) { diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c index f0a69bde39fc..fc33533b17ac 100644 --- a/shared-module/terminalio/Terminal.c +++ b/shared-module/terminalio/Terminal.c @@ -36,7 +36,6 @@ void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, d self->font = font; self->tilegrid = tilegrid; self->first_row = 0; - for (uint16_t x = 0; x < self->tilegrid->width_in_tiles; x++) { for (uint16_t y = 0; y < self->tilegrid->height_in_tiles; y++) { common_hal_displayio_tilegrid_set_tile(self->tilegrid, x, y, 0); diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index a4849a3c589c..f99185241438 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -61,6 +61,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { #if CIRCUITPY_TERMINALIO displayio_tilegrid_t *grid = &supervisor_terminal_text_grid; bool tall = height_px > width_px; + bool reset_tiles = false; uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width; uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px; uint16_t width_in_tiles = terminal_width_px / grid->tile_width; @@ -81,37 +82,48 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { uint16_t total_tiles = width_in_tiles * height_in_tiles; + // check if the terminal tile dimensions are the same + if ((grid->width_in_tiles != width_in_tiles) || + (grid->height_in_tiles != height_in_tiles)) { + reset_tiles = true; + } // Reuse the previous allocation if possible if (tilegrid_tiles) { if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) { free_memory(tilegrid_tiles); tilegrid_tiles = NULL; + reset_tiles = true; } } if (!tilegrid_tiles) { tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true); + reset_tiles = true; if (!tilegrid_tiles) { return; } } - uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr; - grid->y = tall ? blinka_bitmap.height : 0; - grid->x = tall ? 0 : blinka_bitmap.width; - grid->top_left_y = 0; - if (remaining_pixels > 0) { - grid->y -= (grid->tile_height - remaining_pixels); - } - grid->width_in_tiles = width_in_tiles; - grid->height_in_tiles = height_in_tiles; - assert(width_in_tiles > 0); - assert(height_in_tiles > 0); - grid->pixel_width = width_in_tiles * grid->tile_width; - grid->pixel_height = height_in_tiles * grid->tile_height; - grid->tiles = tiles; - grid->full_change = true; + if (reset_tiles) { + uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr; + + grid->y = tall ? blinka_bitmap.height : 0; + grid->x = tall ? 0 : blinka_bitmap.width; + grid->top_left_y = 0; + if (remaining_pixels > 0) { + grid->y -= (grid->tile_height - remaining_pixels); + } + grid->width_in_tiles = width_in_tiles; + grid->height_in_tiles = height_in_tiles; + assert(width_in_tiles > 0); + assert(height_in_tiles > 0); + grid->pixel_width = width_in_tiles * grid->tile_width; + grid->pixel_height = height_in_tiles * grid->tile_height; + grid->tiles = tiles; + + grid->full_change = true; - common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font); + common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font); + } #endif circuitpython_splash.scale = scale; diff --git a/tools/describe b/tools/describe index becdc1e5bdd6..7fd624abe3f2 100755 --- a/tools/describe +++ b/tools/describe @@ -1,2 +1,3 @@ #!/bin/sh -git describe --first-parent --dirty --tags --always --match "[1-9].*" +# Add any supplied arguments. +git describe --first-parent --dirty --tags --always --match "[1-9].*" "$@"