diff --git a/sw/controller/src/led.c b/sw/controller/src/led.c index 076ec52..5122d8b 100644 --- a/sw/controller/src/led.c +++ b/sw/controller/src/led.c @@ -7,7 +7,7 @@ #define LED_REFRESH_PERIOD_MS (50) -#define LED_PULSE_LENGTH_MS (500) +#define LED_PULSE_LENGTH_MS (200) #define ERROR_BLINK_PERIOD_MS (100) #define ERROR_TOTAL_PERIOD_MS (1000) diff --git a/sw/controller/src/writeback.c b/sw/controller/src/writeback.c index 5d8870e..05bd31a 100644 --- a/sw/controller/src/writeback.c +++ b/sw/controller/src/writeback.c @@ -1,5 +1,6 @@ #include "cfg.h" #include "fpga.h" +#include "led.h" #include "sd.h" #include "timer.h" #include "usb.h" @@ -81,9 +82,14 @@ static void writeback_save_to_sd (void) { return; } - if(sd_optimize_sectors(address, p.sectors, length / SD_SECTOR_SIZE, sd_write_sectors)) { + bool error = sd_optimize_sectors(address, p.sectors, length / SD_SECTOR_SIZE, sd_write_sectors); + + if (error) { writeback_disable(); + return; } + + led_activity_pulse(); } static bool writeback_save_to_usb (void) { @@ -103,7 +109,13 @@ static bool writeback_save_to_usb (void) { packet_info.data[0] = save; packet_info.dma_length = length; packet_info.dma_address = address; - return usb_enqueue_packet(&packet_info); + bool enqueued = usb_enqueue_packet(&packet_info); + + if (enqueued) { + led_activity_pulse(); + } + + return enqueued; }