diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-02-13 21:15:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-13 21:15:14 -0500 |
| commit | f99b9ddcf1ccbdeb32ed01d1c3ef0aaeeef3a5b7 (patch) | |
| tree | 49ef5b47827e6c4d092ad898c14b6a67e1b033b8 | |
| parent | a1a49590716915e28e97020c368b68b267c2b409 (diff) | |
| parent | 473bdf48f61998ee9c51aa16c159bbc4df1d15b6 (diff) | |
Merge pull request #1546 from tannewt/fix_safe_mode
A safe mode fix and displayio fixes
| -rwxr-xr-x | main.c | 1 | ||||
| -rw-r--r-- | ports/atmel-samd/supervisor/port.c | 14 | ||||
| -rw-r--r-- | shared-bindings/displayio/Group.c | 2 | ||||
| -rw-r--r-- | shared-module/displayio/Group.c | 2 | ||||
| -rw-r--r-- | shared-module/displayio/TileGrid.c | 2 |
5 files changed, 14 insertions, 7 deletions
@@ -229,6 +229,7 @@ bool run_code_py(safe_mode_t safe_mode) { MICROPY_VM_HOOK_LOOP #endif if (reload_requested) { + reload_requested = false; return true; } diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 7e7e894cb..3f73d9a8f 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -248,14 +248,20 @@ void reset_cpu(void) { reset(); } -extern uint32_t _ebss; -// Place the word to save just after our BSS section that gets blanked. +// Place the word to save 8k from the end of RAM so we and the bootloader don't clobber it. +#ifdef SAMD21 +uint32_t* safe_word = (uint32_t*) (HMCRAMC0_ADDR + HMCRAMC0_SIZE - 0x2000); +#endif +#ifdef SAMD51 +uint32_t* safe_word = (uint32_t*) (HSRAM_ADDR + HSRAM_SIZE - 0x2000); +#endif + void port_set_saved_word(uint32_t value) { - _ebss = value; + *safe_word = value; } uint32_t port_get_saved_word(void) { - return _ebss; + return *safe_word; } /** diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 421dc1ae5..7b79f3229 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -256,7 +256,7 @@ STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t valu if (value == MP_OBJ_SENTINEL) { // load - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_group_get(self, index)); + return common_hal_displayio_group_get(self, index); } else if (value == mp_const_none) { common_hal_displayio_group_pop(self, index); } else { diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index adaad1505..b48057d1b 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -98,7 +98,7 @@ size_t common_hal_displayio_group_get_len(displayio_group_t* self) { } mp_obj_t common_hal_displayio_group_get(displayio_group_t* self, size_t index) { - return self->children[index]; + return MP_OBJ_FROM_PTR(self->children[index]); } void common_hal_displayio_group_set(displayio_group_t* self, size_t index, mp_obj_t layer) { diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e4f40a5f7..c2aa9b144 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -72,9 +72,9 @@ void common_hal_displayio_tilegrid_get_position(displayio_tilegrid_t *self, int1 } void common_hal_displayio_tilegrid_set_position(displayio_tilegrid_t *self, int16_t x, int16_t y) { + self->needs_refresh = self->x != x || self->y != y; self->x = x; self->y = y; - self->needs_refresh = true; } mp_obj_t common_hal_displayio_tilegrid_get_pixel_shader(displayio_tilegrid_t *self) { |
