From: Piotr Dymacz Date: Tue, 11 Jul 2017 16:22:40 +0000 (+0200) Subject: Indicate enabled web recovery mode with pulsing LEDs X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a33dd2934f158c0cb069758c9a296338b3cef560;p=oweals%2Fu-boot_mod.git Indicate enabled web recovery mode with pulsing LEDs --- 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;