-
Notifications
You must be signed in to change notification settings - Fork 1.7k
add arc functions to ipf #11179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: maintenance-10.x
Are you sure you want to change the base?
add arc functions to ipf #11179
Changes from all commits
e672d23
15fc53a
3e4efe1
82021b5
711d181
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: PR Branch Suggestion | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened] | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| suggest-branch: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| steps: | ||
| - name: Suggest maintenance branch | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const comment = `### 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.*`; | ||
|
|
||
| try { | ||
| await github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: comment | ||
| }); | ||
| } catch (err) { | ||
| core.setFailed(`Failed to post suggestion comment: ${err}`); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -404,6 +404,20 @@ static int logicConditionCompute( | |||||||||||||||||||||||||||||||||||||||||
| return tan_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; | ||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| case LOGIC_CONDITION_ACOS: | ||||||||||||||||||||||||||||||||||||||||||
| temporaryValue = (operandB == 0) ? 1000 : operandB; | ||||||||||||||||||||||||||||||||||||||||||
| return RADIANS_TO_DEGREES(acos_approx(constrainf((float)operandA / (float)temporaryValue, -1.0f, 1.0f))); | ||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| case LOGIC_CONDITION_ASIN: | ||||||||||||||||||||||||||||||||||||||||||
| temporaryValue = (operandB == 0) ? 1000 : operandB; | ||||||||||||||||||||||||||||||||||||||||||
| return RADIANS_TO_DEGREES(asin_approx(constrainf((float)operandA / (float)temporaryValue, -1.0f, 1.0f))); | ||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+407
to
+415
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Use a float denominator (with a safe default) and compute the clamped ratio once to avoid repeated casts and make the boundary behavior explicit and consistent. [Learned best practice, importance: 5]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| case LOGIC_CONDITION_ATAN2: | ||||||||||||||||||||||||||||||||||||||||||
| return RADIANS_TO_DEGREES(atan2_approx((float)operandA, (float)operandB)); | ||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+417
to
+419
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Normalize the returned degrees to a defined range (e.g., (-180, 180]) and add an explicit fallback for the (0,0) input so consumers don't depend on undefined/implementation-specific angle conventions. [Learned best practice, importance: 6]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| case LOGIC_CONDITION_MIN: | ||||||||||||||||||||||||||||||||||||||||||
| return (operandA < operandB) ? operandA : operandB; | ||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Correct the
LOGIC_CONDITION_ASINimplementation, which currently computesACOSinstead ofASIN, by applying theacos_to_asin_approxmacro to the result. [possible issue, importance: 9]