From b8200d72950f4d360a29e2f62d49773954942e5f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 9 Sep 2019 23:17:52 -0400 Subject: [PATCH] fix atmel-samd filesystem_tick'ing; clear_temp_status() should check for status indicator in use --- ports/atmel-samd/tick.c | 12 ++++++++---- supervisor/shared/external_flash/external_flash.c | 1 + supervisor/shared/rgb_led_status.c | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/tick.c b/ports/atmel-samd/tick.c index dde473375e..4d7bb9dca7 100644 --- a/ports/atmel-samd/tick.c +++ b/ports/atmel-samd/tick.c @@ -29,6 +29,7 @@ #include "peripheral_clk_config.h" #include "supervisor/shared/autoreload.h" +#include "supervisor/filesystem.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Processor.h" @@ -52,10 +53,13 @@ void SysTick_Handler(void) { (void) SysTick->CTRL; common_hal_mcu_enable_interrupts(); - #ifdef CIRCUITPY_AUTORELOAD_DELAY_MS +#if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0 + filesystem_tick(); +#endif +#ifdef CIRCUITPY_AUTORELOAD_DELAY_MS autoreload_tick(); - #endif - #ifdef CIRCUITPY_GAMEPAD_TICKS +#endif +#ifdef CIRCUITPY_GAMEPAD_TICKS if (!(ticks_ms & CIRCUITPY_GAMEPAD_TICKS)) { #if CIRCUITPY_GAMEPAD gamepad_tick(); @@ -64,7 +68,7 @@ void SysTick_Handler(void) { gamepadshift_tick(); #endif } - #endif +#endif } void tick_init() { diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index ad10bab516..99df553e19 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -428,6 +428,7 @@ static bool flush_ram_cache(bool keep_cache) { } // Delegates to the correct flash flush method depending on the existing cache. +// TODO Don't blink the status indicator if we don't actually do any writing (hard to tell right now). static void spi_flash_flush_keep_cache(bool keep_cache) { #ifdef MICROPY_HW_LED_MSC port_pin_set_output_level(MICROPY_HW_LED_MSC, true); diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index fd356cb48f..4d93715161 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -266,9 +266,15 @@ void temp_status_color(uint32_t rgb) { void clear_temp_status() { #ifdef MICROPY_HW_NEOPIXEL + if (neopixel_in_use) { + return; + } common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3); #endif #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) + if (apa102_mosi_in_use || apa102_sck_in_use) { + return; + } #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); #else