summaryrefslogtreecommitdiff
path: root/supervisor/shared/rgb_led_status.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-08-20 20:29:57 -0400
committerDan Halbert <halbert@halwitz.org>2020-08-20 20:29:57 -0400
commit0e30dd8bccdbb4469e1bb54443f5d2fca66f7ff6 (patch)
tree734b3c975287d2f922c1c6ca3bf7f3dc153d59d8 /supervisor/shared/rgb_led_status.c
parentdfe50d08d573f2bf49a77e22de1843eb8db4b855 (diff)
parent837abd6da072a55f3c46d62b013690a12e0ee262 (diff)
merge from upstream; working; includes debug_out code for debugging via Saleae for posterity
Diffstat (limited to 'supervisor/shared/rgb_led_status.c')
-rw-r--r--supervisor/shared/rgb_led_status.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c
index f3c210647..2f23e3125 100644
--- a/supervisor/shared/rgb_led_status.c
+++ b/supervisor/shared/rgb_led_status.c
@@ -28,6 +28,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "rgb_led_status.h"
#include "supervisor/shared/tick.h"
+#include "py/obj.h"
#ifdef MICROPY_HW_NEOPIXEL
uint8_t rgb_status_brightness = 63;
@@ -365,6 +366,11 @@ void prep_rgb_status_animation(const pyexec_result_t* result,
status->safe_mode = safe_mode;
status->found_main = found_main;
status->total_exception_cycle = 0;
+ status->ok = result->return_code != PYEXEC_EXCEPTION;
+ if (status->ok) {
+ // If this isn't an exception, skip exception sorting and handling
+ return;
+ }
status->ones = result->exception_line % 10;
status->ones += status->ones > 0 ? 1 : 0;
status->tens = (result->exception_line / 10) % 10;
@@ -382,11 +388,12 @@ void prep_rgb_status_animation(const pyexec_result_t* result,
}
line /= 10;
}
- status->ok = result->return_code != PYEXEC_EXCEPTION;
if (!status->ok) {
status->total_exception_cycle = EXCEPTION_TYPE_LENGTH_MS * 3 + LINE_NUMBER_TOGGLE_LENGTH * status->digit_sum + LINE_NUMBER_TOGGLE_LENGTH * num_places;
}
- if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_IndentationError)) {
+ if (!result->exception_type) {
+ status->exception_color = OTHER_ERROR;
+ } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_IndentationError)) {
status->exception_color = INDENTATION_ERROR;
} else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_SyntaxError)) {
status->exception_color = SYNTAX_ERROR;