1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-18 22:05:15 +03:00

Added deadband to fixedWingPitchToThrottleCorrection for testing

This commit is contained in:
Airwide 2020-09-05 23:26:34 +02:00
parent 19e882fea3
commit 9ef10703de

View file

@ -463,7 +463,20 @@ int16_t applyFixedWingMinSpeedController(timeUs_t currentTimeUs)
int16_t fixedWingPitchToThrottleCorrection(int16_t pitch) int16_t fixedWingPitchToThrottleCorrection(int16_t pitch)
{ {
return DECIDEGREES_TO_DEGREES(pitch) * navConfig()->fw.pitch_to_throttle; const int16_t pitch_to_throttle_deadband = 30;
if (pitch > pitch_to_throttle_deadband) {
// Above positive pitch deadband
return DECIDEGREES_TO_DEGREES(pitch - pitch_to_throttle_deadband) * navConfig()->fw.pitch_to_throttle;
}
else if (pitch < -pitch_to_throttle_deadband) {
// Below negative pitch deadband
return DECIDEGREES_TO_DEGREES(pitch + pitch_to_throttle_deadband) * navConfig()->fw.pitch_to_throttle;
}
else {
// Inside deadband
return 0;
}
} }
void applyFixedWingPitchRollThrottleController(navigationFSMStateFlags_t navStateFlags, timeUs_t currentTimeUs) void applyFixedWingPitchRollThrottleController(navigationFSMStateFlags_t navStateFlags, timeUs_t currentTimeUs)