Skip to content

add arc functions to ipf#11179

Merged
sensei-hacker merged 4 commits intoiNavFlight:maintenance-10.xfrom
xznhj8129:ipf_trig
Apr 11, 2026
Merged

add arc functions to ipf#11179
sensei-hacker merged 4 commits intoiNavFlight:maintenance-10.xfrom
xznhj8129:ipf_trig

Conversation

@xznhj8129
Copy link
Copy Markdown
Contributor

@xznhj8129 xznhj8129 commented Dec 14, 2025

User description

Added asin/acos/atan2 functions to IPF

@github-actions
Copy link
Copy Markdown

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@xznhj8129 xznhj8129 marked this pull request as ready for review December 17, 2025 20:51
@xznhj8129 xznhj8129 changed the base branch from master to maintenance-10.x December 17, 2025 20:51
@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Dec 17, 2025

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

Comment thread src/main/programming/logic_condition.c
Comment thread src/main/programming/logic_condition.c
Comment thread src/main/programming/logic_condition.c
@sensei-hacker sensei-hacker added this to the 10.0 milestone Feb 8, 2026
@github-actions
Copy link
Copy Markdown

Test firmware build ready — commit b54ff13

Download firmware for PR #11179

228 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@sensei-hacker
Copy link
Copy Markdown
Member

sensei-hacker commented Apr 10, 2026

Note: This comment was generated by an automated code review system.

Thanks for adding trig inverse functions to IPF — these enable useful bearing and arc calculations in logic conditions.

A two issues were found that should be addressed before merge:


Critical: Opcode number mismatch between code and docs

The documentation assigns ACOS=57, ASIN=58, ATAN2=59. However, if LOGIC_CONDITION_SET_ALTITUDE_TARGET = 57 already exists in the target branch, the actual enum values would be 58, 59, 60.

IPF opcodes are persisted in EEPROM. A doc/code mismatch means users following the documentation will silently get wrong behavior, and correctly-configured craft could behave incorrectly after a firmware upgrade. Please verify the enum values against the target branch and update whichever side is wrong.


Minor: ATAN2 output range not documented

atan2_approx returns values in the range (-180°, 180°]. The docs should state this explicitly so users don't assume [0°, 360°) when computing bearings.


Bot concern refuted

The Qodo bot flagged ASIN (importance 9) as computing ACOS instead of ASIN. This is incorrect — the implementation correctly calls asin_approx. Furthermore, the bot's suggested fix references acos_to_asin_approx, a macro that does not exist in the INAV codebase. Do not apply that suggestion.

@xznhj8129
Copy link
Copy Markdown
Contributor Author

Note: This comment was generated by an automated code review system.

Thanks for adding trig inverse functions to IPF — these enable useful bearing and arc calculations in logic conditions.

A two issues were found that should be addressed before merge:

Critical: Opcode number mismatch between code and docs

The documentation assigns ACOS=57, ASIN=58, ATAN2=59. However, if LOGIC_CONDITION_SET_ALTITUDE_TARGET = 57 already exists in the target branch, the actual enum values would be 58, 59, 60.

IPF opcodes are persisted in EEPROM. A doc/code mismatch means users following the documentation will silently get wrong behavior, and correctly-configured craft could behave incorrectly after a firmware upgrade. Please verify the enum values against the target branch and update whichever side is wrong.

Minor: ATAN2 output range not documented

atan2_approx returns values in the range (-180°, 180°]. The docs should state this explicitly so users don't assume [0°, 360°) when computing bearings.

Bot concern refuted

The Qodo bot flagged ASIN (importance 9) as computing ACOS instead of ASIN. This is incorrect — the implementation correctly calls asin_approx. Furthermore, the bot's suggested fix references acos_to_asin_approx, a macro that does not exist in the INAV codebase. Do not apply that suggestion.

Gotcha, small drift because we've been adding a few logic conditions in other merges. Fixed.

@sensei-hacker sensei-hacker merged commit 94fd8cb into iNavFlight:maintenance-10.x Apr 11, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants