1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 09:45:33 +03:00

MSP support for sensor alignment

This commit is contained in:
NightHawk32 2015-12-14 18:08:13 -05:00 committed by Dominic Clifton
parent 534b79236f
commit c1407a7bcb
2 changed files with 20 additions and 1 deletions

View file

@ -92,6 +92,7 @@ static serialPort_t *mspSerialPort;
extern uint16_t cycleTime; // FIXME dependency on mw.c
extern uint16_t rssi; // FIXME dependency on mw.c
extern void resetPidProfile(pidProfile_t *pidProfile);
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, escAndServoConfig_t *escAndServoConfigToUse, pidProfile_t *pidProfileToUse);
@ -301,6 +302,8 @@ static const char * const boardIdentifier = TARGET_BOARD_IDENTIFIER;
#define MSP_SET_NAV_CONFIG 215 //in message Sets nav config parameters - write to the eeprom
#define MSP_SET_3D 217 //in message Settings needed for reversible ESCs
#define MSP_SET_RC_DEADBAND 218 //in message deadbands for yaw alt pitch roll
#define MSP_SET_RESET_CURR_PID 219 //in message resetting the current pid profile to defaults
#define MSP_SET_SENSOR_ALIGNMENT 220 //in message set the orientation of the acc,gyro,mag
// #define MSP_BIND 240 //in message no param
@ -1292,6 +1295,12 @@ static bool processOutCommand(uint8_t cmdMSP)
serialize8(currentProfile->rcControlsConfig.yaw_deadband);
serialize8(currentProfile->rcControlsConfig.alt_hold_deadband);
break;
case MSP_SENSOR_ALIGNMENT:
headSerialReply(3);
serialize8(masterConfig.sensorAlignmentConfig.gyro_align);
serialize8(masterConfig.sensorAlignmentConfig.acc_align);
serialize8(masterConfig.sensorAlignmentConfig.mag_align);
break;
default:
return false;
@ -1527,6 +1536,16 @@ static bool processInCommand(void)
currentProfile->rcControlsConfig.yaw_deadband = read8();
currentProfile->rcControlsConfig.alt_hold_deadband = read8();
break;
case MSP_SET_RESET_CURR_PID:
resetPidProfile(&currentProfile->pidProfile);
break;
case MSP_SET_SENSOR_ALIGNMENT:
masterConfig.sensorAlignmentConfig.gyro_align = read8();
masterConfig.sensorAlignmentConfig.acc_align = read8();
masterConfig.sensorAlignmentConfig.mag_align = read8();
break;
case MSP_RESET_CONF:
if (!ARMING_FLAG(ARMED)) {