diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-08-11 11:04:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-11 11:04:39 -0700 |
| commit | bbac68e77c8dac0b8b20825bbf83a09a3eaf2559 (patch) | |
| tree | 12bc0d595db59efb8294cddfe766495bc2cbdb1b /supervisor | |
| parent | bccfb8b4cdd604fcaa41bc36851141ca751d2d79 (diff) | |
| parent | 4613b58a31c8d439d92961f2034eb9f60b0d97c1 (diff) | |
Merge pull request #3232 from hierophect/esp32-neopixel
ESP32-S2: Add Neopixel support
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 11 |
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; |
