Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,14 @@ Example: Configure the display to 640x480 black and white (1 bit per pixel):

`Adafruit Feather RP2350 <https://circuitpython.org/board/adafruit_feather_rp2350/>`_
`Adafruit Metro RP2350 <https://circuitpython.org/board/adafruit_metro_rp2350/>`_

CIRCUITPY_TERMINAL_SCALE
~~~~~~~~~~~~~~~~~~~~~~~~
Allows the entry of a display scaling factor used during the terminalio console construction.
The entered scaling factor only affects the terminalio console and has no impact on
the UART, Web Workflow, BLE Workflow, etc consoles.

This feature is not enabled on some CircuitPython board with limited Flash, currently
this includes some of the Atmel_samd boards based on the M0 microprocessor.

`boards that the terminalio core module is available on <https://docs.circuitpython.org/en/latest/shared-bindings/terminalio/>`_
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_JPEGIO = 0
CIRCUITPY_NOTFLASH_LIMITED = 0
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C, W25Q16JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_RAINBOWIO = 0
CIRCUITPY_NOTFLASH_LIMITED = 0
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "S25FL064L"
LONGINT_IMPL = MPZ

CIRCUITPY_NOTFLASH_LIMITED = 0
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/huntercat_nfc/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_NOTFLASH_LIMITED = 0
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY_BITBANG_APA102 = 1

CIRCUITPY_PULSEIO = 0

CIRCUITPY_NOTFLASH_LIMITED = 0
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
CIRCUITPY_RAINBOWIO = 0

CIRCUITPY_NOTFLASH_LIMITED = 0
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/pewpew_lcd/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ CIRCUITPY_USB_VENDOR = 0
CIRCUITPY_VECTORIO = 0
CIRCUITPY_RAINBOWIO = 0

CIRCUITPY_NOTFLASH_LIMITED = 0

CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf
OPTIMIZATION_FLAGS = -Os
FROZEN_MPY_DIRS += $(TOP)/frozen/pew-pewpew-lcd
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

LONGINT_IMPL = MPZ
CIRCUITPY_NOTFLASH_LIMITED = 0

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C,W25Q16JVxQ,W25Q32FV"
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/snekboard/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ USB_MANUFACTURER = "keithp.com"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

CIRCUITPY_NOTFLASH_LIMITED = 0

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
LONGINT_IMPL = MPZ
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
CIRCUITPY_RAINBOWIO = 0
CIRCUITPY_NOTFLASH_LIMITED = 0
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
CIRCUITPY_PARALLELDISPLAYBUS = 0
CIRCUITPY_NOTFLASH_LIMITED = 0
2 changes: 2 additions & 0 deletions ports/atmel-samd/boards/stringcar_m0_express/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ CIRCUITPY_KEYPAD = 0
CIRCUITPY_USB_MIDI = 0

CIRCUITPY_BITBANG_APA102 = 1

CIRCUITPY_NOTFLASH_LIMITED = 0
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = W25Q32BV
LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
CIRCUITPY_NOTFLASH_LIMITED = 0
4 changes: 4 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ CFLAGS += -DCIRCUITPY=$(CIRCUITPY)
CIRCUITPY_FULL_BUILD ?= 1
CFLAGS += -DCIRCUITPY_FULL_BUILD=$(CIRCUITPY_FULL_BUILD)

# Smaller builds can't support newest Circuitpython features
CIRCUITPY_NOTFLASH_LIMITED ?= 1
CFLAGS += -DCIRCUITPY_NOTFLASH_LIMITED=$(CIRCUITPY_NOTFLASH_LIMITED)

# By default, aggressively reduce the size of in-flash messages, at the cost of
# increased build time
CIRCUITPY_MESSAGE_COMPRESSION_LEVEL ?= 9
Expand Down
8 changes: 7 additions & 1 deletion supervisor/shared/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@

#if CIRCUITPY_TERMINALIO
#include "supervisor/port.h"
#if CIRCUITPY_NOTFLASH_LIMITED
#include "shared-module/os/__init__.h"
#endif
#endif

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

#if CIRCUITPY_TERMINALIO
displayio_tilegrid_t *scroll_area = &supervisor_terminal_scroll_area_text_grid;
Expand All @@ -66,6 +69,9 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
if (width_in_tiles <= 80) {
scale = 1;
}
#if CIRCUITPY_NOTFLASH_LIMITED
(void)common_hal_os_getenv_int("CIRCUITPY_TERMINAL_SCALE", &scale);
#endif

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