Skip to content

Fix #114: remove redundant initial state check in LC_SampleAPs - #140

Open
philphauler wants to merge 3 commits into
nasa:devfrom
philphauler:fix-114-v2
Open

philphauler wants to merge 3 commits into
nasa:devfrom
philphauler:fix-114-v2

Conversation

@philphauler

Copy link
Copy Markdown

Summary

Remove the redundant guard on the starting AP state in LC_SampleAPs.

Problem

LC_SampleAPs(StartIndex, EndIndex) checks ARTPtr[StartIndex].CurrentState
before entering the sampling loop. If the first AP is PERMOFF or NOT_USED,
the entire range is skipped and an error event is emitted -- even though
subsequent APs in the range may be operational.

LC_SampleSingleAP already checks each AP state individually, making this
pre-check redundant and harmful when a range begins with a disabled AP.

Fix

Remove the pre-check. Let LC_SampleSingleAP handle per-AP state filtering
for each action point in the range. Net deletion of 21 lines.

The guard on the starting AP's state prevented sampling the entire
range when the first AP happened to be PERMOFF or NOT_USED.
LC_SampleSingleAP already checks each AP's state individually,
making this pre-check redundant and harmful.
@philphauler

Copy link
Copy Markdown
Author

Removes a redundant initial-state check that LC_SampleSingleAP already handles per-AP. 6 lines added, 27 removed. No behavioral change — the per-AP handler covers all cases.

@dzbaker

dzbaker commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@philphauler Thank you for your contribution. Please resolve the workflow failures.

@philphauler

Copy link
Copy Markdown
Author

Already onnit 🫡🙏

philphauler and others added 2 commits September 17, 2026 18:01
…check

LC_SampleAPs no longer sends LC_APSAMPLE_CURR_ERR_EID when the starting
actionpoint is NOT_USED or PERMOFF; LC_SampleSingleAP already ignores
those states internally (only ACTIVE/PASSIVE are sampled), so the loop
just skips them silently. Update
LC_SampleAPs_Test_SingleActionPointError and
LC_SampleAPs_Test_SingleActionPointPermOff to assert zero events sent
instead of the removed error event, matching current behavior.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDRvC9ePDP3i6xpxFAECFg
@philphauler

Copy link
Copy Markdown
Author

Tracked the coverage failure down 🔍 the two LC_SampleAPs error-state tests (lc_action_tests.c:81 and the PermOff one) still expected the LC_APSAMPLE_CURR_ERR_EID event this PR removes on purpose, since LC_SampleSingleAP already skips non-ACTIVE/PASSIVE actionpoints quietly. Updated both tests to assert no event is sent, merged the latest dev in with a merge commit, and pushed 51a1d61.

Locally (cFS dev bundle, native_eds): 100% tests passed, 0 tests failed out of 7, and lc_action.c sits at 100% lines / 100% branches under gcov.

The Build Documentation failure is unrelated to this PR: it is the doxygen \SB_DELPIPEEC warning from cfe/modules/sb/config/default_cfe_sb_msgdefs.h, which is still present on current dev. Left that alone 🚀

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