diff --git a/app/action.c b/app/action.c index 36b61f657..3922bb560 100644 --- a/app/action.c +++ b/app/action.c @@ -45,6 +45,7 @@ static void ACTION_FlashLight(void) GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); break; case 1: + case 2: gFlashLightState++; break; default: diff --git a/app/app.c b/app/app.c index 58a6789fd..6302c870a 100644 --- a/app/app.c +++ b/app/app.c @@ -1447,6 +1447,35 @@ void APP_TimeSlice10ms(void) if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + else if(gFlashLightState == FLASHLIGHT_SOS) { + const uint16_t u = 15; + static uint8_t c; + static uint16_t next; + + if(gFlashLightBlinkCounter - next > 7*u) { + c = 0; + next = gFlashLightBlinkCounter+1; + } + else if(gFlashLightBlinkCounter == next) { + if(c==0) { + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } + else + GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + + if(c == 18) { + next += 7*u; + c = 0; + } + else if(c==7 || c==9 || c==11) + next += 3*u; + else + next += u; + + c++; + } + + } #ifdef ENABLE_VOX if (gVoxResumeCountdown > 0) diff --git a/misc.h b/misc.h index df4d91a1e..57e8a07ed 100644 --- a/misc.h +++ b/misc.h @@ -52,7 +52,8 @@ enum { enum { FLASHLIGHT_OFF = 0, FLASHLIGHT_ON, - FLASHLIGHT_BLINK + FLASHLIGHT_BLINK, + FLASHLIGHT_SOS }; enum {