From c669ec34def3d2eaca3941b90ab2614489f13d38 Mon Sep 17 00:00:00 2001 From: Silent YANG Date: Sat, 20 Jan 2024 08:11:39 -0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E6=89=8B=E7=94=B5=E7=AD=92?= =?UTF-8?q?=20=E5=8E=BB=E9=99=A4SOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/flashlight.c | 33 +-------------------------------- app/flashlight.h | 3 +-- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/app/flashlight.c b/app/flashlight.c index 4efe6db..9b3a170 100644 --- a/app/flashlight.c +++ b/app/flashlight.c @@ -13,36 +13,6 @@ void FlashlightTimeSlice() GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); return; } - - 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; - return; - } - - 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 = gFlashLightBlinkCounter + 7 * u; - c = 0; - } else if(c==7 || c==9 || c==11) { - next = gFlashLightBlinkCounter + 3 * u; - } else { - next = gFlashLightBlinkCounter + u; - } - c++; - } - } } void ACTION_FlashLight(void) @@ -53,10 +23,9 @@ void ACTION_FlashLight(void) GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); break; case FLASHLIGHT_ON: - case FLASHLIGHT_BLINK: gFlashLightState++; break; - case FLASHLIGHT_SOS: + case FLASHLIGHT_BLINK: default: gFlashLightState = 0; GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); diff --git a/app/flashlight.h b/app/flashlight.h index 6dcab21..91424f2 100644 --- a/app/flashlight.h +++ b/app/flashlight.h @@ -8,8 +8,7 @@ enum FlashlightMode_t { FLASHLIGHT_OFF = 0, FLASHLIGHT_ON, - FLASHLIGHT_BLINK, - FLASHLIGHT_SOS + FLASHLIGHT_BLINK }; extern enum FlashlightMode_t gFlashLightState;