From 18f0a2e2a440dff06291f94ad040467091f8fb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=90=AA?= Date: Mon, 27 Jul 2026 13:03:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=97=AA=E7=83=81=E5=92=8C?= =?UTF-8?q?=E5=91=BC=E5=90=B8=E6=9C=80=E4=BD=8E=E4=BA=AE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ble_peripheral/app/src/light_transition.c | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/project/example/ble/ble_peripheral/app/src/light_transition.c b/project/example/ble/ble_peripheral/app/src/light_transition.c index 1ac2bef..88d7e76 100644 --- a/project/example/ble/ble_peripheral/app/src/light_transition.c +++ b/project/example/ble/ble_peripheral/app/src/light_transition.c @@ -6,6 +6,7 @@ volatile uint8_t Light_Transition_FadeActive; #define LIGHT_FADE_STEP 1U #define BRIGHTNESS_SMOOTH_SHIFT 4U +#define BREATH_MIN_OUTPUT 1U /* * Gamma 1.8, mapping APP levels 1..100 to a stable physical range of @@ -94,8 +95,25 @@ void Light_Transition_Task(void) (uint16_t)(((uint32_t)W_PWM * brightness_scale + 2048U) >> 12); target_c = (uint16_t)(((uint32_t)C_PWM * brightness_scale + 2048U) >> 12); - W_PWM_duty = approach_target(W_PWM_duty, target_w); - C_PWM_duty = approach_target(C_PWM_duty, target_c); + + if(Mode == mode1 && target_brightness != 0U) + { + if(W_PWM != 0U && target_w < BREATH_MIN_OUTPUT) + target_w = BREATH_MIN_OUTPUT; + if(C_PWM != 0U && target_c < BREATH_MIN_OUTPUT) + target_c = BREATH_MIN_OUTPUT; + } + + if(Mode == mode2 && deviceStatus != POWEROFF) + { + W_PWM_duty = target_w; + C_PWM_duty = target_c; + } + else + { + W_PWM_duty = approach_target(W_PWM_duty, target_w); + C_PWM_duty = approach_target(C_PWM_duty, target_c); + } Light_Transition_FadeActive = deviceStatus == POWEROFF && (W_PWM_duty != 0U || C_PWM_duty != 0U);