1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Merge pull request #8825 from jflyper/bfdev-fix-MOTOR_MSP-hard-fault-with-no-motors

Provide isMotorEnabled function for motorNullDevice
This commit is contained in:
Michael Keller 2019-09-06 19:47:48 +12:00 committed by GitHub
commit 1298d3d4c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -140,6 +140,13 @@ static void motorDisableNull(void)
{ {
} }
static bool motorIsEnabledNull(uint8_t index)
{
UNUSED(index);
return false;
}
bool motorUpdateStartNull(void) bool motorUpdateStartNull(void)
{ {
return true; return true;
@ -181,6 +188,7 @@ static const motorVTable_t motorNullVTable = {
.postInit = motorPostInitNull, .postInit = motorPostInitNull,
.enable = motorEnableNull, .enable = motorEnableNull,
.disable = motorDisableNull, .disable = motorDisableNull,
.isMotorEnabled = motorIsEnabledNull,
.updateStart = motorUpdateStartNull, .updateStart = motorUpdateStartNull,
.write = motorWriteNull, .write = motorWriteNull,
.writeInt = motorWriteIntNull, .writeInt = motorWriteIntNull,

View file

@ -991,7 +991,7 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
case MSP_MOTOR: case MSP_MOTOR:
for (unsigned i = 0; i < 8; i++) { for (unsigned i = 0; i < 8; i++) {
#ifdef USE_MOTOR #ifdef USE_MOTOR
if (i >= MAX_SUPPORTED_MOTORS || !motorIsMotorEnabled(i)) { if (!motorIsEnabled() || i >= MAX_SUPPORTED_MOTORS || !motorIsMotorEnabled(i)) {
sbufWriteU16(dst, 0); sbufWriteU16(dst, 0);
continue; continue;
} }