From fee28e704a7e5b321c467bc22319b4c95bda8904 Mon Sep 17 00:00:00 2001 From: Michael D Starch Date: Thu, 13 Jul 2023 17:42:13 -0700 Subject: [PATCH] Adding NaN, Infinity, and negative Infinity --- Ref/Top/RefPackets.xml | 4 ++++ Ref/TypeDemo/TypeDemo.cpp | 12 ++++++++++++ Ref/TypeDemo/TypeDemo.fpp | 25 +++++++++++++++++++++++++ Ref/TypeDemo/TypeDemo.hpp | 6 ++++++ 4 files changed, 47 insertions(+) diff --git a/Ref/Top/RefPackets.xml b/Ref/Top/RefPackets.xml index edd64f2fc8..e597eb95ee 100644 --- a/Ref/Top/RefPackets.xml +++ b/Ref/Top/RefPackets.xml @@ -153,6 +153,10 @@ + + + + diff --git a/Ref/TypeDemo/TypeDemo.cpp b/Ref/TypeDemo/TypeDemo.cpp index 3362a6f58b..321474ed76 100644 --- a/Ref/TypeDemo/TypeDemo.cpp +++ b/Ref/TypeDemo/TypeDemo.cpp @@ -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::infinity(); + invalid[1] = -1 * std::numeric_limits::infinity(); + invalid[2] = (std::numeric_limits::has_quiet_NaN) ? std::numeric_limits::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 diff --git a/Ref/TypeDemo/TypeDemo.fpp b/Ref/TypeDemo/TypeDemo.fpp index 2c5a6b0c93..5dc57da482 100644 --- a/Ref/TypeDemo/TypeDemo.fpp +++ b/Ref/TypeDemo/TypeDemo.fpp @@ -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 { ##### @@ -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 # ---------------------------------------------------------------------- diff --git a/Ref/TypeDemo/TypeDemo.hpp b/Ref/TypeDemo/TypeDemo.hpp index 23c251fde3..d3e05d1205 100644 --- a/Ref/TypeDemo/TypeDemo.hpp +++ b/Ref/TypeDemo/TypeDemo.hpp @@ -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