Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions Svc/FpySequencer/FpySequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ FpySequencer ::FpySequencer(const char* const compName)
: FpySequencerComponentBase(compName),
m_sequenceBuffer(),
m_allocatorId(0),
m_sequenceFilePath("<invalid_seq>"),
m_sequenceExecArgs(),
m_fullSequenceFilePath(),
m_sequenceObj(),
m_computedCRC(),
m_totalExpectedArgSize(0),
m_sequenceBlockState(),
m_savedOpCode(0),
m_savedCmdSeq(0),
m_sequenceArgs(0, 0),
m_goalState(),
m_sequencesStarted(0),
m_statementsDispatched(0),
Expand Down Expand Up @@ -126,8 +125,13 @@ void FpySequencer::RUN_VALIDATED_cmdHandler(FwOpcodeType opCode, //!< The opcod
this->m_savedCmdSeq = cmdSeq;
}

this->sequencer_sendSignal_cmd_RUN_VALIDATED(
FpySequencer_SequenceExecutionArgs(this->m_sequenceFilePath, block, this->m_sequenceArgs));
// copy it
FpySequencer_SequenceExecutionArgs execArgs = this->m_sequenceExecArgs;
// update just the block state
// the rest should stay the same
execArgs.set_blockState(block);

this->sequencer_sendSignal_cmd_RUN_VALIDATED(execArgs);

// only respond if the user doesn't want us to block further execution
if (block == BlockState::NO_BLOCK) {
Expand Down Expand Up @@ -414,7 +418,7 @@ void FpySequencer::tlmWrite_handler(FwIndexType portNum, //!< The port number
this->tlmWrite_LastDirectiveError(this->m_tlm.lastDirectiveError);
this->tlmWrite_DirectiveErrorIndex(this->m_tlm.directiveErrorIndex);
this->tlmWrite_DirectiveErrorId(this->m_tlm.directiveErrorId);
this->tlmWrite_SeqPath(this->m_sequenceFilePath);
this->tlmWrite_SeqPath(this->m_fullSequenceFilePath);

this->tlmWrite_BreakpointIndex(this->m_breakpoint.breakpointIndex);
this->tlmWrite_BreakOnlyOnceOnBreakpoint(this->m_breakpoint.breakOnlyOnceOnBreakpoint);
Expand Down Expand Up @@ -488,7 +492,6 @@ void FpySequencer::updateDebugTelemetryStruct() {

void FpySequencer::parametersLoaded() {
parameterUpdated(PARAMID_STATEMENT_TIMEOUT_SECS);
parameterUpdated(PARAMID_SEQ_BASE_DIR);
}

void FpySequencer::parameterUpdated(FwPrmIdType id) {
Expand All @@ -498,10 +501,6 @@ void FpySequencer::parameterUpdated(FwPrmIdType id) {
this->tlmWrite_PRM_STATEMENT_TIMEOUT_SECS(this->paramGet_STATEMENT_TIMEOUT_SECS(valid));
break;
}
case PARAMID_SEQ_BASE_DIR: {
this->tlmWrite_PRM_SEQ_BASE_DIR(this->paramGet_SEQ_BASE_DIR(valid));
break;
}
default: {
FW_ASSERT(0, static_cast<FwAssertArgType>(id)); // coding error, forgot to include in switch statement
}
Expand Down
77 changes: 30 additions & 47 deletions Svc/FpySequencer/FpySequencer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,28 +258,10 @@ class FpySequencer : public FpySequencerComponentBase {
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action setSequenceFilePath of state machine Svc_FpySequencer_SequencerStateMachine
//! Implementation for action setSequenceExecArgs of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! sets the current sequence file path member var
void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal
const Svc::FpySequencer_SequenceExecutionArgs& value //!< The value
) override;

//! Implementation for action setSequenceBlockState of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! sets the block state of the sequence to be run
void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal
const Svc::FpySequencer_SequenceExecutionArgs& value //!< The value
) override;

//! Implementation for action setSequenceArguments of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! sets the arguments to pass to the sequence
void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
//! sets the sequence execution arguments (seq path, block state, seq args)
void Svc_FpySequencer_SequencerStateMachine_action_setSequenceExecArgs(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal, //!< The signal
const Svc::FpySequencer_SequenceExecutionArgs& value //!< The value
Expand Down Expand Up @@ -358,22 +340,6 @@ class FpySequencer : public FpySequencerComponentBase {
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action clearSequenceFile of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! clears all variables related to the loading/validating of the sequence file
void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action clearSequenceArguments of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! clears arguments
void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action checkShouldWake of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! checks if sequencer should wake from sleep
Expand Down Expand Up @@ -422,6 +388,15 @@ class FpySequencer : public FpySequencerComponentBase {
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action clearSequenceExecArgs of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! clears the sequence execution arguments (seq path, block state, seq args)
//! and the m_fullSequenceFilePath member var
void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceExecArgs(
SmId smId, //!< The state machine id
Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal
) override;

//! Implementation for action report_seqBroken of state machine Svc_FpySequencer_SequencerStateMachine
//!
//! reports that a breakpoint was hit
Expand Down Expand Up @@ -645,29 +620,31 @@ class FpySequencer : public FpySequencerComponentBase {
// id of allocator that gave us m_sequenceBuffer
FwEnumStoreType m_allocatorId;

// assigned by the user via cmd
// length is FileNameStringSize
Fw::FileNameString m_sequenceFilePath;
// the execution arguments of the sequence:
// * the file name
// * the block state
// * the sequence runtime args
// See the struct member docstrings for more info
Svc::FpySequencer_SequenceExecutionArgs m_sequenceExecArgs;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

to begin running the sequence, we need these three args (filename, block state and seq runtime args). Store them all in a single struct so updates to them can be "atomic"


// the full (including the SEQ_BASE_DIR prefix) path
// to the sequence file. Note: not updated until validate() is run
Fw::FileNameString m_fullSequenceFilePath;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the file name provided in the sequence exec args is not the "final" filename that we actually try to open. we need to prefix with seq base dir first.


// the sequence, loaded in memory
Fpy::Sequence m_sequenceObj;
// live running computation of CRC (updated as we read)
Utils::Hash m_computedCRC;

// Size of arguments read in current sequence. Used for validation between
// User provided arguments and what is requested of the sequence.
// user provided arguments and what is requested of the sequence.
Fpy::StackSizeType m_totalExpectedArgSize;

// whether or not the sequence we're about to run should return immediately or
// block on completion
Svc::BlockState m_sequenceBlockState;
// if we are to block on completion, save the opCode and cmdSeq we should
// return
FwOpcodeType m_savedOpCode;
U32 m_savedCmdSeq;

// sequence arguments to push to stack when entering RUNNING state
Svc::SeqArgs m_sequenceArgs{};

// the goal state is the state that we're trying to reach in the sequencer
// if it's RUNNING, then we should promptly go to RUNNING once we validate the
// sequence. if it's VALID, we should wait after VALIDATING
Expand Down Expand Up @@ -762,6 +739,12 @@ class FpySequencer : public FpySequencerComponentBase {
// Validation state
// ----------------------------------------------------------------------

// returns the base directory against which sequence file paths are resolved
// in validate(). defaults to the SEQ_BASE_DIR config constant. declared
// virtual so that unit tests (and specialized deployments) can swap out the
// base dir, since SEQ_BASE_DIR is otherwise fixed at compile time
virtual const char* getSequenceBaseDir() const;

// loads the sequence in memory, and does header/crc/integrity checks.
// return SUCCESS if sequence is valid, FAILURE otherwise
Fw::Success validate();
Expand Down
16 changes: 8 additions & 8 deletions Svc/FpySequencer/FpySequencerDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ Signal FpySequencer::exit_directiveHandler(const FpySequencer_ExitDirective& dir
}
// otherwise, kill the sequence here
// raise the user defined error code as an event
this->log_WARNING_HI_SequenceExitedWithError(this->m_sequenceFilePath, errorCode);
this->log_WARNING_HI_SequenceExitedWithError(this->m_fullSequenceFilePath, errorCode);
error = DirectiveError::EXIT_WITH_ERROR;
return Signal::stmtResponse_failure;
}
Expand Down Expand Up @@ -1602,25 +1602,25 @@ Signal FpySequencer::popEvent_directiveHandler(const FpySequencer_PopEventDirect
// Emit the appropriate event based on severity
switch (severity) {
case Fw::LogSeverity::FATAL:
this->log_FATAL_LogFatal(this->m_sequenceFilePath, messageStr);
this->log_FATAL_LogFatal(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::WARNING_HI:
this->log_WARNING_HI_LogWarningHi(this->m_sequenceFilePath, messageStr);
this->log_WARNING_HI_LogWarningHi(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::WARNING_LO:
this->log_WARNING_LO_LogWarningLo(this->m_sequenceFilePath, messageStr);
this->log_WARNING_LO_LogWarningLo(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::COMMAND:
this->log_COMMAND_LogCommand(this->m_sequenceFilePath, messageStr);
this->log_COMMAND_LogCommand(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::ACTIVITY_HI:
this->log_ACTIVITY_HI_LogActivityHi(this->m_sequenceFilePath, messageStr);
this->log_ACTIVITY_HI_LogActivityHi(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::ACTIVITY_LO:
this->log_ACTIVITY_LO_LogActivityLo(this->m_sequenceFilePath, messageStr);
this->log_ACTIVITY_LO_LogActivityLo(this->m_fullSequenceFilePath, messageStr);
break;
case Fw::LogSeverity::DIAGNOSTIC:
this->log_DIAGNOSTIC_LogDiagnostic(this->m_sequenceFilePath, messageStr);
this->log_DIAGNOSTIC_LogDiagnostic(this->m_fullSequenceFilePath, messageStr);
break;
default:
error = DirectiveError::INVALID_ARG;
Expand Down
Loading
Loading