Add D_MIN to MSP

This commit is contained in:
Miguel Angel Mulero Martinez 2019-03-05 09:00:37 +01:00
parent 0af5c29e8f
commit 131baa2ebd
1 changed files with 28 additions and 1 deletions

View File

@ -1454,7 +1454,19 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
sbufWriteU16(dst, currentPidProfile->pid[PID_YAW].F);
sbufWriteU8(dst, currentPidProfile->antiGravityMode);
#if defined(USE_D_MIN)
sbufWriteU8(dst, currentPidProfile->d_min[PID_ROLL]);
sbufWriteU8(dst, currentPidProfile->d_min[PID_PITCH]);
sbufWriteU8(dst, currentPidProfile->d_min[PID_YAW]);
sbufWriteU8(dst, currentPidProfile->d_min_gain);
sbufWriteU8(dst, currentPidProfile->d_min_advance);
#else
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
#endif
break;
case MSP_SENSOR_CONFIG:
#if defined(USE_ACC)
@ -2093,6 +2105,21 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
currentPidProfile->antiGravityMode = sbufReadU8(src);
}
if (sbufBytesRemaining(src) >= 5) {
#if defined(USE_D_MIN)
currentPidProfile->d_min[PID_ROLL] = sbufReadU8(src);
currentPidProfile->d_min[PID_PITCH] = sbufReadU8(src);
currentPidProfile->d_min[PID_YAW] = sbufReadU8(src);
currentPidProfile->d_min_gain = sbufReadU8(src);
currentPidProfile->d_min_advance = sbufReadU8(src);
#else
sbufReadU8(src);
sbufReadU8(src);
sbufReadU8(src);
sbufReadU8(src);
sbufReadU8(src);
#endif
}
pidInitConfig(currentPidProfile);
break;