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:
commit
1298d3d4c9
2 changed files with 9 additions and 1 deletions
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue