From a38d8948b3b22a7b3f84284f765578a8edeab3f5 Mon Sep 17 00:00:00 2001 From: mrmcwethy Date: Wed, 22 Nov 2017 19:56:28 -0700 Subject: [PATCH] M4 status LED flashing with no main.py present #447 Initialized stack variable --- main.c | 8 +++++++- supervisor/shared/rgb_led_status.c | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 7ed93ddf5d..21940d795a 100644 --- a/main.c +++ b/main.c @@ -131,6 +131,11 @@ bool start_mp(safe_mode_t safe_mode) { #endif pyexec_result_t result; + + result.return_code = 0; + result.exception_type = NULL; + result.exception_line = 0; + bool found_main = false; if (safe_mode != NO_SAFE_MODE) { @@ -166,9 +171,10 @@ bool start_mp(safe_mode_t safe_mode) { if (reload_next_character) { return true; } + if (serial_connected() && serial_bytes_available()) { // Skip REPL if reload was requested. - return serial_read() == CHAR_CTRL_D; + return (serial_read() == CHAR_CTRL_D); } if (!serial_connected_before_animation && serial_connected()) { diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 0f29b254a1..4ea0900421 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -207,6 +207,7 @@ void prep_rgb_status_animation(const pyexec_result_t* result, new_status_color(ALL_DONE); status->pattern_start = ticks_ms; status->safe_mode = safe_mode; + status->found_main = found_main; status->total_exception_cycle = 0; status->ones = result->exception_line % 10; status->ones += status->ones > 0 ? 1 : 0;