Merge pull request #6971 from etracer65/osd_ah_div0
Fix OSD artificial horizon division by zero
This commit is contained in:
commit
6adfd345db
|
@ -712,7 +712,10 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
int pitchAngle = constrain(attitude.values.pitch, -maxPitch, maxPitch);
|
||||
// Convert pitchAngle to y compensation value
|
||||
// (maxPitch / 25) divisor matches previous settings of fixed divisor of 8 and fixed max AHI pitch angle of 20.0 degrees
|
||||
pitchAngle = ((pitchAngle * 25) / maxPitch) - 41; // 41 = 4 * AH_SYMBOL_COUNT + 5
|
||||
if (maxPitch > 0) {
|
||||
pitchAngle = ((pitchAngle * 25) / maxPitch);
|
||||
}
|
||||
pitchAngle -= 41; // 41 = 4 * AH_SYMBOL_COUNT + 5
|
||||
|
||||
for (int x = -4; x <= 4; x++) {
|
||||
const int y = ((-rollAngle * x) / 64) - pitchAngle;
|
||||
|
|
Loading…
Reference in New Issue