Skip to content

Commit

Permalink
Update sdd, change event from low to high, static cast a portnum
Browse files Browse the repository at this point in the history
  • Loading branch information
zimri-leisher committed Aug 28, 2024
1 parent c7b324c commit f7c4108
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 50 deletions.
6 changes: 3 additions & 3 deletions Svc/SeqDispatcher/SeqDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void SeqDispatcher::seqStartIn_handler(
// uh oh. m_sequencesRunning is wrong
// let's just update it to be correct. nothing we can do about
// it except raise a warning and update our state
this->log_WARNING_HI_UnexpectedSequenceStarted(portNum, fileName, this->m_entryTable[portNum].sequenceRunning);
this->log_WARNING_HI_UnexpectedSequenceStarted(static_cast<U16>(portNum), fileName, this->m_entryTable[portNum].sequenceRunning);
this->m_entryTable[portNum].sequenceRunning = fileName;
}
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ void SeqDispatcher::seqRunIn_handler(NATIVE_INT_TYPE portNum,
FwIndexType idx = this->getNextAvailableSequencerIdx();

Check notice

Code scanning / CodeQL

Use of basic integral type Note

idx uses the basic integral type int rather than a typedef with size and signedness.
// no available sequencers
if (idx == -1) {
this->log_WARNING_LO_NoAvailableSequencers();
this->log_WARNING_HI_NoAvailableSequencers();
return;
}
if (!this->runSequence(idx, fileName,
Expand All @@ -169,7 +169,7 @@ void SeqDispatcher ::RUN_cmdHandler(const FwOpcodeType opCode,
FwIndexType idx = this->getNextAvailableSequencerIdx();

Check notice

Code scanning / CodeQL

Use of basic integral type Note

idx uses the basic integral type int rather than a typedef with size and signedness.
// no available sequencers
if (idx == -1) {
this->log_WARNING_LO_NoAvailableSequencers();
this->log_WARNING_HI_NoAvailableSequencers();
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter opCode has not been checked.

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter cmdSeq has not been checked.
return;
}
Expand Down
5 changes: 3 additions & 2 deletions Svc/SeqDispatcher/SeqDispatcher.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ module Svc {
include "SeqDispatcherTelemetry.fppi"
include "SeqDispatcherEvents.fppi"

@ Dispatches a sequence to the first available command sequencer
async input port seqRunIn: Svc.CmdSeqIn

output port seqRunOut: [SeqDispatcherSequencerPorts] Svc.CmdSeqIn

@ Called by a command sequencer whenever it has finished any sequence
async input port seqDoneIn: [SeqDispatcherSequencerPorts] Fw.CmdResponse

# should be called by cmdsequencer whenever it starts a sequence (whether
# called by SeqDisp or manually by ground)
@ Called by cmdsequencer whenever it starts any sequence
async input port seqStartIn: [SeqDispatcherSequencerPorts] Svc.CmdSeqIn

match seqRunOut with seqDoneIn
Expand Down
2 changes: 2 additions & 0 deletions Svc/SeqDispatcher/SeqDispatcherCommands.fppi
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@ Dispatches a sequence to the first available sequencer
async command RUN(
fileName: string size 240 @< The name of the sequence file
$block: Fw.Wait @< Return command status when complete or not
) \
opcode 0

@ Logs via Events the state of each connected command sequencer
async command LOG_STATUS() opcode 1
2 changes: 1 addition & 1 deletion Svc/SeqDispatcher/SeqDispatcherEvents.fppi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ event InvalidSequencer(
format "Invalid sequence index {}"

event NoAvailableSequencers() \
severity warning low \
severity warning high \
format "No available cmd sequencers to dispatch a sequence to"

event UnknownSequenceFinished(
Expand Down
70 changes: 26 additions & 44 deletions Svc/SeqDispatcher/docs/sdd.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,48 @@
# components::SeqDispatcher

Dispatches command sequences to available command sequencers
Dispatches command sequences to available command sequencers, allowing the spacecraft controllers to run multiple sequences at once without having to manually manage which `CmdSequencer`s those sequences run on.

## Usage Examples
Add usage examples here

### Diagrams
Add diagrams here

### Typical Usage
And the typical usage of the component here

## Class Diagram
Add a class diagram here
### Usage
* Call the `RUN` command just like you would call it on a `CmdSequencer`
* If any connected `CmdSequencer` is available, it will route the sequence to the first one it finds
* `RUN` can be made blocking or non-blocking, just like `CmdSequencer`'s `RUN`

## Port Descriptions
| Name | Description |
|---|---|
|---|---|

## Component States
Add component states in the chart below
| Name | Description |
|---|---|
|---|---|

## Sequence Diagrams
Add sequence diagrams here

## Parameters
| Name | Description |
|---|---|
|---|---|
|Type| Name | Description |
|async input|seqRunIn|Equivalent to the RUN cmd, dispatches a sequence to the first available sequencer|
|output|seqRunOut|This is used by the SeqDispatcher to send sequence run calls to sequencers|
|async input|seqDoneIn|Called by a command sequencer whenever it has finished any sequence|
|async input|seqStartIn|Called by a command sequencer whenever it starts any sequence|

## Commands
| Name | Description |
|---|---|
|---|---|
|RUN|Dispatches a sequence to the first available sequencer|
|LOG_STATUS|Logs via Events the state of each connected command sequencer|

## Events
| Name | Description |
|---|---|
|---|---|
|InvalidSequencer|The given sequencer index is invalid for an unspecified reason|
|NoAvailableSequencers|There are no available sequencers to dispatch a sequence to|
|UnknownSequenceFinished|We received a call to seqDoneIn that didn't have a corresponding seqStartIn call|
|UnexpectedSequenceStarted|We received a call to seqStartIn but we didn't receive a call to seqDoneIn before that|
|LogSequencerStatus|Shows the current state and sequence filename for a particular sequencer. Produced by the LOG_STATUS command|



## Telemetry
| Name | Description |
|---|---|
|---|---|
|dispatchedCount|Number of sequences dispatched|
|errorCount|Number of sequences dispatched that returned an error. Note: if a sequence was run in non-blocking mode, even if the sequence errors out, this error count will never increase|
|sequencersAvailable|Number of sequencers ready to run a sequence|

## Unit Tests
Add unit test descriptions in the chart below
| Name | Description | Output | Coverage |
|---|---|---|---|
|---|---|---|---|
| Name | Description |
|testDispatch|Tests the basic dispatch functionality of the `SeqDispatcher`|
|testLogStatus|Tests the LOG_STATUS command|

## Requirements
Add requirements in the chart below
| Name | Description | Validation |
|---|---|---|
|---|---|---|

## Change Log
| Date | Description |
|---|---|
|---| Initial Draft |
|---|---|---|

0 comments on commit f7c4108

Please sign in to comment.