Some changes to yaw inversion and changed some possible negative ints to int
This commit is contained in:
parent
33398e756c
commit
20f006a0ca
@ -45,7 +45,7 @@ typedef struct {
|
||||
uint16_t minCheck; // In Non Airmode: If throttle is below minCheck we set motors to minCommand
|
||||
bool pid_at_min_throttle; // When enabled PIDs are used at minimum throttle
|
||||
bool motorstop; // If enabled motors will stop spinning at no throttle when Armed
|
||||
uint8_t yaw_motor_direction; // Default should be 1. Can be either -1 or 1
|
||||
bool yaw_reverse_direction; // Default should be 1. Can be either -1 or 1
|
||||
} mixerConfig_s;
|
||||
|
||||
/* Global mixerConfig to bee available to EEPROM */
|
||||
|
@ -93,7 +93,7 @@ void mix()
|
||||
/* Calculate what "hover" could be. Not used now but might be useful later */
|
||||
//uint16_t throttleIdle = mixerConfig.minThrottle + (throttleRange / 2);
|
||||
|
||||
uint16_t RPY_Mix[MOTOR_COUNT]; // Roll Pitch and Yaw variables array
|
||||
int16_t RPY_Mix[MOTOR_COUNT]; // Roll Pitch and Yaw variables array
|
||||
uint16_t RPY_Mix_Min = 0; // Stores the minimum desired command for any motor
|
||||
uint16_t RPY_Mix_Max = 0; // Maximum desired command for any motor
|
||||
uint16_t throttle = sbusChannelData.chan3; // Import throttle value from remote
|
||||
@ -111,7 +111,7 @@ void mix()
|
||||
RPY_Mix[i] = \
|
||||
PID_Out[PITCH] * mixerUAV[i].pitch + \
|
||||
PID_Out[ROLL] * mixerUAV[i].roll + \
|
||||
PID_Out[YAW] * mixerUAV[i].yaw * mixerConfig.yaw_motor_direction;
|
||||
PID_Out[YAW] * mixerUAV[i].yaw * ((mixerConfig.yaw_reverse_direction) ? -1 : 1);
|
||||
|
||||
// Update min and max values
|
||||
if (RPY_Mix[i] > RPY_Mix_Max) RPY_Mix_Max = RPY_Mix[i];
|
||||
@ -167,13 +167,13 @@ void mix()
|
||||
throttle * mixerUAV[i].throttle + \
|
||||
PID_Out[PITCH] * mixerUAV[i].pitch + \
|
||||
PID_Out[ROLL] * mixerUAV[i].roll + \
|
||||
PID_Out[YAW] * mixerUAV[i].yaw * mixerConfig.yaw_motor_direction;
|
||||
PID_Out[YAW] * mixerUAV[i].yaw * ((mixerConfig.yaw_reverse_direction) ? -1 : 1);
|
||||
|
||||
// Find the maximum motor output
|
||||
if (RPY_Mix[i] > maxMotor) maxMotor = RPY_Mix[i];
|
||||
}
|
||||
|
||||
uint16_t maxThrottleDifference = 0;
|
||||
int16_t maxThrottleDifference = 0;
|
||||
if (maxMotor > mixerConfig.maxThrottle)
|
||||
maxThrottleDifference = maxMotor - mixerConfig.maxThrottle;
|
||||
|
||||
|
Reference in New Issue
Block a user