summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-11-19 15:43:39 -0500
committerDan Halbert <halbert@halwitz.org>2020-11-19 15:43:39 -0500
commit649c9305364f10ea1dc43179e768ec968d0b9ed5 (patch)
tree1934932a3c6adb4ccf0742bb1e6d3c8a99390bef /supervisor
parent5bb3c321e9f19b657363e2b19a8f5b25c4d5eb49 (diff)
wip
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/rgb_led_status.c7
-rw-r--r--supervisor/shared/rgb_led_status.h2
-rw-r--r--supervisor/shared/safe_mode.c9
3 files changed, 10 insertions, 8 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c
index bff74a1f0..c3d33ad3e 100644
--- a/supervisor/shared/rgb_led_status.c
+++ b/supervisor/shared/rgb_led_status.c
@@ -367,7 +367,6 @@ void prep_rgb_status_animation(const pyexec_result_t* result,
status->found_main = found_main;
status->total_exception_cycle = 0;
status->ok = result->return_code != PYEXEC_EXCEPTION;
- status->cycles = 0;
if (status->ok) {
// If this isn't an exception, skip exception sorting and handling
return;
@@ -419,9 +418,8 @@ bool tick_rgb_status_animation(rgb_status_animation_t* status) {
// All is good. Ramp ALL_DONE up and down.
if (tick_diff > ALL_GOOD_CYCLE_MS) {
status->pattern_start = supervisor_ticks_ms32();
- status->cycles++;
new_status_color(BLACK);
- return status->cycles;
+ return true;
}
uint16_t brightness = tick_diff * 255 / (ALL_GOOD_CYCLE_MS / 2);
@@ -436,8 +434,7 @@ bool tick_rgb_status_animation(rgb_status_animation_t* status) {
} else {
if (tick_diff > status->total_exception_cycle) {
status->pattern_start = supervisor_ticks_ms32();
- status->cycles++;
- return;
+ return true;
}
// First flash the file color.
if (tick_diff < EXCEPTION_TYPE_LENGTH_MS) {
diff --git a/supervisor/shared/rgb_led_status.h b/supervisor/shared/rgb_led_status.h
index e4e1981a2..84c97796a 100644
--- a/supervisor/shared/rgb_led_status.h
+++ b/supervisor/shared/rgb_led_status.h
@@ -76,6 +76,6 @@ void prep_rgb_status_animation(const pyexec_result_t* result,
bool found_main,
safe_mode_t safe_mode,
rgb_status_animation_t* status);
-void tick_rgb_status_animation(rgb_status_animation_t* status);
+bool tick_rgb_status_animation(rgb_status_animation_t* status);
#endif // MICROPY_INCLUDED_SUPERVISOR_RGB_LED_STATUS_H
diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c
index 905a0c408..7630010d0 100644
--- a/supervisor/shared/safe_mode.c
+++ b/supervisor/shared/safe_mode.c
@@ -29,6 +29,9 @@
#include "mphalport.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
+#if CIRCUITPY_ALARM
+#include "shared-bindings/alarm/ResetReason.h"
+#endif
#include "supervisor/serial.h"
#include "supervisor/shared/rgb_led_colors.h"
@@ -52,10 +55,12 @@ safe_mode_t wait_for_safe_mode_reset(void) {
current_safe_mode = safe_mode;
return safe_mode;
}
- if (common_hal_sleep_get_reset_reason() != RESET_REASON_POWER_VALID &&
- common_hal_sleep_get_reset_reason() != RESET_REASON_BUTTON) {
+#if CIRCUITPY_ALARM
+ if (common_hal_alarm_get_reset_reason() != RESET_REASON_POWER_ON &&
+ common_hal_alarm_get_reset_reason() != RESET_REASON_RESET_PIN) {
return NO_SAFE_MODE;
}
+#endif
port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8));
// Wait for a while to allow for reset.
temp_status_color(SAFE_MODE);