Fix copy of profiles with last index

This commit is contained in:
Miguel Angel Mulero Martinez 2019-05-22 13:56:37 +02:00
parent e7e65ae00e
commit 7801b848d4
1 changed files with 2 additions and 3 deletions

View File

@ -741,9 +741,8 @@ float pidApplyThrustLinearization(float motorOutput)
void pidCopyProfile(uint8_t dstPidProfileIndex, uint8_t srcPidProfileIndex)
{
if ((dstPidProfileIndex < PID_PROFILE_COUNT-1 && srcPidProfileIndex < PID_PROFILE_COUNT-1)
&& dstPidProfileIndex != srcPidProfileIndex
) {
if (dstPidProfileIndex < PID_PROFILE_COUNT && srcPidProfileIndex < PID_PROFILE_COUNT
&& dstPidProfileIndex != srcPidProfileIndex) {
memcpy(pidProfilesMutable(dstPidProfileIndex), pidProfilesMutable(srcPidProfileIndex), sizeof(pidProfile_t));
}
}