平滑三色呼吸单色低亮尾部

This commit is contained in:
2026-07-28 11:44:55 +08:00
parent 5a29f94c70
commit 1516b11029
@@ -390,22 +390,23 @@ __RAM_CODE void Bridge_Service_1ms(void)
/* /*
* The low part of the three-color breathing effect cannot use short * The low part of the three-color breathing effect cannot use short
* continuous W/C pulses reliably. Emit verified 50 us pulses and vary * continuous pulses reliably. Emit verified 50 us pulses and vary their
* their density across the fixed 2 kHz frames instead. At the configured * density across the fixed 2 kHz frames instead. Apply this to both the
* minimum output this gives about 450 emitted pulses per second. * mixed section and each single-color tail, so no color disappears early
* when its hardware-PWM pulse becomes too narrow to light the LEDs.
*/ */
if (deviceStatus != POWEROFF && if (deviceStatus != POWEROFF &&
Mode == mode1 && choose_mode_falsg == 5U && Mode == mode1 && choose_mode_falsg == 5U &&
w_mix != 0U && c_mix != 0U) { (w_mix != 0U || c_mix != 0U)) {
/* /*
* Follow the smoothed physical output rather than the next logical * Follow the smoothed physical output rather than the next logical
* target. This lets the old color reach zero before the wait state * target. This lets the old color reach zero before the wait state
* starts the next color. * starts the next color.
*/ */
pdm_w_step = total_on_us = (w_mix != 0U && c_mix != 0U)
BRIDGE_DUAL_ACTIVE_US * ((uint32_t)w_mix << 12); ? BRIDGE_DUAL_ACTIVE_US : BRIDGE_FRAME_US;
pdm_c_step = pdm_w_step = total_on_us * ((uint32_t)w_mix << 12);
BRIDGE_DUAL_ACTIVE_US * ((uint32_t)c_mix << 12); pdm_c_step = total_on_us * ((uint32_t)c_mix << 12);
if (pdm_w_step < BRIDGE_TRICOLOR_PDM_THRESHOLD && if (pdm_w_step < BRIDGE_TRICOLOR_PDM_THRESHOLD &&
pdm_c_step < BRIDGE_TRICOLOR_PDM_THRESHOLD) { pdm_c_step < BRIDGE_TRICOLOR_PDM_THRESHOLD) {