mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +03:00
Cleanup servo configuration storage (align some values more
efficiently). Update MSP_SERVO_CONFIGURATIONS, MSP_SET_SERVO_CONFIGURATION value order. Add some error checking to size of MSP_SET_SERVO_CONFIGURATION.
This commit is contained in:
parent
52fe86e66d
commit
6dca303130
2 changed files with 9 additions and 5 deletions
|
@ -138,12 +138,12 @@ typedef struct servoParam_t {
|
|||
int16_t min; // servo min
|
||||
int16_t max; // servo max
|
||||
int16_t middle; // servo middle
|
||||
int8_t rate; // range [-125;+125] ; can be used to adjust a rate 0-125% and a direction
|
||||
uint32_t reversedSources; // the direction of servo movement for each input source of the servo mixer, bit set=inverted
|
||||
int8_t rate; // range [-125;+125] ; can be used to adjust a rate 0-125% and a direction
|
||||
uint8_t angleAtMin; // range [0;180] the measured angle in degrees from the middle when the servo is at the 'min' value.
|
||||
uint8_t angleAtMax; // range [0;180] the measured angle in degrees from the middle when the servo is at the 'max' value.
|
||||
int8_t forwardFromChannel; // RX channel index, 0 based. See CHANNEL_FORWARDING_DISABLED
|
||||
} servoParam_t;
|
||||
uint32_t reversedSources; // the direction of servo movement for each input source of the servo mixer, bit set=inverted
|
||||
} __attribute__ ((__packed__)) servoParam_t;
|
||||
|
||||
struct gimbalConfig_s;
|
||||
struct escAndServoConfig_s;
|
||||
|
|
|
@ -843,8 +843,8 @@ static bool processOutCommand(uint8_t cmdMSP)
|
|||
serialize8(currentProfile->servoConf[i].rate);
|
||||
serialize8(currentProfile->servoConf[i].angleAtMin);
|
||||
serialize8(currentProfile->servoConf[i].angleAtMax);
|
||||
serialize32(currentProfile->servoConf[i].reversedSources);
|
||||
serialize8(currentProfile->servoConf[i].forwardFromChannel);
|
||||
serialize32(currentProfile->servoConf[i].reversedSources);
|
||||
}
|
||||
break;
|
||||
case MSP_SERVO_MIX_RULES:
|
||||
|
@ -1429,6 +1429,10 @@ static bool processInCommand(void)
|
|||
break;
|
||||
case MSP_SET_SERVO_CONFIGURATION:
|
||||
#ifdef USE_SERVOS
|
||||
if (currentPort->dataSize != 1 + sizeof(servoParam_t)) {
|
||||
headSerialError(0);
|
||||
break;
|
||||
}
|
||||
i = read8();
|
||||
if (i >= MAX_SUPPORTED_SERVOS) {
|
||||
headSerialError(0);
|
||||
|
@ -1439,8 +1443,8 @@ static bool processInCommand(void)
|
|||
currentProfile->servoConf[i].rate = read8();
|
||||
currentProfile->servoConf[i].angleAtMin = read8();
|
||||
currentProfile->servoConf[i].angleAtMax = read8();
|
||||
currentProfile->servoConf[i].reversedSources = read32();
|
||||
currentProfile->servoConf[i].forwardFromChannel = read8();
|
||||
currentProfile->servoConf[i].reversedSources = read32();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue