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)
|
static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const servoParam_t *defaultServoParams)
|
||||||
{
|
{
|
||||||
// print out servo settings
|
// 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++) {
|
for (uint32_t i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
|
||||||
const servoParam_t *servoConf = &servoParams[i];
|
const servoParam_t *servoConf = &servoParams[i];
|
||||||
bool equalsDefault = false;
|
bool equalsDefault = false;
|
||||||
|
@ -2360,7 +2360,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
||||||
equalsDefault = servoConf->min == defaultServoConf->min
|
equalsDefault = servoConf->min == defaultServoConf->min
|
||||||
&& servoConf->max == defaultServoConf->max
|
&& servoConf->max == defaultServoConf->max
|
||||||
&& servoConf->middle == defaultServoConf->middle
|
&& servoConf->middle == defaultServoConf->middle
|
||||||
&& servoConf->angleAtMin == defaultServoConf->angleAtMax
|
|
||||||
&& servoConf->rate == defaultServoConf->rate
|
&& servoConf->rate == defaultServoConf->rate
|
||||||
&& servoConf->forwardFromChannel == defaultServoConf->forwardFromChannel;
|
&& servoConf->forwardFromChannel == defaultServoConf->forwardFromChannel;
|
||||||
cliDefaultPrintf(dumpMask, equalsDefault, format,
|
cliDefaultPrintf(dumpMask, equalsDefault, format,
|
||||||
|
@ -2368,8 +2367,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
||||||
defaultServoConf->min,
|
defaultServoConf->min,
|
||||||
defaultServoConf->max,
|
defaultServoConf->max,
|
||||||
defaultServoConf->middle,
|
defaultServoConf->middle,
|
||||||
defaultServoConf->angleAtMin,
|
|
||||||
defaultServoConf->angleAtMax,
|
|
||||||
defaultServoConf->rate,
|
defaultServoConf->rate,
|
||||||
defaultServoConf->forwardFromChannel
|
defaultServoConf->forwardFromChannel
|
||||||
);
|
);
|
||||||
|
@ -2379,8 +2376,6 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
||||||
servoConf->min,
|
servoConf->min,
|
||||||
servoConf->max,
|
servoConf->max,
|
||||||
servoConf->middle,
|
servoConf->middle,
|
||||||
servoConf->angleAtMin,
|
|
||||||
servoConf->angleAtMax,
|
|
||||||
servoConf->rate,
|
servoConf->rate,
|
||||||
servoConf->forwardFromChannel
|
servoConf->forwardFromChannel
|
||||||
);
|
);
|
||||||
|
@ -2413,7 +2408,7 @@ static void printServo(uint8_t dumpMask, const servoParam_t *servoParams, const
|
||||||
|
|
||||||
static void cliServo(char *cmdline)
|
static void cliServo(char *cmdline)
|
||||||
{
|
{
|
||||||
enum { SERVO_ARGUMENT_COUNT = 8 };
|
enum { SERVO_ARGUMENT_COUNT = 6 };
|
||||||
int16_t arguments[SERVO_ARGUMENT_COUNT];
|
int16_t arguments[SERVO_ARGUMENT_COUNT];
|
||||||
|
|
||||||
servoParam_t *servo;
|
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];
|
i = arguments[INDEX];
|
||||||
|
|
||||||
|
@ -2469,21 +2464,17 @@ static void cliServo(char *cmdline)
|
||||||
arguments[MIDDLE] < arguments[MIN] || arguments[MIDDLE] > arguments[MAX] ||
|
arguments[MIDDLE] < arguments[MIN] || arguments[MIDDLE] > arguments[MAX] ||
|
||||||
arguments[MIN] > arguments[MAX] || arguments[MAX] < arguments[MIN] ||
|
arguments[MIN] > arguments[MAX] || arguments[MAX] < arguments[MIN] ||
|
||||||
arguments[RATE] < -100 || arguments[RATE] > 100 ||
|
arguments[RATE] < -100 || arguments[RATE] > 100 ||
|
||||||
arguments[FORWARD] >= MAX_SUPPORTED_RC_CHANNEL_COUNT ||
|
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
|
|
||||||
) {
|
) {
|
||||||
cliShowParseError();
|
cliShowParseError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
servo->min = arguments[1];
|
servo->min = arguments[MIN];
|
||||||
servo->max = arguments[2];
|
servo->max = arguments[MAX];
|
||||||
servo->middle = arguments[3];
|
servo->middle = arguments[MIDDLE];
|
||||||
servo->angleAtMin = arguments[4];
|
servo->rate = arguments[RATE];
|
||||||
servo->angleAtMax = arguments[5];
|
servo->forwardFromChannel = arguments[FORWARD];
|
||||||
servo->rate = arguments[6];
|
|
||||||
servo->forwardFromChannel = arguments[7];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1548,7 +1548,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
|
|
||||||
case MSP_SET_SERVO_CONFIGURATION:
|
case MSP_SET_SERVO_CONFIGURATION:
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
if (dataSize != 1 + sizeof(servoParam_t)) {
|
if (dataSize != 1 + 14) {
|
||||||
return MSP_RESULT_ERROR;
|
return MSP_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
i = sbufReadU8(src);
|
i = sbufReadU8(src);
|
||||||
|
@ -1559,8 +1559,6 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
servoParamsMutable(i)->max = sbufReadU16(src);
|
servoParamsMutable(i)->max = sbufReadU16(src);
|
||||||
servoParamsMutable(i)->middle = sbufReadU16(src);
|
servoParamsMutable(i)->middle = sbufReadU16(src);
|
||||||
servoParamsMutable(i)->rate = sbufReadU8(src);
|
servoParamsMutable(i)->rate = sbufReadU8(src);
|
||||||
servoParamsMutable(i)->angleAtMin = sbufReadU8(src);
|
|
||||||
servoParamsMutable(i)->angleAtMax = sbufReadU8(src);
|
|
||||||
servoParamsMutable(i)->forwardFromChannel = sbufReadU8(src);
|
servoParamsMutable(i)->forwardFromChannel = sbufReadU8(src);
|
||||||
servoParamsMutable(i)->reversedSources = sbufReadU32(src);
|
servoParamsMutable(i)->reversedSources = sbufReadU32(src);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,6 @@ void pgResetFn_servoParams(servoParam_t *instance)
|
||||||
.max = DEFAULT_SERVO_MAX,
|
.max = DEFAULT_SERVO_MAX,
|
||||||
.middle = DEFAULT_SERVO_MIDDLE,
|
.middle = DEFAULT_SERVO_MIDDLE,
|
||||||
.rate = 100,
|
.rate = 100,
|
||||||
.angleAtMin = DEFAULT_SERVO_MIN_ANGLE,
|
|
||||||
.angleAtMax = DEFAULT_SERVO_MAX_ANGLE,
|
|
||||||
.forwardFromChannel = CHANNEL_FORWARDING_DISABLED
|
.forwardFromChannel = CHANNEL_FORWARDING_DISABLED
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,8 +97,6 @@ typedef struct servoParam_s {
|
||||||
int16_t max; // servo max
|
int16_t max; // servo max
|
||||||
int16_t middle; // servo middle
|
int16_t middle; // servo middle
|
||||||
int8_t rate; // range [-125;+125] ; can be used to adjust a rate 0-125% and a direction
|
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
|
int8_t forwardFromChannel; // RX channel index, 0 based. See CHANNEL_FORWARDING_DISABLED
|
||||||
} servoParam_t;
|
} servoParam_t;
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
#define DEFAULT_SERVO_MIN 1000
|
#define DEFAULT_SERVO_MIN 1000
|
||||||
#define DEFAULT_SERVO_MIDDLE 1500
|
#define DEFAULT_SERVO_MIDDLE 1500
|
||||||
#define DEFAULT_SERVO_MAX 2000
|
#define DEFAULT_SERVO_MAX 2000
|
||||||
#define DEFAULT_SERVO_MIN_ANGLE 90
|
|
||||||
#define DEFAULT_SERVO_MAX_ANGLE 90
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RX_FRAME_PENDING = 0,
|
RX_FRAME_PENDING = 0,
|
||||||
|
|
Loading…
Reference in New Issue