Merge remote-tracking branch 'refs/remotes/origin/master' into PID-Improved

This commit is contained in:
johan9107 2016-10-25 10:19:56 +02:00
commit 8b511b1098
3 changed files with 10 additions and 7 deletions

View File

@ -83,6 +83,6 @@ void Error_Handler(void);
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_ */

View File

@ -199,14 +199,16 @@ void mix()
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 */
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;
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++)
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++)
{

View File

@ -219,7 +219,7 @@ uint8_t reverse(uint8_t 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)
return min;