mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 01:35:35 +03:00
Allow max motors to be set in target.h
This commit is contained in:
parent
5ec4cf715a
commit
941b72b36f
5 changed files with 73 additions and 29 deletions
|
@ -238,12 +238,14 @@ static void tailSerialReply(void)
|
|||
serialEndWrite(mspSerialPort);
|
||||
}
|
||||
|
||||
#ifdef USE_SERVOS
|
||||
static void s_struct(uint8_t *cb, uint8_t siz)
|
||||
{
|
||||
headSerialReply(siz);
|
||||
while (siz--)
|
||||
serialize8(*cb++);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void serializeNames(const char *s)
|
||||
{
|
||||
|
@ -680,7 +682,10 @@ static bool processOutCommand(uint8_t cmdMSP)
|
|||
break;
|
||||
#endif
|
||||
case MSP_MOTOR:
|
||||
s_struct((uint8_t *)motor, 16);
|
||||
headSerialReply(16);
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
serialize16(i < MAX_SUPPORTED_MOTORS ? motor[i] : 0);
|
||||
}
|
||||
break;
|
||||
case MSP_RC:
|
||||
headSerialReply(2 * rxRuntimeConfig.channelCount);
|
||||
|
@ -1265,8 +1270,12 @@ static bool processInCommand(void)
|
|||
masterConfig.batteryConfig.vbatwarningcellvoltage = read8(); // vbatlevel when buzzer starts to alert
|
||||
break;
|
||||
case MSP_SET_MOTOR:
|
||||
for (i = 0; i < 8; i++) // FIXME should this use MAX_MOTORS or MAX_SUPPORTED_MOTORS instead of 8
|
||||
motor_disarmed[i] = read16();
|
||||
for (i = 0; i < 8; i++) {
|
||||
const int16_t disarmed = read16();
|
||||
if (i < MAX_SUPPORTED_MOTORS) {
|
||||
motor_disarmed[i] = disarmed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSP_SET_SERVO_CONFIGURATION:
|
||||
#ifdef USE_SERVOS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue