diff --git a/ChangeLog b/ChangeLog index c0f5481..fb2a136 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-05-21 Niibe Yutaka + + * src/main.c (led_blink, main): Fix LED blink protocol. + 2016-05-20 NIIBE Yutaka * VERSION: 1.2.0. diff --git a/src/gnuk.h b/src/gnuk.h index 1247a82..eed40c1 100644 --- a/src/gnuk.h +++ b/src/gnuk.h @@ -421,10 +421,11 @@ extern const uint8_t gnuk_string_serial[]; #define LED_ONESHOT 1 #define LED_TWOSHOTS 2 #define LED_SHOW_STATUS 4 -#define LED_START_COMMAND 8 -#define LED_FINISH_COMMAND 16 -#define LED_FATAL 32 -#define LED_GNUK_EXEC 64 +#define LED_FATAL 8 +#define LED_SYNC 16 +#define LED_GNUK_EXEC 32 +#define LED_START_COMMAND 64 +#define LED_FINISH_COMMAND 128 void led_blink (int spec); #if defined(PINPAD_SUPPORT) diff --git a/src/main.c b/src/main.c index e9c58e3..6604797 100644 --- a/src/main.c +++ b/src/main.c @@ -158,6 +158,12 @@ static void display_status_code (void) void led_blink (int spec) { + if (spec == LED_START_COMMAND || spec == LED_FINISH_COMMAND) + { + led_inverted = (spec == LED_START_COMMAND); + spec = LED_SYNC; + } + eventflag_signal (&led_event, spec); } @@ -256,18 +262,12 @@ main (int argc, char *argv[]) case LED_SHOW_STATUS: display_status_code (); break; - case LED_START_COMMAND: - set_led (1); - led_inverted = 1; - chopstx_usec_wait (LED_TIMEOUT_STOP); - break; - case LED_FINISH_COMMAND: - led_inverted = 0; - set_led (0); - break; case LED_FATAL: display_fatal_code (); break; + case LED_SYNC: + set_led (led_inverted); + break; case LED_GNUK_EXEC: goto exec; default: