summaryrefslogtreecommitdiff
path: root/supervisor/shared
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-11-26 11:33:45 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-11-26 11:33:45 +0530
commite90cb3ad866d418803768f3a58154e0039478e56 (patch)
tree4b1d086fb43e11e1928a3c6cc9bd731c1d50407c /supervisor/shared
parent6af48bb24cc12a9547aef8d18d56acf8e0f5695d (diff)
parente778fc1f876116fd8f07b95f9eb8439745988fba (diff)
Merge branch 'main' into fix-touch
Diffstat (limited to 'supervisor/shared')
-rw-r--r--supervisor/shared/display.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index afb3f3a9a..a9ae25884 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -60,18 +60,21 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
#if CIRCUITPY_TERMINALIO
displayio_tilegrid_t* grid = &supervisor_terminal_text_grid;
- uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width;
+ bool tall = height_px > width_px;
+ 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;
// determine scale based on h
if (width_in_tiles < 80) {
scale = 1;
}
- width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale);
+ width_in_tiles = terminal_width_px / (grid->tile_width * scale);
if (width_in_tiles < 1) {
width_in_tiles = 1;
}
- uint16_t height_in_tiles = height_px / (grid->tile_height * scale);
- uint16_t remaining_pixels = height_px % (grid->tile_height * scale);
+ uint16_t height_in_tiles = terminal_height_px / (grid->tile_height * scale);
+ uint16_t remaining_pixels = tall ? 0 : terminal_height_px % (grid->tile_height * scale);
if (height_in_tiles < 1 || remaining_pixels > 0) {
height_in_tiles += 1;
}
@@ -91,7 +94,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
if (tiles == NULL) {
return;
}
- grid->y = 0;
+ 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);