Skip to content

Commit a5f3eb4

Browse files
Kevin MatochaKevin Matocha
Kevin Matocha
authored and
Kevin Matocha
committed
add root_group accessor, reset REPL position/size when display.show(None) is called
1 parent 5660599 commit a5f3eb4

File tree

5 files changed

+7
-45
lines changed

5 files changed

+7
-45
lines changed

shared-bindings/displayio/Display.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,23 +444,6 @@ const mp_obj_property_t displayio_display_bus_obj = {
444444
MP_ROM_NONE},
445445
};
446446

447-
//| root_group: _Group
448-
//| """The root group on the display."""
449-
//|
450-
//|
451-
STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) {
452-
displayio_display_obj_t *self = native_display(self_in);
453-
return common_hal_displayio_display_get_root_group(self);
454-
}
455-
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group);
456-
457-
const mp_obj_property_t displayio_display_root_group_obj = {
458-
.base.type = &mp_type_property,
459-
.proxy = {(mp_obj_t)&displayio_display_get_root_group_obj,
460-
MP_ROM_NONE,
461-
MP_ROM_NONE},
462-
};
463-
464447

465448
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
466449
//| """Extract the pixels from a single row
@@ -534,7 +517,6 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = {
534517
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) },
535518
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_display_rotation_obj) },
536519
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_display_bus_obj) },
537-
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_display_root_group_obj) },
538520
};
539521
STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table);
540522

shared-bindings/displayio/Display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t *
6969
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, mp_float_t brightness);
7070

7171
mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self);
72-
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self);
72+
7373

7474
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H

shared-bindings/supervisor/__init__.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "shared/runtime/interrupt_char.h"
3434
#include "supervisor/shared/autoreload.h"
3535
#include "supervisor/shared/bluetooth/bluetooth.h"
36-
#include "supervisor/shared/display.h"
3736
#include "supervisor/shared/status_leds.h"
3837
#include "supervisor/shared/stack.h"
3938
#include "supervisor/shared/traceback.h"
@@ -300,17 +299,6 @@ STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
300299
}
301300
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow);
302301

303-
//| def reset_terminal(x_pixels: int, y_pixels: int) -> None:
304-
//| """Adjust the pixel dimensions of the REPL console."""
305-
//| ...
306-
//|
307-
STATIC mp_obj_t supervisor_reset_terminal(mp_obj_t x_pixels, mp_obj_t y_pixels) {
308-
supervisor_stop_terminal();
309-
supervisor_start_terminal(mp_obj_get_int(x_pixels), mp_obj_get_int(y_pixels));
310-
return mp_const_none;
311-
}
312-
MP_DEFINE_CONST_FUN_OBJ_2(supervisor_reset_terminal_obj, supervisor_reset_terminal);
313-
314302
STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
315303
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) },
316304
{ MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) },
@@ -324,7 +312,6 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
324312
{ MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) },
325313
{ MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) },
326314
{ MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) },
327-
{ MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) },
328315
};
329316

330317
STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals_table);

shared-module/displayio/Display.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self) {
220220
return self->core.bus;
221221
}
222222

223-
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self) {
224-
return self->core.current_group;
225-
}
226-
227223
STATIC const displayio_area_t *_get_refresh_areas(displayio_display_obj_t *self) {
228224
if (self->core.full_refresh) {
229225
self->core.area.next = NULL;

shared-module/displayio/display_core.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,12 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self,
163163
}
164164

165165
bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group) {
166-
167-
if (root_group == NULL) { // set the display to the REPL, reset REPL position and size
168-
circuitpython_splash.in_group = false;
169-
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
170-
circuitpython_splash.x = 0; // reset position in case someone moved it.
171-
circuitpython_splash.y = 0;
172-
supervisor_stop_terminal();
173-
supervisor_start_terminal(self->width, self->height);
174-
root_group = &circuitpython_splash;
166+
if (root_group == NULL) {
167+
if (!circuitpython_splash.in_group) {
168+
root_group = &circuitpython_splash;
169+
} else if (self->current_group == &circuitpython_splash) {
170+
return true;
171+
}
175172
}
176173
if (root_group == self->current_group) {
177174
return true;

0 commit comments

Comments
 (0)