Fix a bug that ZFC active mode isn't set when all magnets demand are 0. #3

Merged
soederqvist_a merged 1 commits from gps-zfc-active-mode-fix into main 2026-11-23 16:59:31 +01:00
Owner

set_values[] is a misused variable that is initialized to -2.0f.
It is used as a flag in certain parts of the code, and is only updated
if a magnet's demand value is set.

This causes issues when not all magnets have been set during the life
cycle of the frontend. It's supposed to transition ZFC to active mode,
once all magnet's demand values are 0. But if some haven't been set,
they aren't seen as having a 0 value and it's not transitioning ZFC
to active mode.

This PR, with as little intrusive changes, as possible solves this issue.

I also wonder why ZFC is configured from inside the magnet driver.
At GPS there is a ZFC program that already takes the strayfield values as input,
I think likewise it should take magnet values as input and handle the mode switching in there.
But doing so would probably trigger a rewrite, which probably is out of scope for current Midas project.

set_values[] is a misused variable that is initialized to -2.0f. It is used as a flag in certain parts of the code, and is only updated if a magnet's demand value is set. This causes issues when not all magnets have been set during the life cycle of the frontend. It's supposed to transition ZFC to active mode, once all magnet's demand values are 0. But if some haven't been set, they aren't seen as having a 0 value and it's not transitioning ZFC to active mode. This PR, with as little intrusive changes, as possible solves this issue. I also wonder why ZFC is configured from inside the magnet driver. At GPS there is a ZFC program that already takes the strayfield values as input, I think likewise it should take magnet values as input and handle the mode switching in there. But doing so would probably trigger a rewrite, which probably is out of scope for current Midas project.
soederqvist_a added 1 commit 2026-11-23 14:22:06 +01:00
set_values[] is a misused variable that is initized to -2.0f.
It is used as a flag in certain parts of the code, and is only updated
if a magnet's demand value is set.

This causes issues when not all magnets have be set during the life
cycle of the frontend. It's supposed to transition ZFC to active mode,
once all magnet's demand values are 0. But if some haven't been set,
they aren't seen as having a 0 value and it's not transitioning ZFC
to active mode.
soederqvist_a requested review from mathis_s 2026-11-23 14:22:19 +01:00
soederqvist_a requested review from wall_e 2026-11-23 14:22:19 +01:00
mathis_s approved these changes 2026-11-23 16:38:27 +01:00
soederqvist_a merged commit 4956152336 into main 2026-11-23 16:59:31 +01:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lin-midas-drivers/expmag#3