Skip to content

Commit 2c42a48

Browse files
committed
Clear stale exception in _exec_result; more status_bar fixups
1 parent 2fa671c commit 2c42a48

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
458458

459459
// Finished executing python code. Cleanup includes filesystem flush and a board reset.
460460
cleanup_after_vm(heap, _exec_result.exception);
461+
_exec_result.exception = NULL;
461462

462463
// If a new next code file was set, that is a reason to keep it (obviously). Stuff this into
463464
// the options because it can be treated like any other reason-for-stickiness bit. The
@@ -841,6 +842,7 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
841842
port_post_boot_py(true);
842843

843844
cleanup_after_vm(heap, _exec_result.exception);
845+
_exec_result.exception = NULL;
844846

845847
port_post_boot_py(false);
846848

@@ -992,7 +994,7 @@ int __attribute__((used)) main(void) {
992994
supervisor_workflow_start();
993995

994996
#if CIRCUITPY_STATUS_BAR
995-
supervisor_status_bar_start();
997+
supervisor_status_bar_request_update(true);
996998
#endif
997999

9981000
// Boot script is finished, so now go into REPL or run code.py.

shared-module/supervisor/StatusBar.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ bool shared_module_supervisor_status_bar_get_console(supervisor_status_bar_obj_t
4040
}
4141

4242
void shared_module_supervisor_status_bar_set_console(supervisor_status_bar_obj_t *self, bool enabled) {
43+
if (self->console == enabled) {
44+
// Do nothing if not changing the state.
45+
return;
46+
}
47+
4348
if (self->written) {
4449
// Clear before changing state. If disabling, will remain cleared.
4550
supervisor_status_bar_clear();
@@ -57,6 +62,11 @@ bool shared_module_supervisor_status_bar_get_display(supervisor_status_bar_obj_t
5762

5863
#if CIRCUITPY_TERMINALIO
5964
void shared_module_supervisor_status_bar_set_display(supervisor_status_bar_obj_t *self, bool enabled) {
65+
if (self->display == enabled) {
66+
// Do nothing if not changing the state.
67+
return;
68+
}
69+
6070
if (self->written) {
6171
// Clear before changing state. If disabling, will remain cleared.
6272
terminalio_terminal_clear_status_bar(&supervisor_terminal);

supervisor/shared/status_bar.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ static background_callback_t status_bar_background_cb;
5050
static bool _forced_dirty = false;
5151
static bool _suspended = false;
5252

53-
void supervisor_status_bar_init(void) {
54-
shared_module_supervisor_status_bar_obj.console = true;
55-
shared_module_supervisor_status_bar_obj.display = true;
56-
shared_module_supervisor_status_bar_obj.update_in_progress = false;
57-
shared_module_supervisor_status_bar_obj.written = false;
58-
}
59-
6053
// Clear if possible, but give up if we can't do it now.
6154
void supervisor_status_bar_clear(void) {
6255
if (!_suspended) {
@@ -121,8 +114,6 @@ static void status_bar_background(void *data) {
121114
}
122115

123116
void supervisor_status_bar_start(void) {
124-
status_bar_background_cb.fun = status_bar_background;
125-
status_bar_background_cb.data = NULL;
126117
supervisor_status_bar_request_update(true);
127118
}
128119

@@ -141,3 +132,13 @@ void supervisor_status_bar_resume(void) {
141132
_suspended = false;
142133
supervisor_status_bar_request_update(false);
143134
}
135+
136+
void supervisor_status_bar_init(void) {
137+
status_bar_background_cb.fun = status_bar_background;
138+
status_bar_background_cb.data = NULL;
139+
140+
shared_module_supervisor_status_bar_obj.console = true;
141+
shared_module_supervisor_status_bar_obj.display = true;
142+
shared_module_supervisor_status_bar_obj.update_in_progress = false;
143+
shared_module_supervisor_status_bar_obj.written = false;
144+
}

0 commit comments

Comments
 (0)