Skip to content

Commit 05b8feb

Browse files
committed
Fix SRXL2 ESC build on non-DSHOT targets and regenerate Settings.md
CI on maintenance-10.x surfaced two issues: - On targets without USE_DSHOT (e.g. BEEROTORF4) the build failed: `pwmCompleteMotorUpdate` and the SRXL2 case in pwmMotorPreconfigure lived inside `#if defined(USE_DSHOT)`, while fc_core.c calls pwmCompleteMotorUpdate whenever USE_DSHOT || USE_SRXL2_ESC. Move pwmCompleteMotorUpdate under `USE_DSHOT || USE_SRXL2_ESC`, keep its digital body behind USE_DSHOT, and drop the unnecessary motorConfigDigitalUpdateInterval() call from the SRXL2 case (SRXL2 paces itself in srxl2EscUpdate()). - Regenerate docs/Settings.md so the SRXL2 value added to motor_pwm_protocol is documented (settings_md CI check). Verified by building BEEROTORF4 (no DSHOT), SPEEDYBEEF405WING (DSHOT) and SITL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GroYFi23gHDgj43xrTAVaY
1 parent 6e7eced commit 05b8feb

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

docs/Settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3273,6 +3273,7 @@ Protocol that is used to send motor updates to ESCs. Possible values - STANDARD,
32733273
| DSHOT150 | |
32743274
| DSHOT300 | |
32753275
| DSHOT600 | |
3276+
| SRXL2 | |
32763277

32773278
---
32783279

src/main/drivers/pwm_output.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,27 @@ static bool executeDShotCommands(void){
524524
}
525525
#endif
526526

527+
#else // digital motor protocol
528+
529+
// This stub is needed to avoid ESC_SENSOR dependency on DSHOT
530+
void pwmRequestMotorTelemetry(int motorIndex)
531+
{
532+
UNUSED(motorIndex);
533+
}
534+
535+
#endif
536+
537+
// pwmCompleteMotorUpdate must also exist for SRXL2-only targets (no DSHOT),
538+
// where it just drives the SRXL2 transmit. The digital/DSHOT body below is
539+
// kept behind USE_DSHOT so it is omitted on those targets.
540+
#if defined(USE_DSHOT) || defined(USE_SRXL2_ESC)
527541
void pwmCompleteMotorUpdate(void) {
528542
if (initMotorProtocol == PWM_TYPE_SRXL2) {
529543
srxl2EscUpdate(micros());
530544
return;
531545
}
532546

547+
#ifdef USE_DSHOT
533548
// This only makes sense for digital motor protocols
534549
if (!isMotorProtocolDigital()) {
535550
return;
@@ -585,16 +600,8 @@ void pwmCompleteMotorUpdate(void) {
585600
#endif
586601
}
587602
#endif
603+
#endif
588604
}
589-
590-
#else // digital motor protocol
591-
592-
// This stub is needed to avoid ESC_SENSOR dependency on DSHOT
593-
void pwmRequestMotorTelemetry(int motorIndex)
594-
{
595-
UNUSED(motorIndex);
596-
}
597-
598605
#endif
599606

600607
void pwmMotorPreconfigure(void)
@@ -620,8 +627,11 @@ void pwmMotorPreconfigure(void)
620627
break;
621628

622629
case PWM_TYPE_SRXL2:
630+
// SRXL2 paces its own transmissions inside srxl2EscUpdate() and
631+
// pwmCompleteMotorUpdate() returns early for it, so the digital update
632+
// interval is unused here. Avoid calling motorConfigDigitalUpdateInterval()
633+
// which is only defined when USE_DSHOT is enabled.
623634
if (srxl2EscInit()) {
624-
motorConfigDigitalUpdateInterval(getEscUpdateFrequency());
625635
motorWritePtr = pwmWriteSrxl2;
626636
} else {
627637
motorWritePtr = pwmWriteNull;

0 commit comments

Comments
 (0)