From 06844745f63f48cb9074d2173f8290ff206ee75c Mon Sep 17 00:00:00 2001 From: AJ Date: Wed, 26 Mar 2025 22:25:24 +0100 Subject: [PATCH] fix: missing sitl motor count (#14319) - other platforms set it, sitl does not and configurator complains --- src/platform/SIMULATOR/sitl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/platform/SIMULATOR/sitl.c b/src/platform/SIMULATOR/sitl.c index 862d2835fd..2fc992cb45 100644 --- a/src/platform/SIMULATOR/sitl.c +++ b/src/platform/SIMULATOR/sitl.c @@ -644,14 +644,16 @@ bool motorPwmDevInit(motorDevice_t *device, const motorDevConfig_t *motorConfig, if (!device) { return false; } + + pwmMotorCount = device->count; device->vTable = &vTable; - const uint8_t motorCount = device->count; - printf("Initialized motor count %d\n", motorCount); - pwmRawPkt.motorCount = motorCount; + + printf("Initialized motor count %d\n", pwmMotorCount); + pwmRawPkt.motorCount = pwmMotorCount; idlePulse = _idlePulse; - for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS && motorIndex < motorCount; motorIndex++) { + for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS && motorIndex < pwmMotorCount; motorIndex++) { pwmMotors[motorIndex].enabled = true; }