mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
Add EZ Tune MSP frames
This commit is contained in:
parent
0d3216ef07
commit
e772d085cd
3 changed files with 46 additions and 0 deletions
|
@ -64,6 +64,7 @@
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
#include "flight/imu.h"
|
#include "flight/imu.h"
|
||||||
#include "flight/failsafe.h"
|
#include "flight/failsafe.h"
|
||||||
|
#include "flight/ez_tune.h"
|
||||||
|
|
||||||
#include "fc/config.h"
|
#include "fc/config.h"
|
||||||
#include "fc/controlrate_profile.h"
|
#include "fc/controlrate_profile.h"
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
#include "flight/mixer.h"
|
#include "flight/mixer.h"
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
#include "flight/servos.h"
|
#include "flight/servos.h"
|
||||||
|
#include "flight/ez_tune.h"
|
||||||
|
|
||||||
#include "config/config_eeprom.h"
|
#include "config/config_eeprom.h"
|
||||||
#include "config/feature.h"
|
#include "config/feature.h"
|
||||||
|
@ -1583,6 +1584,24 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_EZ_TUNE
|
||||||
|
|
||||||
|
case MSP2_INAV_EZ_TUNE:
|
||||||
|
{
|
||||||
|
sbufWriteU8(dst, ezTune()->enabled);
|
||||||
|
sbufWriteU16(dst, ezTune()->filterHz);
|
||||||
|
sbufWriteU8(dst, ezTune()->axisRatio);
|
||||||
|
sbufWriteU8(dst, ezTune()->response);
|
||||||
|
sbufWriteU8(dst, ezTune()->damping);
|
||||||
|
sbufWriteU8(dst, ezTune()->stability);
|
||||||
|
sbufWriteU8(dst, ezTune()->aggressiveness);
|
||||||
|
sbufWriteU8(dst, ezTune()->rate);
|
||||||
|
sbufWriteU8(dst, ezTune()->expo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3040,6 +3059,30 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_EZ_TUNE
|
||||||
|
|
||||||
|
case MSP2_INAV_EZ_TUNE_SET:
|
||||||
|
{
|
||||||
|
if (dataSize == 10) {
|
||||||
|
ezTuneMutable()->enabled = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->filterHz = sbufReadU16(src);
|
||||||
|
ezTuneMutable()->axisRatio = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->response = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->damping = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->stability = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->aggressiveness = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->rate = sbufReadU8(src);
|
||||||
|
ezTuneMutable()->expo = sbufReadU8(src);
|
||||||
|
|
||||||
|
ezTuneUpdate();
|
||||||
|
} else {
|
||||||
|
return MSP_RESULT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MSP_RESULT_ERROR;
|
return MSP_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,3 +92,5 @@
|
||||||
#define MSP2_INAV_LED_STRIP_CONFIG_EX 0x2048
|
#define MSP2_INAV_LED_STRIP_CONFIG_EX 0x2048
|
||||||
#define MSP2_INAV_SET_LED_STRIP_CONFIG_EX 0x2049
|
#define MSP2_INAV_SET_LED_STRIP_CONFIG_EX 0x2049
|
||||||
|
|
||||||
|
#define MSP2_INAV_EZ_TUNE 0x2050
|
||||||
|
#define MSP2_INAV_EZ_TUNE_SET 0x2051
|
Loading…
Add table
Add a link
Reference in a new issue