Skip to content

Conversation

zimri-leisher
Copy link
Collaborator

Related Issue(s) #4049
Has Unit Tests (y/n) y
Documentation Included (y/n) y
Generative AI was used in this contribution (y/n) n

Change Description

  • Adds a "flag" system to the sequencer.
    • Flags can be modified at runtime of a sequence, by the sequence itself, or by ground command
    • Flags get set to a default value at the beginning of running a sequence.
      • The default value is configurable via param
  • Adds SET_FLAG and GET_FLAG directives
    • These allow sequences to access and modify the value of flags during execution of a sequence
  • Add the EXIT_ON_CMD_FAIL flag
    • Default to false
    • If true, the sequence will immediately end if a command fails

@zimri-leisher
Copy link
Collaborator Author

@LeStarch this is ready for review

@zimri-leisher zimri-leisher requested a review from LeStarch October 3, 2025 04:27
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
return;
}

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter opCode has not been checked.
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
return;
}

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter cmdSeq has not been checked.
this->m_runtime.flags[flag.e] = value;

this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter value has not been checked.
this->paramGet_FLAG_DEFAULT_EXIT_ON_CMD_FAIL(valid);
FW_ASSERT(valid != Fw::ParamValid::INVALID && valid != Fw::ParamValid::UNINIT,
static_cast<FwAssertArgType>(valid.e));
}

Check warning

Code scanning / CodeQL

Unchecked return value Warning

The return value of non-void function
paramGet_FLAG_DEFAULT_EXIT_ON_CMD_FAIL
is not checked.
this->push<U8>(flagVal);
return Signal::stmtResponse_success;
}
} // namespace Svc

Check warning

Code scanning / CodeQL

Unchecked return value Warning

The return value of non-void function
operator=
is not checked.
break;
}
case Fpy::DirectiveId::SET_FLAG: {
new (&deserializedDirective.setFlag) FpySequencer_SetFlagDirective();

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter deserializedDirective has not been checked.
break;
}
case Fpy::DirectiveId::GET_FLAG: {
new (&deserializedDirective.getFlag) FpySequencer_GetFlagDirective();

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter deserializedDirective has not been checked.
return;
}
case Fpy::DirectiveId::SET_FLAG: {
this->directive_setFlag_internalInterfaceInvoke(directive.setFlag);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter directive has not been checked.
return;
}
case Fpy::DirectiveId::GET_FLAG: {
this->directive_getFlag_internalInterfaceInvoke(directive.getFlag);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter directive has not been checked.
void FpySequencer::SET_FLAG_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
Svc::Fpy::FlagId flag,
bool value) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
if (directive.get_flagIdx() >= Fpy::FLAG_COUNT) {
error = DirectiveError::FLAG_IDX_OUT_OF_BOUNDS;
return Signal::stmtResponse_failure;
}

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
if (directive.get_flagIdx() >= Fpy::FLAG_COUNT) {
error = DirectiveError::FLAG_IDX_OUT_OF_BOUNDS;
return Signal::stmtResponse_failure;
}

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@LeStarch
Copy link
Collaborator

LeStarch commented Oct 8, 2025

@zimri-leisher merge of the last PR created conflicts here. Would you take a look? They aren't trivial.

Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally some comments to answer.

// this is a sanity check, we shouldn't even get here if this isn't true
// because the enum should check for validity and raise a format err if not valid.
// actually what this really catches is an incorrect FLAG_COUNT value
FW_ASSERT(static_cast<I32>(flag.e) < Fpy::FLAG_COUNT, static_cast<FwAssertArgType>(flag.e));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use an I32 here, I see 8-bits below.

Copy link
Collaborator Author

@zimri-leisher zimri-leisher Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the args to < will be converted to 32 bit types implicitly, this just makes it explicit.

@zimri-leisher
Copy link
Collaborator Author

@LeStarch feedback responded to

//! Internal interface handler for directive_setFlag
void FpySequencer::directive_setFlag_internalInterfaceHandler(const Svc::FpySequencer_SetFlagDirective& directive) {
DirectiveError error = DirectiveError::NO_ERROR;
this->sendSignal(this->setFlag_directiveHandler(directive, error));

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter directive has not been checked.
//! Internal interface handler for directive_getFlag
void FpySequencer::directive_getFlag_internalInterfaceHandler(const Svc::FpySequencer_GetFlagDirective& directive) {
DirectiveError error = DirectiveError::NO_ERROR;
this->sendSignal(this->getFlag_directiveHandler(directive, error));

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter directive has not been checked.
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