From 19db3cfb0dcbf529ac6808b59a8e83d50323bf59 Mon Sep 17 00:00:00 2001 From: Edward Jones Date: Tue, 20 Sep 2022 15:47:08 +0000 Subject: [PATCH 1/2] Possible fix for MessageGAM Initialisation State --- Source/Components/GAMs/MessageGAM/MessageGAM.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Components/GAMs/MessageGAM/MessageGAM.cpp b/Source/Components/GAMs/MessageGAM/MessageGAM.cpp index d6cf0e85..0d58cb5d 100644 --- a/Source/Components/GAMs/MessageGAM/MessageGAM.cpp +++ b/Source/Components/GAMs/MessageGAM/MessageGAM.cpp @@ -83,6 +83,15 @@ bool MessageGAM::Initialise(StructuredDataI &data) { trigOnChange = (tempTrigOnChange != 0u); } } + if (ret) { + uint8 tempfirstTime; + if (!data.Read("FirstTime", tempfirstTime)) { + firstTime = true; + } + else { + firstTime = (tempfirstTime != 0u); + } + } return ret; } From 39828003749278c20210fdc797149a14d989aa59 Mon Sep 17 00:00:00 2001 From: sudilav <85935040+sudilav@users.noreply.github.com> Date: Tue, 20 Sep 2022 16:55:45 +0100 Subject: [PATCH 2/2] Update MessageGAM.h --- Source/Components/GAMs/MessageGAM/MessageGAM.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Components/GAMs/MessageGAM/MessageGAM.h b/Source/Components/GAMs/MessageGAM/MessageGAM.h index af0cbc46..48312c23 100644 --- a/Source/Components/GAMs/MessageGAM/MessageGAM.h +++ b/Source/Components/GAMs/MessageGAM/MessageGAM.h @@ -56,6 +56,8 @@ namespace MARTe{ * that every state change (e.g. PrepareNextState) the GAM stores the current value to wait for a change happening in the future, by comparing * past value with current, during that specific state context. In other words, the GAM has to see and "edge" in the command value to trigger a message. * - TriggerOnChange disabled: the GAM does not need to see an edge in command value to trigger the message, even across state changes. + * - FirstTime: For the first execution of this GAM, regard previousValue as 0. This causes a trigger on change to be true even if this is the first iteration of the Message being + * executed. By disabling this it will ignore the first iteration if TriggerOnChange is enabled and subsequent iterations the previousValue will be what it started with. * As the GAM keeps track of sent messages and received replies, if the message sent as a consequence of a triggering event is still awaiting for a reply, no further message will * be sent until the reply acknowledgement. * Constraints:\n @@ -67,6 +69,7 @@ namespace MARTe{ * +GAM1 = { * Class = TriggerOnChangeGAM * TriggerOnChange = 1 //Defaults to 1 = true if not present. Allowed values 0 == false or disabled, != 0 == true or enabled (see above) + * FirstTime = 1 // Defaults to 1 = true if not present. Allowed values 0 == false or disabled, != 0 == true or enabled (see above) * +Events = { * Class = ReferenceContainer * +Event1 = {