Merge remote-tracking branch 'refs/remotes/origin/master' into PID-Improved
This commit is contained in:
commit
8b511b1098
@ -83,6 +83,6 @@ void Error_Handler(void);
|
|||||||
|
|
||||||
uint8_t reverse(uint8_t byte);
|
uint8_t reverse(uint8_t byte);
|
||||||
|
|
||||||
uint16_t constrain(uint16_t value, uint16_t min, uint16_t max);
|
int16_t constrain(int16_t value, int16_t min, int16_t max);
|
||||||
|
|
||||||
#endif /* UTILITIES_H_ */
|
#endif /* UTILITIES_H_ */
|
||||||
|
@ -199,14 +199,16 @@ void mix()
|
|||||||
PidProfile[PID_ID_GYRO].PID_Out[YAW] * mixerUAV[i].yaw * ((mixerConfig.yaw_reverse_direction) ? -1 : 1);
|
PidProfile[PID_ID_GYRO].PID_Out[YAW] * mixerUAV[i].yaw * ((mixerConfig.yaw_reverse_direction) ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MOTOR_COUNT; i++)
|
|
||||||
// Find the minimum and maximum motor output
|
|
||||||
if (RPY_Mix[i] < RPY_Mix_Min) RPY_Mix_Min = RPY_Mix[i];
|
|
||||||
|
|
||||||
|
|
||||||
/* Mixer Low Scale - Scaling output around low throttle */
|
/* Mixer Low Scale - Scaling output around low throttle */
|
||||||
if (flags_IsSet_ID(systemFlags_mixerlowscale_id))
|
if (flags_IsSet_ID(systemFlags_mixerlowscale_id))
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < MOTOR_COUNT; i++)
|
||||||
|
// Find the minimum and maximum motor output
|
||||||
|
if (RPY_Mix[i] < RPY_Mix_Min) RPY_Mix_Min = RPY_Mix[i];
|
||||||
|
|
||||||
uint16_t RPY_Mix_Min_Overshoot = (RPY_Mix_Min < mixerConfig.minThrottle) ? mixerConfig.minThrottle - RPY_Mix_Min : 0;
|
uint16_t RPY_Mix_Min_Overshoot = (RPY_Mix_Min < mixerConfig.minThrottle) ? mixerConfig.minThrottle - RPY_Mix_Min : 0;
|
||||||
|
|
||||||
if (RPY_Mix_Min_Overshoot > 0 ) //|| RPY_Mix_Max_Overshoot > 0)
|
if (RPY_Mix_Min_Overshoot > 0 ) //|| RPY_Mix_Max_Overshoot > 0)
|
||||||
@ -221,10 +223,11 @@ void mix()
|
|||||||
for (int i = 0; i < MOTOR_COUNT; i++)
|
for (int i = 0; i < MOTOR_COUNT; i++)
|
||||||
RPY_Mix[i] = (((float)(RPY_Mix[i] - throttle)) * (1 - mix_scale_reduction)) + throttle;
|
RPY_Mix[i] = (((float)(RPY_Mix[i] - throttle)) * (1 - mix_scale_reduction)) + throttle;
|
||||||
}
|
}
|
||||||
|
/* Recalculating RPY_Mix_Min */
|
||||||
|
RPY_Mix_Min = throttleMid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recalculating RPY_Mix_Min */
|
|
||||||
RPY_Mix_Min = throttleMid;
|
|
||||||
|
|
||||||
for (int i = 0; i < MOTOR_COUNT; i++)
|
for (int i = 0; i < MOTOR_COUNT; i++)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ uint8_t reverse(uint8_t byte)
|
|||||||
return byte;
|
return byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t constrain(uint16_t value, uint16_t min, uint16_t max)
|
int16_t constrain(int16_t value, int16_t min, int16_t max)
|
||||||
{
|
{
|
||||||
if (value < min)
|
if (value < min)
|
||||||
return min;
|
return min;
|
||||||
|
Reference in New Issue
Block a user