From d80074def71fb3bd7a117ecf52c1bd11f84c04e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=90=AA?= Date: Tue, 28 Jul 2026 12:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E9=94=99=E4=B8=AD=E6=80=A7=E5=85=89?= =?UTF-8?q?=E4=BD=8E=E4=BA=AEPDM=E8=84=89=E5=86=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/ble/ble_peripheral/app/src/bridge_pwm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/project/example/ble/ble_peripheral/app/src/bridge_pwm.c b/project/example/ble/ble_peripheral/app/src/bridge_pwm.c index cd0cf73..51b6e96 100644 --- a/project/example/ble/ble_peripheral/app/src/bridge_pwm.c +++ b/project/example/ble/ble_peripheral/app/src/bridge_pwm.c @@ -277,7 +277,16 @@ __RAM_CODE void Bridge_Deadtime_Expired(void) (!frame_pdm_enabled || frame_pdm_threshold != pdm_threshold)) { pdm_w_accumulator = pdm_threshold - w_step; - pdm_c_accumulator = pdm_threshold - c_step; + /* + * A 50:50 neutral target gives W and C identical PDM steps. + * Start C half a density cycle away from W so their optical + * pulses are spread across different frames instead of arriving + * as one bright pair followed by a long dark gap. + */ + if (pdm_threshold == BRIDGE_NEUTRAL_PDM_THRESHOLD) + pdm_c_accumulator = pdm_threshold / 2U; + else + pdm_c_accumulator = pdm_threshold - c_step; } frame_pdm_enabled = pdm_enabled; frame_pdm_threshold = pdm_enabled ? pdm_threshold : 0U;