From a33dd2934f158c0cb069758c9a296338b3cef560 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Tue, 11 Jul 2017 18:22:40 +0200 Subject: [PATCH] Indicate enabled web recovery mode with pulsing LEDs --- u-boot/net/net.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/u-boot/net/net.c b/u-boot/net/net.c index d35c765..5cc7709 100644 --- a/u-boot/net/net.c +++ b/u-boot/net/net.c @@ -1539,8 +1539,34 @@ int NetLoopHttpd(void){ webfailsafe_is_running = 1; + int led_off = 0; + int cnt_up = 1; + int cnt = 0; + // infinite loop for(;;){ + if (cnt == led_off) + all_led_off(); + else if (cnt == 0) + all_led_on(); + + cnt++; + + if (cnt == 1024) { + cnt = 0; + + if (cnt_up) { + led_off++; + + if (led_off == 1024) + cnt_up = 0; + } else { + led_off--; + + if (led_off == 0) + cnt_up = 1; + } + } /* * Check the ethernet for a new packet. @@ -1562,6 +1588,8 @@ int NetLoopHttpd(void){ /* Invalidate the last protocol */ eth_set_last_protocol(BOOTP); + all_led_off(); + printf("\nWeb failsafe mode aborted!\n\n"); return(-1); } @@ -1600,6 +1628,8 @@ int NetLoopHttpd(void){ do_http_progress(WEBFAILSAFE_PROGRESS_UPGRADE_FAILED); + all_led_off(); + // go to restart goto restart; -- 2.25.1