diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCommands.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCommands.scala index 96d61024e..0d76ee72c 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCommands.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCommands.scala @@ -27,7 +27,7 @@ case class ComponentCommands ( private def getOpcodes = linesClassMember( Line.blank :: line(s"//! Command opcodes") :: - wrapInEnum(sortedCmds.flatMap(writeOpcodeConstant)) + wrapInNamedEnum("Opcode", sortedCmds.flatMap(writeOpcodeConstant)) ) private def writeOpcodeConstant( diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentEvents.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentEvents.scala index 6cf5afc0a..3083d65f2 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentEvents.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentEvents.scala @@ -33,7 +33,8 @@ case class ComponentEvents ( linesClassMember( List.concat( Line.blank :: lines(s"//! Event IDs"), - wrapInEnum( + wrapInNamedEnum( + "EventId", sortedEvents.flatMap((id, event) => writeEnumConstant( eventIdConstantName(event.getName), diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentParameters.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentParameters.scala index 3f10a5a61..8d7fae1af 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentParameters.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentParameters.scala @@ -218,7 +218,7 @@ case class ComponentParameters ( private def getParamIds = linesClassMember( List.concat( Line.blank :: lines(s"//! Parameter IDs"), - wrapInEnum(sortedParams.flatMap(writeParamIdConstant)) + wrapInNamedEnum("ParamId", sortedParams.flatMap(writeParamIdConstant)) ) ) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentTelemetry.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentTelemetry.scala index 84482c076..467103df4 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentTelemetry.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentTelemetry.scala @@ -23,7 +23,7 @@ case class ComponentTelemetry( Line.blank :: List.concat( lines(s"//! Channel IDs"), - wrapInEnum(channelIds) + wrapInNamedEnum("ChannelId", channelIds) ) ) guardedList(hasChannels)(List(member)) diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.hpp index 5f4d3b562..771a25ae0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.hpp @@ -116,7 +116,7 @@ class ActiveCommandsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.hpp index 52acc9d2e..79e40ad2a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.hpp @@ -118,7 +118,7 @@ class ActiveEventsComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveExternalParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveExternalParamsComponentAc.ref.hpp index 30a465ad9..e3cc2d6f5 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveExternalParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveExternalParamsComponentAc.ref.hpp @@ -118,7 +118,7 @@ class ActiveExternalParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMI32EXT_SET = 0x0, //!< Opcode to set parameter ParamI32Ext OPCODE_PARAMI32EXT_SAVE = 0x1, //!< Opcode to save parameter ParamI32Ext OPCODE_PARAMF64EXT_SET = 0x2, //!< Opcode to set parameter ParamF64Ext @@ -134,7 +134,7 @@ class ActiveExternalParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMI32EXT = 0x0, //!< An externally stored parameter with I32 data //!< Second line of annotation PARAMID_PARAMF64EXT = 0x1, //!< An externally stored parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveOverflowComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveOverflowComponentAc.ref.hpp index 4c2347ac6..0584b28b3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveOverflowComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveOverflowComponentAc.ref.hpp @@ -89,7 +89,7 @@ class ActiveOverflowComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_HOOK = 0x0, //!< A command with queue full 'hook' behavior OPCODE_CMD_PARAMS_PRIORITY_HOOK = 0x1, //!< A command with params, priority, and queue full 'hook' behavior }; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.hpp index 33f13fc3f..869a93ed6 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.hpp @@ -117,7 +117,7 @@ class ActiveParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMU32_SET = 0x0, //!< Opcode to set parameter ParamU32 OPCODE_PARAMU32_SAVE = 0x1, //!< Opcode to save parameter ParamU32 OPCODE_PARAMF64_SET = 0x2, //!< Opcode to set parameter ParamF64 @@ -133,7 +133,7 @@ class ActiveParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.hpp index 0a3e28e2e..c3356d308 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.hpp @@ -143,7 +143,7 @@ class ActiveSerialComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -188,7 +188,7 @@ class ActiveSerialComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -208,7 +208,7 @@ class ActiveSerialComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -224,7 +224,7 @@ class ActiveSerialComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.hpp index 707675ecd..33c0e18d1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.hpp @@ -116,7 +116,7 @@ class ActiveTelemetryComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp index f054b703d..7a4f821fc 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp @@ -133,7 +133,7 @@ namespace M { }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -178,7 +178,7 @@ namespace M { }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -198,7 +198,7 @@ namespace M { }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -214,7 +214,7 @@ namespace M { }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp index f8f2a5963..2ebdd6b2b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp @@ -110,7 +110,7 @@ class PassiveCommandsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp index 482364507..ea4fdf99f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp @@ -112,7 +112,7 @@ class PassiveEventsComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveExternalParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveExternalParamsComponentAc.ref.hpp index c53421586..98a9d2443 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveExternalParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveExternalParamsComponentAc.ref.hpp @@ -112,7 +112,7 @@ class PassiveExternalParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMI32EXT_SET = 0x0, //!< Opcode to set parameter ParamI32Ext OPCODE_PARAMI32EXT_SAVE = 0x1, //!< Opcode to save parameter ParamI32Ext OPCODE_PARAMF64EXT_SET = 0x2, //!< Opcode to set parameter ParamF64Ext @@ -128,7 +128,7 @@ class PassiveExternalParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMI32EXT = 0x0, //!< An externally stored parameter with I32 data //!< Second line of annotation PARAMID_PARAMF64EXT = 0x1, //!< An externally stored parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp index 7cc5958dc..bdb706b3b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp @@ -111,7 +111,7 @@ class PassiveParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMU32_SET = 0x0, //!< Opcode to set parameter ParamU32 OPCODE_PARAMU32_SAVE = 0x1, //!< Opcode to save parameter ParamU32 OPCODE_PARAMF64_SET = 0x2, //!< Opcode to set parameter ParamF64 @@ -127,7 +127,7 @@ class PassiveParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.hpp index 8b66825ab..83a3b7ab0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.hpp @@ -132,7 +132,7 @@ class PassiveSerialComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -172,7 +172,7 @@ class PassiveSerialComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -192,7 +192,7 @@ class PassiveSerialComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -208,7 +208,7 @@ class PassiveSerialComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp index 3df4ff47f..2b374b2fe 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp @@ -110,7 +110,7 @@ class PassiveTelemetryComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp index 88a0816a3..d511b418c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp @@ -124,7 +124,7 @@ class PassiveTestComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -164,7 +164,7 @@ class PassiveTestComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -184,7 +184,7 @@ class PassiveTestComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -200,7 +200,7 @@ class PassiveTestComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.hpp index 31b178723..400d8a707 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.hpp @@ -116,7 +116,7 @@ class QueuedCommandsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.hpp index 20a1b5e8e..4028d3702 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.hpp @@ -118,7 +118,7 @@ class QueuedEventsComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedExternalParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedExternalParamsComponentAc.ref.hpp index 887af58ff..523b04e7e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedExternalParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedExternalParamsComponentAc.ref.hpp @@ -118,7 +118,7 @@ class QueuedExternalParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMI32EXT_SET = 0x0, //!< Opcode to set parameter ParamI32Ext OPCODE_PARAMI32EXT_SAVE = 0x1, //!< Opcode to save parameter ParamI32Ext OPCODE_PARAMF64EXT_SET = 0x2, //!< Opcode to set parameter ParamF64Ext @@ -134,7 +134,7 @@ class QueuedExternalParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMI32EXT = 0x0, //!< An externally stored parameter with I32 data //!< Second line of annotation PARAMID_PARAMF64EXT = 0x1, //!< An externally stored parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedOverflowComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedOverflowComponentAc.ref.hpp index 68546a641..53b5de154 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedOverflowComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedOverflowComponentAc.ref.hpp @@ -89,7 +89,7 @@ class QueuedOverflowComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_HOOK = 0x0, //!< A command with queue full 'hook' behavior OPCODE_CMD_PARAMS_PRIORITY_HOOK = 0x1, //!< A command with params, priority, and queue full 'hook' behavior }; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.hpp index a6bb1950c..887a0da61 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.hpp @@ -117,7 +117,7 @@ class QueuedParamsComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_PARAMU32_SET = 0x0, //!< Opcode to set parameter ParamU32 OPCODE_PARAMU32_SAVE = 0x1, //!< Opcode to save parameter ParamU32 OPCODE_PARAMF64_SET = 0x2, //!< Opcode to set parameter ParamF64 @@ -133,7 +133,7 @@ class QueuedParamsComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.hpp index 5910798c8..f37ee0be2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.hpp @@ -143,7 +143,7 @@ class QueuedSerialComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -188,7 +188,7 @@ class QueuedSerialComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -208,7 +208,7 @@ class QueuedSerialComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -224,7 +224,7 @@ class QueuedSerialComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.hpp index 2c5ee0282..cd10dfe59 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.hpp @@ -116,7 +116,7 @@ class QueuedTelemetryComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp index 0d477b930..5708c3af7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp @@ -131,7 +131,7 @@ class QueuedTestComponentBase : }; //! Command opcodes - enum { + enum Opcode { OPCODE_CMD_SYNC = 0x0, //!< A sync command with no params OPCODE_CMD_SYNC_PRIMITIVE = 0x10, //!< An async command with primitive params OPCODE_CMD_SYNC_STRING = 0x11, //!< A sync command with string params @@ -176,7 +176,7 @@ class QueuedTestComponentBase : }; //! Event IDs - enum { + enum EventId { EVENTID_EVENTACTIVITYHIGH = 0x0, //!< An activity high event with no params EVENTID_EVENTACTIVITYLOWTHROTTLED = 0x10, //!< An activity low, throttled event with primitive params EVENTID_EVENTCOMMAND = 0x11, //!< A command event with string params @@ -196,7 +196,7 @@ class QueuedTestComponentBase : }; //! Channel IDs - enum { + enum ChannelId { CHANNELID_CHANNELU32FORMAT = 0x0, //!< Channel ID for ChannelU32Format CHANNELID_CHANNELF32FORMAT = 0x1, //!< Channel ID for ChannelF32Format CHANNELID_CHANNELSTRINGFORMAT = 0x2, //!< Channel ID for ChannelStringFormat @@ -212,7 +212,7 @@ class QueuedTestComponentBase : }; //! Parameter IDs - enum { + enum ParamId { PARAMID_PARAMU32 = 0x0, //!< A parameter with U32 data //!< Second line of annotation PARAMID_PARAMF64 = 0x1, //!< A parameter with F64 data diff --git a/compiler/tools/fpp-to-cpp/test/fprime/Svc/Types/TlmPacketizerTypes/TlmPacketizerTypes.fpp b/compiler/tools/fpp-to-cpp/test/fprime/Svc/Types/TlmPacketizerTypes/TlmPacketizerTypes.fpp index 9eb777251..dfd84cf2e 100644 --- a/compiler/tools/fpp-to-cpp/test/fprime/Svc/Types/TlmPacketizerTypes/TlmPacketizerTypes.fpp +++ b/compiler/tools/fpp-to-cpp/test/fprime/Svc/Types/TlmPacketizerTypes/TlmPacketizerTypes.fpp @@ -6,9 +6,16 @@ module Svc { + @ Send policy of a group or packet. Resolution: packet -> group -> section enable. + enum TlmSendState : U8 { + INHERIT_FROM_PARENT, @< Packet: use the group's state; group: use the section enable (default) + SEND_WHEN_SECTION_ENABLED, @< Send only while the section is enabled + SEND_ALWAYS, @< Send; the section enable is ignored + SEND_NEVER, @< Never send + } + @ Enumeration for rate logic types for telemetry groups - enum RateLogic { - SILENCED, @< No logic applied. Does not send group and freezes counter. + enum RateLogic : U8 { EVERY_MAX, @< Send every MAX ticks between sends. ON_CHANGE_MIN, @< Send on updates after MIN ticks since last send. ON_CHANGE_MIN_OR_EVERY_MAX, @< Send on updates after MIN ticks since last send OR at MAX ticks between sends. diff --git a/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.fpp b/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.fpp index 46af253c1..ed27924e6 100644 --- a/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.fpp +++ b/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.fpp @@ -1,7 +1,12 @@ # ====================================================================== # TlmPacketizerCfg.fpp -# Constants for configuring TlmPacketizer Send Logic Levels +# Constants and types for configuring TlmPacketizer (sections, groups, send ports, packet offset type) # ====================================================================== +@ The type of an offset within a telemetry packet buffer. +@ Deliberately defined here (global scope) rather than in FpConfig.fpp so that +@ projects which override FpConfig.fpp continue to build without adding it. +type FwTlmPacketizeOffsetType = U16 + module Svc { @ Configurable enum supporting multiple resampled telemetry sections @ Each section creates output indices for each telemetry group @@ -13,6 +18,9 @@ module Svc { NUM_SECTIONS, @< REQUIRED: Counter, leave as last element. } + @ Maximum number of packets the packetizer can be configured with + constant MAX_PACKETIZER_PACKETS = 50 + @ Greatest packet group constant MAX_CONFIGURABLE_TLMPACKETIZER_GROUP = 3 @@ -36,8 +44,8 @@ module Svc { @ Default configuration for section ENABLED states. In the default configuration, all sections start ENABLED. constant TELEMETRY_SECTION_ENABLED_DEFAULTS = [Fw.Enabled.ENABLED, Fw.Enabled.ENABLED] - @ Default Group configuration. The group is ENABLED, not forced, and uses output-on-change with no min or max time thresholds. - constant DEFAULT_GROUP_CONFIG = { enabled = Fw.Enabled.ENABLED, forceEnabled = Fw.Enabled.DISABLED, rateLogic = RateLogic.ON_CHANGE_MIN, min = 0, max = 0 } + @ Default Group configuration. The group follows its section's enable (INHERIT_FROM_PARENT) and uses output-on-change with no min or max time thresholds. + constant DEFAULT_GROUP_CONFIG = { sendState = TlmSendState.INHERIT_FROM_PARENT, rates = { rateLogic = RateLogic.ON_CHANGE_MIN, min = 0, max = 0 } } @ Sets the default configuration for all sections and groups. Each section/group can be overridden. This acts as @ the default value for the SECTION_CONFIGS parameter. Thus runtime commands and parameter updates chan change this diff --git a/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.hpp b/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.hpp index ff783d209..7c34ba561 100644 --- a/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.hpp +++ b/compiler/tools/fpp-to-cpp/test/fprime/config/TlmPacketizerConfig/TlmPacketizerCfg.hpp @@ -16,8 +16,6 @@ #include namespace Svc { -//! Maximum number of packets that the packetizer can handle. -static const FwChanIdType MAX_PACKETIZER_PACKETS = 50; //! Maximum number of channels that the packetizer can handle. Must be >= number of non-omitted channels static const FwChanIdType MAX_PACKETIZER_CHANNELS = 200; diff --git a/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp b/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp index be536608c..e8574d2dd 100755 --- a/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp +++ b/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp @@ -19,6 +19,7 @@ do mv $base.$suffix config done done +cp config/FppConstantsAc.hpp config/TlmPacketizerConfig # Move definitions from FpConfig.fpp and PlatformTypes.fpp into config fp_config_aliases="