1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-14 11:59:56 +03:00

Merge pull request #7746 from JulioCesarMatias/MathAddNewFunction

[maths.c] Add 2D and 3D Pythagorean functions
This commit is contained in:
Paweł Spychalski 2022-02-22 11:04:09 +01:00 committed by GitHub
commit e24996e28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 42 additions and 25 deletions

View file

@ -550,7 +550,7 @@ static int logicConditionGetFlightOperandValue(int operand) {
break;
case LOGIC_CONDITION_OPERAND_FLIGHT_3D_HOME_DISTANCE: //in m
return constrain(fast_fsqrtf(sq(GPS_distanceToHome) + sq(getEstimatedActualPosition(Z)/100)), 0, INT16_MAX);
return constrain(calc_length_pythagorean_2D(GPS_distanceToHome, getEstimatedActualPosition(Z) / 100.0f), 0, INT16_MAX);
break;
case LOGIC_CONDITION_OPERAND_FLIGHT_CRSF_LQ: