mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +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
|
@ -77,6 +77,7 @@
|
|||
#include "flight/mixer.h"
|
||||
#include "flight/pid.h"
|
||||
#include "flight/servos.h"
|
||||
#include "flight/ez_tune.h"
|
||||
|
||||
#include "config/config_eeprom.h"
|
||||
#include "config/feature.h"
|
||||
|
@ -1583,6 +1584,24 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
break;
|
||||
#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:
|
||||
return false;
|
||||
}
|
||||
|
@ -3040,6 +3059,30 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
break;
|
||||
#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:
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue