Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding NaN, Infinity, and negative Infinity #2131

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions Ref/Top/RefPackets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
<channel name="typeDemo.ExtraChoicesCh"/>
<channel name="typeDemo.ChoicePairCh"/>
<channel name="typeDemo.ChoiceSlurryCh"/>
<channel name="typeDemo.Float1Ch"/>
<channel name="typeDemo.Float2Ch"/>
<channel name="typeDemo.Float3Ch"/>
<channel name="typeDemo.FloatSet"/>
</packet>

<!-- Ignored packets -->
Expand Down
12 changes: 12 additions & 0 deletions Ref/TypeDemo/TypeDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,16 @@ void TypeDemo ::DUMP_TYPED_PARAMETERS_cmdHandler(const FwOpcodeType opCode, cons
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

void TypeDemo ::DUMP_FLOATS_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {
Ref::FloatSet invalid;
invalid[0] = std::numeric_limits<float>::infinity();
invalid[1] = -1 * std::numeric_limits<float>::infinity();
invalid[2] = (std::numeric_limits<float>::has_quiet_NaN) ? std::numeric_limits<float>::quiet_NaN() : 0.0f;
this->log_ACTIVITY_HI_FloatEv(invalid[0], invalid[1], invalid[2], invalid);
this->tlmWrite_Float1Ch(invalid[0]);
this->tlmWrite_Float2Ch(invalid[1]);
this->tlmWrite_Float3Ch(invalid[2]);
this->tlmWrite_FloatSet(invalid);
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}
} // end namespace Ref
25 changes: 25 additions & 0 deletions Ref/TypeDemo/TypeDemo.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ module Ref {
choicePair: ChoicePair
}

@ Set of floating points to emit
array FloatSet = [3] F32;

@ Component to demonstrate multiple type configurations
passive component TypeDemo {
#####
Expand Down Expand Up @@ -192,6 +195,28 @@ module Ref {
@ Dump the typed parameters
sync command DUMP_TYPED_PARAMETERS()

#####
# FloatSet outputs
#####
@ A set of floats in an event
event FloatEv(float1: F32, float2: F32, float3: F32, floats: FloatSet) severity activity high \
format "Floats: {} {} {} as a set: {}"

@ Float output channel 1
telemetry Float1Ch: F32

@ Float output channel 2
telemetry Float2Ch: F32

@ Float output channel 3
telemetry Float3Ch: F32

@ Float set output channel
telemetry FloatSet: FloatSet

@ Dump the float values
sync command DUMP_FLOATS()

# ----------------------------------------------------------------------
# Special ports
# ----------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions Ref/TypeDemo/TypeDemo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ class TypeDemo : public TypeDemoComponentBase {
void DUMP_TYPED_PARAMETERS_cmdHandler(const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq /*!< The command sequence number*/
);

//! Implementation for DUMP_FLOATS command handler
//!
void DUMP_FLOATS_cmdHandler(const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq /*!< The command sequence number*/
);
};

} // end namespace Ref
Expand Down