Skip to content

Commit cdaccdb

Browse files
committed
Add CIRCUITPY_TERMINAL_SCALE settings.toml parameter
1 parent 0654cdf commit cdaccdb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/environment.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,11 @@ Example: Configure the display to 640x480 black and white (1 bit per pixel):
174174
175175
`Adafruit Feather RP2350 <https://circuitpython.org/board/adafruit_feather_rp2350/>`_
176176
`Adafruit Metro RP2350 <https://circuitpython.org/board/adafruit_metro_rp2350/>`_
177+
178+
CIRCUITPY_TERMINAL_SCALE
179+
~~~~~~~~~~~~~~~~~~~~~~~~
180+
Allows the entry of a display scaling factor used during the terminalio console construction.
181+
The entered scaling factor only affects the terminalio console and has no impact on
182+
the UART, Web Workflow, BLE Workflow, etc consoles.
183+
184+
`boards that the terminalio core module is available on <https://docs.circuitpython.org/en/latest/shared-bindings/terminalio/>`

supervisor/shared/display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#if CIRCUITPY_TERMINALIO
3838
#include "supervisor/port.h"
39+
#include "shared-module/os/__init__.h"
3940
#endif
4041

4142
#if CIRCUITPY_REPL_LOGO
@@ -55,7 +56,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
5556
}
5657
// Default the scale to 2 because we may show blinka without the terminal for
5758
// languages that don't have font support.
58-
uint8_t scale = 2;
59+
mp_int_t scale = 2;
5960

6061
#if CIRCUITPY_TERMINALIO
6162
displayio_tilegrid_t *scroll_area = &supervisor_terminal_scroll_area_text_grid;
@@ -66,6 +67,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
6667
if (width_in_tiles <= 80) {
6768
scale = 1;
6869
}
70+
(void)common_hal_os_getenv_int("CIRCUITPY_TERMINAL_SCALE", &scale);
6971

7072
width_in_tiles = MAX(1, width_px / (scroll_area->tile_width * scale));
7173
uint16_t height_in_tiles = MAX(2, height_px / (scroll_area->tile_height * scale));

0 commit comments

Comments
 (0)