Skip to content

conf_general: Fail flux linkage detection when the result is zero or negative - #987

Merged
vedderb merged 1 commit into
vedderb:masterfrom
carrollco:fix-flux-detect-result
Dec 3, 2026
Merged

vedderb merged 1 commit into
vedderb:masterfrom
carrollco:fix-flux-detect-result

Conversation

@carrollco

Copy link
Copy Markdown
Contributor

Fixes the overwrite in #986.

What changes

  • Deletes the unconditional res = true; in conf_general_detect_apply_all_foc, which overwrote both the open-loop result and the zero-or-less check.
  • Moves the <= 0 check out of the > 60 undriven-samples block, so it applies to whichever flux linkage value is selected. Same change in measure_flux_linkage_task for motor 2 on dual hardware.

Effect

  • A flux linkage of zero or less now returns -10 instead of being stored with a success.
  • It can't reject a good run: only runs whose selected flux linkage is zero or negative are refused.
  • Fault codes are handled as before.

Tested

Off the board only: with the detection functions compiled against stand-ins and a simple motor model, removing the line made both failure cases return -10 and store nothing. Moving the check is the same comparison and was read, not run. Not tested on a real motor or in a firmware build. The same bug is on release_7_00.

…negative

The unconditional res = true after the undriven check overwrote both the
open-loop result and the zero-or-less check, so -10 was never returned on
single-motor hardware (and for motor 1 on dual hardware). Check the
selected flux linkage after choosing between the driven and undriven
values, in both the single-motor path and the dual-motor task.

Refs vedderb#986
@vedderb
vedderb merged commit 4651baa into vedderb:master Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants