From 90591f504ad9b3840c7c477a0a9cb02a87b60a8e Mon Sep 17 00:00:00 2001 From: Bernardo Carvalho Date: Sun, 26 Oct 2025 00:42:25 +0100 Subject: [PATCH] Added PSU DS messages Signed-off-by: Bernardo Carvalho --- Configurations/RTApp-2-Uart.cfg | 58 ++++++------------- .../PSUCommunicator/PSUCommunicatorTX.cpp | 20 +++++++ .../PSUCommunicator/PSUCommunicatorTX.h | 8 +++ 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/Configurations/RTApp-2-Uart.cfg b/Configurations/RTApp-2-Uart.cfg index 2c551da..e8761f4 100644 --- a/Configurations/RTApp-2-Uart.cfg +++ b/Configurations/RTApp-2-Uart.cfg @@ -1,3 +1,9 @@ ++TCPMessageProxy = { + Class = TCPSocketMessageProxyExample + Port = 24680 + +} +// echo -e "Destination=StateMachine\nFunction=GOTOSTATE2" | nc 127.0.0.1 24680 +StateMachine = { Class = StateMachine +INITIAL = { @@ -54,6 +60,12 @@ Function = StartNextStateExecution Mode = ExpectsReply } + +TriggerPSUMsg = { + Class = Message + Destination = "TestApp.Data.UartOutDS" + Function = TriggerPSU + Mode = ExpectsReply + } } +ERROR = { Class = StateMachineEvent @@ -218,46 +230,12 @@ $TestApp = { } } } - +GAMWF1 = { - Class = WaveformGAM::WaveformPointsDef - Points = {-1000 1000} - Times = {0 10000} - InputSignals = { - Time = { - DataSource = DDB1 - Type = uint32 - } - } - OutputSignals = { - Reference1 = { - DataSource = DDB1 - Type = float32 - } - } - } - +GAMWF2 = { - Class = WaveformGAM::WaveformPointsDef - Points = {1000 -1000} - Times = {0 10000} - InputSignals = { - Time = { - DataSource = DDB1 - Type = uint32 - } - } - OutputSignals = { - Reference1 = { - DataSource = DDB1 - Type = float32 - } - } - } - +GAMWF3 = { + +GAMWF = { Class = WaveformGAM::WaveformSin - Amplitude = 10.0 + Amplitude = 100.0 Frequency = 0.1 Phase = 0.0 - Offset = 1.1 + Offset = 100.1 InputSignals = { Time = { DataSource = "DDB1" @@ -363,7 +341,7 @@ $TestApp = { +Thread1 = { Class = RealTimeThread CPUs = 0x1 - Functions = {GAMTimer GAMWF1 SerialOutGAM GAMDisplay} + Functions = {GAMTimer GAMWF SerialOutGAM GAMDisplay} } } } @@ -374,7 +352,7 @@ $TestApp = { +Thread1 = { Class = RealTimeThread CPUs = 0x1 - Functions = {GAMTimer GAMWF2 GAMDisplay} + Functions = {GAMTimer GAMWF SerialOutGAM GAMDisplay} } } } @@ -385,7 +363,7 @@ $TestApp = { +Thread1 = { Class = RealTimeThread CPUs = 0x1 - Functions = {GAMTimer GAMWF3 GAMDisplay} + Functions = {GAMTimer GAMWF GAMDisplay} } } } diff --git a/DataSources/PSUCommunicator/PSUCommunicatorTX.cpp b/DataSources/PSUCommunicator/PSUCommunicatorTX.cpp index c77529a..94075c5 100644 --- a/DataSources/PSUCommunicator/PSUCommunicatorTX.cpp +++ b/DataSources/PSUCommunicator/PSUCommunicatorTX.cpp @@ -433,6 +433,26 @@ bool PSUCommunicatorTX::Synchronise() { */ return ok; } +// Messages +ErrorManagement::ErrorType PSUCommunicatorTX::TriggerPSU() { + ErrorManagement::ErrorType err; + REPORT_ERROR(ErrorManagement::Information, + "PSUCommunicatorTX::TriggerPSU. Got Message!"); + communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_DISCHARGE; + + return err; +} +ErrorManagement::ErrorType PSUCommunicatorTX::GoOnline() { + ErrorManagement::ErrorType err; + REPORT_ERROR(ErrorManagement::Information, + "PSUCommunicatorTX::GoOnline. Got Message!"); + communicatorOnlineStage = FA_COMMUNICATOR_ONLINE_WAIT_CODAC_TRIGGER; + + return err; +} + CLASS_REGISTER(PSUCommunicatorTX, "1.0") +CLASS_METHOD_REGISTER(PSUCommunicatorTX, TriggerPSU) +CLASS_METHOD_REGISTER(PSUCommunicatorTX, GoOnline) } // namespace MARTe // vim: syntax=cpp ts=2 sw=2 sts=2 sr et diff --git a/DataSources/PSUCommunicator/PSUCommunicatorTX.h b/DataSources/PSUCommunicator/PSUCommunicatorTX.h index 972b30c..10b33ab 100644 --- a/DataSources/PSUCommunicator/PSUCommunicatorTX.h +++ b/DataSources/PSUCommunicator/PSUCommunicatorTX.h @@ -197,6 +197,14 @@ public: * @return true if the writing of all the channels is successful. */ virtual bool Synchronise(); + /** + * @brief + * @details This method + * It can be called within a + * MARTe message. + */ + ErrorManagement::ErrorType TriggerPSU(); + ErrorManagement::ErrorType GoOnline(); private: /**