Merge pull request #3295 from tannewt/turn_off_terminalio
Turn off terminalio for ja and ko
This commit is contained in:
commit
24ca5c0218
@ -47,6 +47,16 @@ USB_MSC_EP_NUM_OUT = 1
|
||||
|
||||
CIRCUITPY_ULAB = 0
|
||||
|
||||
ifeq ($(TRANSLATION), ja)
|
||||
RELEASE_NEEDS_CLEAN_BUILD = 1
|
||||
CIRCUITPY_TERMINALIO = 0
|
||||
endif
|
||||
|
||||
ifeq ($(TRANSLATION), ko)
|
||||
RELEASE_NEEDS_CLEAN_BUILD = 1
|
||||
CIRCUITPY_TERMINALIO = 0
|
||||
endif
|
||||
|
||||
endif # samd21
|
||||
|
||||
# Put samd51-only choices here.
|
||||
|
@ -145,7 +145,7 @@ ifeq ($(CIRCUITPY_DIGITALIO),1)
|
||||
SRC_PATTERNS += digitalio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
SRC_PATTERNS += displayio/% terminalio/% fontio/%
|
||||
SRC_PATTERNS += displayio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_VECTORIO),1)
|
||||
SRC_PATTERNS += vectorio/%
|
||||
@ -237,6 +237,9 @@ endif
|
||||
ifeq ($(CIRCUITPY_SUPERVISOR),1)
|
||||
SRC_PATTERNS += supervisor/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_TERMINALIO),1)
|
||||
SRC_PATTERNS += terminalio/% fontio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_TIME),1)
|
||||
SRC_PATTERNS += time/%
|
||||
endif
|
||||
|
@ -347,16 +347,20 @@ extern const struct _mp_obj_module_t displayio_module;
|
||||
extern const struct _mp_obj_module_t fontio_module;
|
||||
extern const struct _mp_obj_module_t terminalio_module;
|
||||
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
|
||||
#define FONTIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_fontio), (mp_obj_t)&fontio_module },
|
||||
#define TERMINALIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module },
|
||||
#ifndef CIRCUITPY_DISPLAY_LIMIT
|
||||
#define CIRCUITPY_DISPLAY_LIMIT (1)
|
||||
#endif
|
||||
#else
|
||||
#define DISPLAYIO_MODULE
|
||||
#define CIRCUITPY_DISPLAY_LIMIT (0)
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO
|
||||
#define FONTIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_fontio), (mp_obj_t)&fontio_module },
|
||||
#define TERMINALIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module },
|
||||
#else
|
||||
#define FONTIO_MODULE
|
||||
#define TERMINALIO_MODULE
|
||||
#define CIRCUITPY_DISPLAY_LIMIT (0)
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_FRAMEBUFFERIO
|
||||
|
@ -195,6 +195,9 @@ CFLAGS += -DCIRCUITPY_STRUCT=$(CIRCUITPY_STRUCT)
|
||||
CIRCUITPY_SUPERVISOR ?= 1
|
||||
CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
|
||||
|
||||
CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO)
|
||||
CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO)
|
||||
|
||||
CIRCUITPY_TIME ?= 1
|
||||
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME)
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "shared-bindings/displayio/Bitmap.h"
|
||||
#include "shared-bindings/displayio/Group.h"
|
||||
#include "shared-bindings/displayio/Palette.h"
|
||||
#include "shared-bindings/displayio/TileGrid.h"
|
||||
@ -48,15 +49,21 @@ extern size_t blinka_bitmap_data[];
|
||||
extern displayio_bitmap_t blinka_bitmap;
|
||||
extern displayio_group_t circuitpython_splash;
|
||||
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
static supervisor_allocation* tilegrid_tiles = NULL;
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
displayio_tilegrid_t* grid = &supervisor_terminal_text_grid;
|
||||
uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width;
|
||||
// determine scale based on h
|
||||
uint8_t scale = 1;
|
||||
if (width_in_tiles > 80) {
|
||||
scale = 2;
|
||||
if (width_in_tiles < 80) {
|
||||
scale = 1;
|
||||
}
|
||||
width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale);
|
||||
uint16_t height_in_tiles = height_px / (grid->tile_height * scale);
|
||||
@ -64,7 +71,6 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
||||
if (remaining_pixels > 0) {
|
||||
height_in_tiles += 1;
|
||||
}
|
||||
circuitpython_splash.scale = scale;
|
||||
|
||||
uint16_t total_tiles = width_in_tiles * height_in_tiles;
|
||||
|
||||
@ -94,34 +100,42 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
||||
grid->full_change = true;
|
||||
|
||||
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
|
||||
#endif
|
||||
|
||||
circuitpython_splash.scale = scale;
|
||||
}
|
||||
|
||||
void supervisor_stop_terminal(void) {
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
if (tilegrid_tiles != NULL) {
|
||||
free_memory(tilegrid_tiles);
|
||||
tilegrid_tiles = NULL;
|
||||
supervisor_terminal_text_grid.inline_tiles = false;
|
||||
supervisor_terminal_text_grid.tiles = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void supervisor_display_move_memory(void) {
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
displayio_tilegrid_t* grid = &supervisor_terminal_text_grid;
|
||||
if (MP_STATE_VM(terminal_tilegrid_tiles) == NULL || grid->tiles != MP_STATE_VM(terminal_tilegrid_tiles)) {
|
||||
return;
|
||||
}
|
||||
uint16_t total_tiles = grid->width_in_tiles * grid->height_in_tiles;
|
||||
if (MP_STATE_VM(terminal_tilegrid_tiles) != NULL &&
|
||||
grid->tiles == MP_STATE_VM(terminal_tilegrid_tiles)) {
|
||||
uint16_t total_tiles = grid->width_in_tiles * grid->height_in_tiles;
|
||||
|
||||
tilegrid_tiles = allocate_memory(align32_size(total_tiles), false);
|
||||
if (tilegrid_tiles != NULL) {
|
||||
memcpy(tilegrid_tiles->ptr, grid->tiles, total_tiles);
|
||||
grid->tiles = (uint8_t*) tilegrid_tiles->ptr;
|
||||
} else {
|
||||
grid->tiles = NULL;
|
||||
grid->inline_tiles = false;
|
||||
tilegrid_tiles = allocate_memory(align32_size(total_tiles), false);
|
||||
if (tilegrid_tiles != NULL) {
|
||||
memcpy(tilegrid_tiles->ptr, grid->tiles, total_tiles);
|
||||
grid->tiles = (uint8_t*) tilegrid_tiles->ptr;
|
||||
} else {
|
||||
grid->tiles = NULL;
|
||||
grid->inline_tiles = false;
|
||||
}
|
||||
MP_STATE_VM(terminal_tilegrid_tiles) = NULL;
|
||||
}
|
||||
MP_STATE_VM(terminal_tilegrid_tiles) = NULL;
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) {
|
||||
@ -254,18 +268,26 @@ displayio_tilegrid_t blinka_sprite = {
|
||||
.in_group = true
|
||||
};
|
||||
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
#define CHILD_COUNT 2
|
||||
displayio_group_child_t splash_children[2] = {
|
||||
{&blinka_sprite, &blinka_sprite},
|
||||
{&supervisor_terminal_text_grid, &supervisor_terminal_text_grid}
|
||||
};
|
||||
#else
|
||||
#define CHILD_COUNT 1
|
||||
displayio_group_child_t splash_children[1] = {
|
||||
{&blinka_sprite, &blinka_sprite},
|
||||
};
|
||||
#endif
|
||||
|
||||
displayio_group_t circuitpython_splash = {
|
||||
.base = {.type = &displayio_group_type },
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.scale = 2,
|
||||
.size = 2,
|
||||
.max_size = 2,
|
||||
.size = CHILD_COUNT,
|
||||
.max_size = CHILD_COUNT,
|
||||
.children = splash_children,
|
||||
.item_removed = false,
|
||||
.in_group = false,
|
||||
|
@ -27,6 +27,10 @@
|
||||
#ifndef MICROPY_INCLUDED_SUPERVISOR_SHARED_DISPLAY_H
|
||||
#define MICROPY_INCLUDED_SUPERVISOR_SHARED_DISPLAY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
|
||||
#include "shared-bindings/displayio/Bitmap.h"
|
||||
#include "shared-bindings/displayio/TileGrid.h"
|
||||
#include "shared-bindings/fontio/BuiltinFont.h"
|
||||
@ -42,6 +46,8 @@ extern displayio_bitmap_t supervisor_terminal_font_bitmap;
|
||||
extern displayio_tilegrid_t supervisor_terminal_text_grid;
|
||||
extern terminalio_terminal_obj_t supervisor_terminal;
|
||||
|
||||
#endif
|
||||
|
||||
void supervisor_start_terminal(uint16_t width_px, uint16_t height_px);
|
||||
void supervisor_stop_terminal(void);
|
||||
|
||||
|
@ -99,7 +99,7 @@ void serial_write_substring(const char* text, uint32_t length) {
|
||||
if (length == 0) {
|
||||
return;
|
||||
}
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
int errcode;
|
||||
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
|
||||
#endif
|
||||
|
@ -110,7 +110,9 @@ ifeq ($(CIRCUITPY_DISPLAYIO), 1)
|
||||
SRC_SUPERVISOR += \
|
||||
supervisor/shared/display.c
|
||||
|
||||
SUPERVISOR_O += $(BUILD)/autogen_display_resources.o
|
||||
ifeq ($(CIRCUITPY_TERMINALIO), 1)
|
||||
SUPERVISOR_O += $(BUILD)/autogen_display_resources.o
|
||||
endif
|
||||
endif
|
||||
ifndef USB_INTERFACE_NAME
|
||||
USB_INTERFACE_NAME = "CircuitPython"
|
||||
|
Loading…
Reference in New Issue
Block a user