Merge pull request #2737 from betaflight/remove-msp-cruft
CF/BF - Remove more MSP cruft
This commit is contained in:
commit
63552348c0
|
@ -2351,7 +2351,7 @@ static void cliModeColor(char *cmdline)
|
|||
static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const servoParam_t *defaultServoParams)
|
||||
{
|
||||
// print out servo settings
|
||||
const char *format = "servo %u %d %d %d %d %d %d %d\r\n";
|
||||
const char *format = "servo %u %d %d %d %d %d\r\n";
|
||||
for (uint32_t i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
|
||||
const servoParam_t *servoConf = &servoParams[i];
|
||||
bool equalsDefault = false;
|
||||
|
@ -2360,7 +2360,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
|||
equalsDefault = servoConf->min == defaultServoConf->min
|
||||
&& servoConf->max == defaultServoConf->max
|
||||
&& servoConf->middle == defaultServoConf->middle
|
||||
&& servoConf->angleAtMin == defaultServoConf->angleAtMax
|
||||
&& servoConf->rate == defaultServoConf->rate
|
||||
&& servoConf->forwardFromChannel == defaultServoConf->forwardFromChannel;
|
||||
cliDefaultPrintf(dumpMask, equalsDefault, format,
|
||||
|
@ -2368,8 +2367,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
|||
defaultServoConf->min,
|
||||
defaultServoConf->max,
|
||||
defaultServoConf->middle,
|
||||
defaultServoConf->angleAtMin,
|
||||
defaultServoConf->angleAtMax,
|
||||
defaultServoConf->rate,
|
||||
defaultServoConf->forwardFromChannel
|
||||
);
|
||||
|
@ -2379,8 +2376,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
|||
servoConf->min,
|
||||
servoConf->max,
|
||||
servoConf->middle,
|
||||
servoConf->angleAtMin,
|
||||
servoConf->angleAtMax,
|
||||
servoConf->rate,
|
||||
servoConf->forwardFromChannel
|
||||
);
|
||||
|
@ -2413,7 +2408,7 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
|||
|
||||
static void cliServo(char *cmdline)
|
||||
{
|
||||
enum { SERVO_ARGUMENT_COUNT = 8 };
|
||||
enum { SERVO_ARGUMENT_COUNT = 6 };
|
||||
int16_t arguments[SERVO_ARGUMENT_COUNT];
|
||||
|
||||
servoParam_t *servo;
|
||||
|
@ -2451,7 +2446,7 @@ static void cliServo(char *cmdline)
|
|||
}
|
||||
}
|
||||
|
||||
enum {INDEX = 0, MIN, MAX, MIDDLE, ANGLE_AT_MIN, ANGLE_AT_MAX, RATE, FORWARD};
|
||||
enum {INDEX = 0, MIN, MAX, MIDDLE, RATE, FORWARD};
|
||||
|
||||
i = arguments[INDEX];
|
||||
|
||||
|
@ -2469,21 +2464,17 @@ static void cliServo(char *cmdline)
|
|||
arguments[MIDDLE] < arguments[MIN] || arguments[MIDDLE] > arguments[MAX] ||
|
||||
arguments[MIN] > arguments[MAX] || arguments[MAX] < arguments[MIN] ||
|
||||
arguments[RATE] < -100 || arguments[RATE] > 100 ||
|
||||
arguments[FORWARD] >= MAX_SUPPORTED_RC_CHANNEL_COUNT ||
|
||||
arguments[ANGLE_AT_MIN] < 0 || arguments[ANGLE_AT_MIN] > 180 ||
|
||||
arguments[ANGLE_AT_MAX] < 0 || arguments[ANGLE_AT_MAX] > 180
|
||||
arguments[FORWARD] >= MAX_SUPPORTED_RC_CHANNEL_COUNT
|
||||
) {
|
||||
cliShowParseError();
|
||||
return;
|
||||
}
|
||||
|
||||
servo->min = arguments[1];
|
||||
servo->max = arguments[2];
|
||||
servo->middle = arguments[3];
|
||||
servo->angleAtMin = arguments[4];
|
||||
servo->angleAtMax = arguments[5];
|
||||
servo->rate = arguments[6];
|
||||
servo->forwardFromChannel = arguments[7];
|
||||
servo->min = arguments[MIN];
|
||||
servo->max = arguments[MAX];
|
||||
servo->middle = arguments[MIDDLE];
|
||||
servo->rate = arguments[RATE];
|
||||
servo->forwardFromChannel = arguments[FORWARD];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1548,7 +1548,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
|
||||
case MSP_SET_SERVO_CONFIGURATION:
|
||||
#ifdef USE_SERVOS
|
||||
if (dataSize != 1 + sizeof(servoParam_t)) {
|
||||
if (dataSize != 1 + 14) {
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
i = sbufReadU8(src);
|
||||
|
@ -1559,8 +1559,6 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
servoParamsMutable(i)->max = sbufReadU16(src);
|
||||
servoParamsMutable(i)->middle = sbufReadU16(src);
|
||||
servoParamsMutable(i)->rate = sbufReadU8(src);
|
||||
servoParamsMutable(i)->angleAtMin = sbufReadU8(src);
|
||||
servoParamsMutable(i)->angleAtMax = sbufReadU8(src);
|
||||
servoParamsMutable(i)->forwardFromChannel = sbufReadU8(src);
|
||||
servoParamsMutable(i)->reversedSources = sbufReadU32(src);
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ void pgResetFn_servoParams(servoParam_t *instance)
|
|||
.max = DEFAULT_SERVO_MAX,
|
||||
.middle = DEFAULT_SERVO_MIDDLE,
|
||||
.rate = 100,
|
||||
.angleAtMin = DEFAULT_SERVO_MIN_ANGLE,
|
||||
.angleAtMax = DEFAULT_SERVO_MAX_ANGLE,
|
||||
.forwardFromChannel = CHANNEL_FORWARDING_DISABLED
|
||||
);
|
||||
}
|
||||
|
|
|
@ -97,8 +97,6 @@ typedef struct servoParam_s {
|
|||
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
|
||||
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;
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#define DEFAULT_SERVO_MIN 1000
|
||||
#define DEFAULT_SERVO_MIDDLE 1500
|
||||
#define DEFAULT_SERVO_MAX 2000
|
||||
#define DEFAULT_SERVO_MIN_ANGLE 90
|
||||
#define DEFAULT_SERVO_MAX_ANGLE 90
|
||||
|
||||
typedef enum {
|
||||
RX_FRAME_PENDING = 0,
|
||||
|
|
Loading…
Reference in New Issue