Merge pull request 'Syrlinks Update' (#353) from refactor_syrlinks into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #353
Reviewed-by: Jakob Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Robin Müller 2023-01-26 19:18:31 +01:00
commit e387a61278
15 changed files with 384 additions and 124 deletions

View File

@ -10,18 +10,34 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
Syrlinks PR: PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/353
## Fixed ## Fixed
- The `OBSW_SYRLINKS_SIMULATED` flag is set to 0 for for both EM and FM. - The `OBSW_SYRLINKS_SIMULATED` flag is set to 0 for for both EM and FM.
- MGM4 handling in ACS sensor processing: Bugfix in `mulScalar` operation - MGM4 handling in ACS sensor processing: Bugfix in `mulScalar` operation
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/354 PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/354
- Subsystem ID clash: CORE subsystem ID was the same as Syrlinks subsystem ID.
## Changed ## Changed
- Startracker temperature set and PCDU switcher set are diagnostic now - Startracker temperature set and PCDU switcher set are diagnostic now
- `SyrlinksHkHandler` renamed to `SyrlinksHandler` to better reflect that it does more than
just HK and is also responsible for setting the TX mode of the device.
- `SyrlinksHandler`: Go to startup immediately because the Syrlinks device should always be on
by default.
- `SyrlinksHandler`: Go to normal mode at startup.
## Added ## Added
- The Syrlinks handler has submodes for the TX mode now: RX Only (0), RX and TX default
datarate (1), RX and TX Low Rate (2), RX and TX High Rate (3) and TX Carrier Wave (4).
The submodes apply for both ON and NORMAL mode. The default datarate can be updated using
a parameter command (domain ID 0 and unique ID 0) with value 0 for low rate and 1 for high rate.
- The Syrlinks handler always sets TX to standby when switching off
- The Syrlinks handler triggers a new TX_ON event when the transmitter was switched on successfully
and a TX_OFF event when it was switched off successfully.
- Startracker temperature set and PCDU switcher set are diagnostic now
- The CCSDS handler can accept mode commands now. It accepts ON and OFF commands. Furthermore - The CCSDS handler can accept mode commands now. It accepts ON and OFF commands. Furthermore
it has a submode for low datarate (1) and high datarate (2) for the ON command. it has a submode for low datarate (1) and high datarate (2) for the ON command.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/352 PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/352

View File

@ -56,6 +56,7 @@
#endif #endif
#include <mission/devices/ImtqHandler.h> #include <mission/devices/ImtqHandler.h>
#include <mission/devices/PcduHandler.h> #include <mission/devices/PcduHandler.h>
#include <mission/devices/SyrlinksHandler.h>
#include <sstream> #include <sstream>
@ -88,7 +89,6 @@
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h" #include "mission/devices/RwHandler.h"
#include "mission/devices/SolarArrayDeploymentHandler.h" #include "mission/devices/SolarArrayDeploymentHandler.h"
#include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/Tmp1075Handler.h" #include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" #include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h" #include "mission/devices/devicedefinitions/Max31865Definitions.h"
@ -586,9 +586,10 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER); auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
auto syrlinksHandler = auto syrlinksHandler =
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, new SyrlinksHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher); syrlinksHandler->setPowerSwitcher(pwrSwitcher);
syrlinksHandler->setStartUpImmediately();
#if OBSW_DEBUG_SYRLINKS == 1 #if OBSW_DEBUG_SYRLINKS == 1
syrlinksHandler->setDebugMode(true); syrlinksHandler->setDebugMode(true);
#endif #endif

View File

@ -35,6 +35,7 @@ enum : uint8_t {
SYRLINKS = 137, SYRLINKS = 137,
SCEX_HANDLER = 138, SCEX_HANDLER = 138,
CONFIGHANDLER = 139, CONFIGHANDLER = 139,
CORE = 140,
COMMON_SUBSYSTEM_ID_END COMMON_SUBSYSTEM_ID_END
}; };

View File

@ -226,11 +226,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h 13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h 13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h
13632;0x3540;HDLC_CRC_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h 13632;0x3540;HDLC_CRC_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h
13700;0x3584;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h 13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h 13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h 13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
13704;0x3588;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;bsp_q7s/core/CoreController.h
13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h 13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h 13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h 13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h
@ -239,3 +237,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h 13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
13904;0x3650;WRITE_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h 13904;0x3650;WRITE_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
13905;0x3651;READ_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h 13905;0x3651;READ_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
14000;0x36b0;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
14001;0x36b1;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
14002;0x36b2;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
14003;0x36b3;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
14004;0x36b4;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;bsp_q7s/core/CoreController.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
226 13630 0x353e SUPV_UPDATE_PROGRESS INFO Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written linux/devices/ploc/PlocSupvUartMan.h
227 13631 0x353f HDLC_FRAME_REMOVAL_ERROR INFO linux/devices/ploc/PlocSupvUartMan.h
228 13632 0x3540 HDLC_CRC_ERROR INFO linux/devices/ploc/PlocSupvUartMan.h
229 13700 0x3584 ALLOC_FAILURE FDIR_REACTION_IGNORED MEDIUM bsp_q7s/core/CoreController.h mission/devices/devicedefinitions/SyrlinksDefinitions.h
230 13701 0x3585 REBOOT_SW TX_ON MEDIUM INFO Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy Transmitter is on now. P1: Submode, P2: Current default datarate. bsp_q7s/core/CoreController.h mission/devices/devicedefinitions/SyrlinksDefinitions.h
231 13702 0x3586 REBOOT_MECHANISM_TRIGGERED TX_OFF MEDIUM INFO The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots Transmitter is off now. bsp_q7s/core/CoreController.h mission/devices/devicedefinitions/SyrlinksDefinitions.h
13703 0x3587 REBOOT_HW MEDIUM bsp_q7s/core/CoreController.h
13704 0x3588 NO_SD_CARD_ACTIVE HIGH No SD card was active. Core controller will attempt to re-initialize a SD card. bsp_q7s/core/CoreController.h
232 13800 0x35e8 MISSING_PACKET LOW mission/devices/devicedefinitions/ScexDefinitions.h
233 13801 0x35e9 EXPERIMENT_TIMEDOUT LOW mission/devices/devicedefinitions/ScexDefinitions.h
234 13802 0x35ea MULTI_PACKET_COMMAND_DONE INFO mission/devices/devicedefinitions/ScexDefinitions.h
237 13903 0x364f INSERT_CONFIGFILEVALUE_FAILED MEDIUM mission/utility/GlobalConfigHandler.h
238 13904 0x3650 WRITE_CONFIGFILE_FAILED MEDIUM mission/utility/GlobalConfigHandler.h
239 13905 0x3651 READ_CONFIGFILE_FAILED MEDIUM mission/utility/GlobalConfigHandler.h
240 14000 0x36b0 ALLOC_FAILURE MEDIUM bsp_q7s/core/CoreController.h
241 14001 0x36b1 REBOOT_SW MEDIUM Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy bsp_q7s/core/CoreController.h
242 14002 0x36b2 REBOOT_MECHANISM_TRIGGERED MEDIUM The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots bsp_q7s/core/CoreController.h
243 14003 0x36b3 REBOOT_HW MEDIUM bsp_q7s/core/CoreController.h
244 14004 0x36b4 NO_SD_CARD_ACTIVE HIGH No SD card was active. Core controller will attempt to re-initialize a SD card. bsp_q7s/core/CoreController.h

View File

@ -35,15 +35,15 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x51a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/ImtqHandler.h 0x51a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/ImtqHandler.h 0x51a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a7;IMTQ_UnexpectedSelfTestReply;The status reply to a self test command was received but no self test command has been sent. This should normally never happen.;167;IMTQ_HANDLER;mission/devices/ImtqHandler.h 0x51a7;IMTQ_UnexpectedSelfTestReply;The status reply to a self test command was received but no self test command has been sent. This should normally never happen.;167;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x50a0;SYRLINKS_CrcFailure;;160;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a0;SYRLINKS_CrcFailure;;160;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a1;SYRLINKS_UartFraminOrParityErrorAck;;161;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a1;SYRLINKS_UartFraminOrParityErrorAck;;161;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a2;SYRLINKS_BadCharacterAck;;162;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a2;SYRLINKS_BadCharacterAck;;162;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a3;SYRLINKS_BadParameterValueAck;;163;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a3;SYRLINKS_BadParameterValueAck;;163;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a4;SYRLINKS_BadEndOfFrameAck;;164;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a4;SYRLINKS_BadEndOfFrameAck;;164;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a5;SYRLINKS_UnknownCommandIdAck;;165;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a5;SYRLINKS_UnknownCommandIdAck;;165;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a6;SYRLINKS_BadCrcAck;;166;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a6;SYRLINKS_BadCrcAck;;166;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a7;SYRLINKS_ReplyWrongSize;;167;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a7;SYRLINKS_ReplyWrongSize;;167;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x50a8;SYRLINKS_MissingStartFrameCharacter;;168;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a8;SYRLINKS_MissingStartFrameCharacter;;168;SYRLINKS_HANDLER;mission/devices/SyrlinksHandler.h
0x66a0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h 0x66a0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h
0x66a1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h 0x66a1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h
0x66a2;SADPL_MainSwitchTimeoutFailure;;162;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h 0x66a2;SADPL_MainSwitchTimeoutFailure;;162;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
35 0x51a5 IMTQ_RejectedWithoutReason 165 IMTQ_HANDLER mission/devices/ImtqHandler.h
36 0x51a6 IMTQ_CmdErrUnknown 166 IMTQ_HANDLER mission/devices/ImtqHandler.h
37 0x51a7 IMTQ_UnexpectedSelfTestReply The status reply to a self test command was received but no self test command has been sent. This should normally never happen. 167 IMTQ_HANDLER mission/devices/ImtqHandler.h
38 0x50a0 SYRLINKS_CrcFailure 160 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
39 0x50a1 SYRLINKS_UartFraminOrParityErrorAck 161 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
40 0x50a2 SYRLINKS_BadCharacterAck 162 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
41 0x50a3 SYRLINKS_BadParameterValueAck 163 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
42 0x50a4 SYRLINKS_BadEndOfFrameAck 164 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
43 0x50a5 SYRLINKS_UnknownCommandIdAck 165 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
44 0x50a6 SYRLINKS_BadCrcAck 166 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
45 0x50a7 SYRLINKS_ReplyWrongSize 167 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
46 0x50a8 SYRLINKS_MissingStartFrameCharacter 168 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h mission/devices/SyrlinksHandler.h
47 0x66a0 SADPL_CommandNotSupported 160 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h
48 0x66a1 SADPL_DeploymentAlreadyExecuting 161 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h
49 0x66a2 SADPL_MainSwitchTimeoutFailure 162 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 240 translations. * @brief Auto-generated event translation file. Contains 243 translations.
* @details * @details
* Generated on: 2023-01-23 11:30:32 * Generated on: 2023-01-26 16:43:50
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -228,11 +228,8 @@ const char *SUPV_REPLY_CRC_MISSMATCH_STRING = "SUPV_REPLY_CRC_MISSMATCH";
const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS"; const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS";
const char *HDLC_FRAME_REMOVAL_ERROR_STRING = "HDLC_FRAME_REMOVAL_ERROR"; const char *HDLC_FRAME_REMOVAL_ERROR_STRING = "HDLC_FRAME_REMOVAL_ERROR";
const char *HDLC_CRC_ERROR_STRING = "HDLC_CRC_ERROR"; const char *HDLC_CRC_ERROR_STRING = "HDLC_CRC_ERROR";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *TX_ON_STRING = "TX_ON";
const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *TX_OFF_STRING = "TX_OFF";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *NO_SD_CARD_ACTIVE_STRING = "NO_SD_CARD_ACTIVE";
const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
@ -241,6 +238,11 @@ const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED"; const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
const char *WRITE_CONFIGFILE_FAILED_STRING = "WRITE_CONFIGFILE_FAILED"; const char *WRITE_CONFIGFILE_FAILED_STRING = "WRITE_CONFIGFILE_FAILED";
const char *READ_CONFIGFILE_FAILED_STRING = "READ_CONFIGFILE_FAILED"; const char *READ_CONFIGFILE_FAILED_STRING = "READ_CONFIGFILE_FAILED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *NO_SD_CARD_ACTIVE_STRING = "NO_SD_CARD_ACTIVE";
const char *translateEvents(Event event) { const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) { switch ((event & 0xFFFF)) {
@ -690,16 +692,10 @@ const char *translateEvents(Event event) {
return HDLC_FRAME_REMOVAL_ERROR_STRING; return HDLC_FRAME_REMOVAL_ERROR_STRING;
case (13632): case (13632):
return HDLC_CRC_ERROR_STRING; return HDLC_CRC_ERROR_STRING;
case (13700):
return ALLOC_FAILURE_STRING;
case (13701): case (13701):
return REBOOT_SW_STRING; return TX_ON_STRING;
case (13702): case (13702):
return REBOOT_MECHANISM_TRIGGERED_STRING; return TX_OFF_STRING;
case (13703):
return REBOOT_HW_STRING;
case (13704):
return NO_SD_CARD_ACTIVE_STRING;
case (13800): case (13800):
return MISSING_PACKET_STRING; return MISSING_PACKET_STRING;
case (13801): case (13801):
@ -716,6 +712,16 @@ const char *translateEvents(Event event) {
return WRITE_CONFIGFILE_FAILED_STRING; return WRITE_CONFIGFILE_FAILED_STRING;
case (13905): case (13905):
return READ_CONFIGFILE_FAILED_STRING; return READ_CONFIGFILE_FAILED_STRING;
case (14000):
return ALLOC_FAILURE_STRING;
case (14001):
return REBOOT_SW_STRING;
case (14002):
return REBOOT_MECHANISM_TRIGGERED_STRING;
case (14003):
return REBOOT_HW_STRING;
case (14004):
return NO_SD_CARD_ACTIVE_STRING;
default: default:
return "UNKNOWN_EVENT"; return "UNKNOWN_EVENT";
} }

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 151 translations. * Contains 151 translations.
* Generated on: 2023-01-23 11:30:32 * Generated on: 2023-01-26 16:43:50
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -13,7 +13,6 @@
namespace SUBSYSTEM_ID { namespace SUBSYSTEM_ID {
enum : uint8_t { enum : uint8_t {
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END, SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END,
CORE = 137,
}; };
} }

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 240 translations. * @brief Auto-generated event translation file. Contains 243 translations.
* @details * @details
* Generated on: 2023-01-23 11:30:32 * Generated on: 2023-01-26 16:43:50
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -228,11 +228,8 @@ const char *SUPV_REPLY_CRC_MISSMATCH_STRING = "SUPV_REPLY_CRC_MISSMATCH";
const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS"; const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS";
const char *HDLC_FRAME_REMOVAL_ERROR_STRING = "HDLC_FRAME_REMOVAL_ERROR"; const char *HDLC_FRAME_REMOVAL_ERROR_STRING = "HDLC_FRAME_REMOVAL_ERROR";
const char *HDLC_CRC_ERROR_STRING = "HDLC_CRC_ERROR"; const char *HDLC_CRC_ERROR_STRING = "HDLC_CRC_ERROR";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *TX_ON_STRING = "TX_ON";
const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *TX_OFF_STRING = "TX_OFF";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *NO_SD_CARD_ACTIVE_STRING = "NO_SD_CARD_ACTIVE";
const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
@ -241,6 +238,11 @@ const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED"; const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
const char *WRITE_CONFIGFILE_FAILED_STRING = "WRITE_CONFIGFILE_FAILED"; const char *WRITE_CONFIGFILE_FAILED_STRING = "WRITE_CONFIGFILE_FAILED";
const char *READ_CONFIGFILE_FAILED_STRING = "READ_CONFIGFILE_FAILED"; const char *READ_CONFIGFILE_FAILED_STRING = "READ_CONFIGFILE_FAILED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *NO_SD_CARD_ACTIVE_STRING = "NO_SD_CARD_ACTIVE";
const char *translateEvents(Event event) { const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) { switch ((event & 0xFFFF)) {
@ -690,16 +692,10 @@ const char *translateEvents(Event event) {
return HDLC_FRAME_REMOVAL_ERROR_STRING; return HDLC_FRAME_REMOVAL_ERROR_STRING;
case (13632): case (13632):
return HDLC_CRC_ERROR_STRING; return HDLC_CRC_ERROR_STRING;
case (13700):
return ALLOC_FAILURE_STRING;
case (13701): case (13701):
return REBOOT_SW_STRING; return TX_ON_STRING;
case (13702): case (13702):
return REBOOT_MECHANISM_TRIGGERED_STRING; return TX_OFF_STRING;
case (13703):
return REBOOT_HW_STRING;
case (13704):
return NO_SD_CARD_ACTIVE_STRING;
case (13800): case (13800):
return MISSING_PACKET_STRING; return MISSING_PACKET_STRING;
case (13801): case (13801):
@ -716,6 +712,16 @@ const char *translateEvents(Event event) {
return WRITE_CONFIGFILE_FAILED_STRING; return WRITE_CONFIGFILE_FAILED_STRING;
case (13905): case (13905):
return READ_CONFIGFILE_FAILED_STRING; return READ_CONFIGFILE_FAILED_STRING;
case (14000):
return ALLOC_FAILURE_STRING;
case (14001):
return REBOOT_SW_STRING;
case (14002):
return REBOOT_MECHANISM_TRIGGERED_STRING;
case (14003):
return REBOOT_HW_STRING;
case (14004):
return NO_SD_CARD_ACTIVE_STRING;
default: default:
return "UNKNOWN_EVENT"; return "UNKNOWN_EVENT";
} }

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 151 translations. * Contains 151 translations.
* Generated on: 2023-01-23 11:30:32 * Generated on: 2023-01-26 16:43:50
*/ */
#include "translateObjects.h" #include "translateObjects.h"

14
mission/comDefs.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef MISSION_COMDEFS_H_
#define MISSION_COMDEFS_H_
namespace com {
enum class Datarate : uint8_t {
LOW_RATE_MODULATION_BPSK,
HIGH_RATE_MODULATION_0QPSK,
NUM_DATARATES
};
}
#endif /* MISSION_COMDEFS_H_ */

View File

@ -8,7 +8,7 @@ target_sources(
PDU1Handler.cpp PDU1Handler.cpp
PDU2Handler.cpp PDU2Handler.cpp
ACUHandler.cpp ACUHandler.cpp
SyrlinksHkHandler.cpp SyrlinksHandler.cpp
Max31865PT1000Handler.cpp Max31865PT1000Handler.cpp
Max31865EiveHandler.cpp Max31865EiveHandler.cpp
ImtqHandler.cpp ImtqHandler.cpp

View File

@ -1,10 +1,10 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/globalfunctions/CRC.h> #include <fsfw/globalfunctions/CRC.h>
#include <mission/devices/SyrlinksHkHandler.h> #include <mission/devices/SyrlinksHandler.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir) power::Switch_t powerSwitch, FailureIsolationBase* customFdir)
: DeviceHandlerBase(objectId, comIF, comCookie, customFdir), : DeviceHandlerBase(objectId, comIF, comCookie, customFdir),
rxDataset(this), rxDataset(this),
@ -16,29 +16,40 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
} }
} }
SyrlinksHkHandler::~SyrlinksHkHandler() {} SyrlinksHandler::~SyrlinksHandler() = default;
void SyrlinksHkHandler::doStartUp() { void SyrlinksHandler::doStartUp() {
switch (startupState) { if (internalState == InternalState::OFF) {
case StartupState::OFF: { internalState = InternalState::ENABLE_TEMPERATURE_PROTECTION;
startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION; commandExecuted = false;
break;
} }
case StartupState::DONE: { if (internalState == InternalState::ENABLE_TEMPERATURE_PROTECTION) {
setMode(_MODE_TO_ON); if (commandExecuted) {
break; // Go to normal mode immediately and disable transmitter on startup.
setMode(_MODE_TO_NORMAL);
internalState = InternalState::IDLE;
commandExecuted = false;
} }
default:
break;
} }
} }
void SyrlinksHkHandler::doShutDown() { void SyrlinksHandler::doShutDown() {
setMode(_MODE_POWER_DOWN); // In any case, always disable TX first.
if (internalState != InternalState::SET_TX_STANDBY) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;
}
if (internalState == InternalState::SET_TX_STANDBY) {
if (commandExecuted) {
temperatureSet.setValidity(false, true); temperatureSet.setValidity(false, true);
internalState = InternalState::OFF;
commandExecuted = false;
setMode(_MODE_POWER_DOWN);
}
}
} }
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t SyrlinksHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
switch (nextCommand) { switch (nextCommand) {
case (syrlinks::READ_RX_STATUS_REGISTERS): case (syrlinks::READ_RX_STATUS_REGISTERS):
*id = syrlinks::READ_RX_STATUS_REGISTERS; *id = syrlinks::READ_RX_STATUS_REGISTERS;
@ -84,19 +95,39 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t SyrlinksHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
switch (startupState) { switch (internalState) {
case StartupState::ENABLE_TEMPERATURE_PROTECTION: { case InternalState::ENABLE_TEMPERATURE_PROTECTION: {
*id = syrlinks::WRITE_LCL_CONFIG; *id = syrlinks::WRITE_LCL_CONFIG;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
case InternalState::SET_TX_MODULATION: {
*id = syrlinks::SET_TX_MODE_MODULATION;
return buildCommandFromCommand(*id, nullptr, 0);
}
case InternalState::SELECT_MODULATION_BPSK: {
*id = syrlinks::SET_WAVEFORM_BPSK;
return buildCommandFromCommand(*id, nullptr, 0);
}
case InternalState::SELECT_MODULATION_0QPSK: {
*id = syrlinks::SET_WAVEFORM_0QPSK;
return buildCommandFromCommand(*id, nullptr, 0);
}
case InternalState::SET_TX_CW: {
*id = syrlinks::SET_TX_MODE_CW;
return buildCommandFromCommand(*id, nullptr, 0);
}
case InternalState::SET_TX_STANDBY: {
*id = syrlinks::SET_TX_MODE_STANDBY;
return buildCommandFromCommand(*id, nullptr, 0);
}
default: default:
break; break;
} }
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t SyrlinksHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t* commandData, const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
switch (deviceCommand) { switch (deviceCommand) {
@ -160,11 +191,11 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
prepareCommand(tempBasebandBoardLowByte, deviceCommand); prepareCommand(tempBasebandBoardLowByte, deviceCommand);
return returnvalue::OK; return returnvalue::OK;
} }
case (syrlinks::CONFIG_BPSK): { case (syrlinks::SET_WAVEFORM_BPSK): {
prepareCommand(configBPSK, deviceCommand); prepareCommand(configBPSK, deviceCommand);
return returnvalue::OK; return returnvalue::OK;
} }
case (syrlinks::CONFIG_OQPSK): { case (syrlinks::SET_WAVEFORM_0QPSK): {
prepareCommand(configOQPSK, deviceCommand); prepareCommand(configOQPSK, deviceCommand);
return returnvalue::OK; return returnvalue::OK;
} }
@ -184,7 +215,7 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
return returnvalue::FAILED; return returnvalue::FAILED;
} }
void SyrlinksHkHandler::fillCommandAndReplyMap() { void SyrlinksHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(syrlinks::RESET_UNIT, 1, nullptr, syrlinks::ACK_SIZE, false, this->insertInCommandAndReplyMap(syrlinks::RESET_UNIT, 1, nullptr, syrlinks::ACK_SIZE, false,
true, syrlinks::ACK_REPLY); true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_TX_MODE_STANDBY, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::SET_TX_MODE_STANDBY, 1, nullptr, syrlinks::ACK_SIZE,
@ -195,10 +226,10 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
true, syrlinks::ACK_REPLY); true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::CONFIG_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false, this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE,
true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE, false, this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_0QPSK, 1, nullptr, syrlinks::ACK_SIZE,
true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandMap(syrlinks::ENABLE_DEBUG); this->insertInCommandMap(syrlinks::ENABLE_DEBUG);
this->insertInCommandMap(syrlinks::DISABLE_DEBUG); this->insertInCommandMap(syrlinks::DISABLE_DEBUG);
this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr, this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr,
@ -223,7 +254,7 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE); syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE);
} }
ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t SyrlinksHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
@ -254,7 +285,7 @@ ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remai
return result; return result;
} }
ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { ReturnValue_t SyrlinksHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
if (powerSwitch == power::NO_SWITCH) { if (powerSwitch == power::NO_SWITCH) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;
} }
@ -263,7 +294,7 @@ ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t*
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { ReturnValue_t SyrlinksHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t result; ReturnValue_t result;
switch (id) { switch (id) {
@ -414,7 +445,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
return returnvalue::OK; return returnvalue::OK;
} }
LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase* SyrlinksHandler::getDataSetHandle(sid_t sid) {
if (sid == rxDataset.getSid()) { if (sid == rxDataset.getSid()) {
return &rxDataset; return &rxDataset;
} else if (sid == txDataset.getSid()) { } else if (sid == txDataset.getSid()) {
@ -427,13 +458,13 @@ LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) {
} }
} }
std::string SyrlinksHkHandler::convertUint16ToHexString(uint16_t intValue) { std::string SyrlinksHandler::convertUint16ToHexString(uint16_t intValue) {
std::stringstream stream; std::stringstream stream;
stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue; stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue;
return stream.str(); return stream.str();
} }
uint8_t SyrlinksHkHandler::convertHexStringToUint8(const char* twoChars) { uint8_t SyrlinksHandler::convertHexStringToUint8(const char* twoChars) {
uint32_t value; uint32_t value;
std::string hexString(twoChars, 2); std::string hexString(twoChars, 2);
std::stringstream stream; std::stringstream stream;
@ -442,13 +473,13 @@ uint8_t SyrlinksHkHandler::convertHexStringToUint8(const char* twoChars) {
return static_cast<uint8_t>(value); return static_cast<uint8_t>(value);
} }
uint16_t SyrlinksHkHandler::convertHexStringToUint16(const char* fourChars) { uint16_t SyrlinksHandler::convertHexStringToUint16(const char* fourChars) {
uint16_t value = 0; uint16_t value = 0;
value = convertHexStringToUint8(fourChars) << 8 | convertHexStringToUint8(fourChars + 2); value = convertHexStringToUint8(fourChars) << 8 | convertHexStringToUint8(fourChars + 2);
return value; return value;
} }
ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { ReturnValue_t SyrlinksHandler::parseReplyStatus(const char* status) {
switch (*status) { switch (*status) {
case '0': case '0':
return returnvalue::OK; return returnvalue::OK;
@ -480,7 +511,7 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
} }
} }
ReturnValue_t SyrlinksHkHandler::verifyReply(const uint8_t* packet, uint8_t size) { ReturnValue_t SyrlinksHandler::verifyReply(const uint8_t* packet, uint8_t size) {
int result = 0; int result = 0;
/* Calculate crc from received packet */ /* Calculate crc from received packet */
uint16_t crc = uint16_t crc =
@ -500,7 +531,7 @@ ReturnValue_t SyrlinksHkHandler::verifyReply(const uint8_t* packet, uint8_t size
return returnvalue::OK; return returnvalue::OK;
} }
void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) { void SyrlinksHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
PoolReadGuard readHelper(&rxDataset); PoolReadGuard readHelper(&rxDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -540,7 +571,7 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
} }
} }
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) { void SyrlinksHandler::parseLclConfigReply(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
if (debugMode) { if (debugMode) {
@ -549,7 +580,7 @@ void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
} }
} }
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) { void SyrlinksHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -560,7 +591,7 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
} }
} }
void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) { void SyrlinksHandler::parseTxWaveformReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -571,7 +602,7 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
} }
} }
void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) { void SyrlinksHandler::parseAgcLowByte(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txAgcValue = agcValueHighByte << 8 | txDataset.txAgcValue = agcValueHighByte << 8 |
@ -582,17 +613,17 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
} }
} }
void SyrlinksHkHandler::parseAgcHighByte(const uint8_t* packet) { void SyrlinksHandler::parseAgcHighByte(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
agcValueHighByte = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); agcValueHighByte = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
} }
void SyrlinksHkHandler::setNormalDatapoolEntriesInvalid() {} void SyrlinksHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1500; }
ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t SyrlinksHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_SENSITIVITY, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(syrlinks::RX_SENSITIVITY, new PoolEntry<uint32_t>({0}));
@ -618,26 +649,174 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
return returnvalue::OK; return returnvalue::OK;
} }
void SyrlinksHkHandler::setModeNormal() { setMode(MODE_NORMAL); } void SyrlinksHandler::setModeNormal() { setMode(MODE_NORMAL); }
float SyrlinksHkHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67.87; } float SyrlinksHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67.87; }
ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) { ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
ReturnValue_t result = ReturnValue_t result =
parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE)); parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE));
if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result != returnvalue::OK) { switch (rememberCommandId) {
startupState = StartupState::OFF; case (syrlinks::WRITE_LCL_CONFIG): {
} else if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result == returnvalue::OK) { if (isTransitionalMode()) {
startupState = StartupState::DONE; if (result != returnvalue::OK) {
internalState = InternalState::OFF;
} else if (result == returnvalue::OK) {
commandExecuted = true;
}
}
break;
}
case (syrlinks::SET_WAVEFORM_BPSK):
case (syrlinks::SET_WAVEFORM_0QPSK):
case (syrlinks::SET_TX_MODE_STANDBY):
case (syrlinks::SET_TX_MODE_MODULATION):
case (syrlinks::SET_TX_MODE_CW): {
if (result == returnvalue::OK and isTransitionalMode()) {
commandExecuted = true;
}
break;
}
}
switch (rememberCommandId) {
case (syrlinks::SET_TX_MODE_STANDBY): {
triggerEvent(syrlinks::TX_OFF, 0, 0);
break;
}
case (syrlinks::SET_TX_MODE_MODULATION):
case (syrlinks::SET_TX_MODE_CW): {
triggerEvent(syrlinks::TX_ON, getSubmode(), datarateCfgRaw);
break;
}
} }
return result; return result;
} }
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) { ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
if (mode == HasModesIF::MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) {
if (submode >= syrlinks::Submode::NUM_SUBMODES) {
return HasModesIF::INVALID_SUBMODE;
}
return returnvalue::OK;
}
return DeviceHandlerBase::isModeCombinationValid(mode, submode);
}
ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues,
uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(datarateCfgRaw);
return returnvalue::OK;
}
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex);
}
void SyrlinksHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
command.copy(reinterpret_cast<char*>(commandBuffer), command.size(), 0); command.copy(reinterpret_cast<char*>(commandBuffer), command.size(), 0);
rawPacketLen = command.size(); rawPacketLen = command.size();
rememberCommandId = commandId; rememberCommandId = commandId;
rawPacket = commandBuffer; rawPacket = commandBuffer;
} }
void SyrlinksHkHandler::setDebugMode(bool enable) { this->debugMode = enable; } void SyrlinksHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
Mode_t tgtMode = getBaseMode(getMode());
auto commandDone = [&]() {
setMode(tgtMode);
internalState = InternalState::IDLE;
};
auto txOnHandler = [&](InternalState selMod) {
if (internalState == InternalState::IDLE) {
commandExecuted = false;
internalState = selMod;
}
// Select modulation first (BPSK or 0QPSK).
if (internalState == selMod) {
if (commandExecuted) {
internalState = InternalState::SET_TX_MODULATION;
commandExecuted = false;
}
}
// Now go into modulation mode.
if (internalState == InternalState::SET_TX_MODULATION) {
if (commandExecuted) {
commandDone();
return true;
}
}
return false;
};
auto txStandbyHandler = [&]() {
if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;
}
if (internalState == InternalState::SET_TX_STANDBY) {
if (commandExecuted) {
commandDone();
return;
}
}
};
if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) {
switch (getSubmode()) {
case (syrlinks::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK)) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
} else if (datarateCfgRaw ==
static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
}
break;
}
case (syrlinks::Submode::RX_AND_TX_LOW_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
break;
}
case (syrlinks::Submode::RX_AND_TX_HIGH_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
break;
}
case (syrlinks::Submode::RX_ONLY): {
txStandbyHandler();
return;
}
case (syrlinks::Submode::RX_AND_TX_CW): {
if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;
}
if (commandExecuted) {
commandDone();
return;
}
break;
}
default: {
commandDone();
}
}
} else if (tgtMode == HasModesIF::MODE_OFF) {
txStandbyHandler();
}
}

View File

@ -1,5 +1,5 @@
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #ifndef MISSION_DEVICES_SYRLINKSHANDLER_H_
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #define MISSION_DEVICES_SYRLINKSHANDLER_H_
#include <string.h> #include <string.h>
@ -7,6 +7,7 @@
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/timemanager/Countdown.h" #include "fsfw/timemanager/Countdown.h"
#include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/gpio/Gpio.h"
#include "mission/comDefs.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
@ -18,11 +19,11 @@
* *
* @author J. Meier * @author J. Meier
*/ */
class SyrlinksHkHandler : public DeviceHandlerBase { class SyrlinksHandler : public DeviceHandlerBase {
public: public:
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir); power::Switch_t powerSwitch, FailureIsolationBase* customFdir);
virtual ~SyrlinksHkHandler(); virtual ~SyrlinksHandler();
/** /**
* @brief Sets mode to MODE_NORMAL. Can be used for debugging. * @brief Sets mode to MODE_NORMAL. Can be used for debugging.
@ -34,6 +35,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
protected: protected:
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
@ -49,6 +52,10 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
// Parameter IF
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
@ -97,6 +104,9 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
syrlinks::TemperatureSet temperatureSet; syrlinks::TemperatureSet temperatureSet;
const power::Switch_t powerSwitch = power::NO_SWITCH; const power::Switch_t powerSwitch = power::NO_SWITCH;
// Use uint8_t for compatibility with parameter interface
uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
// com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false; bool debugMode = false;
uint8_t agcValueHighByte = 0; uint8_t agcValueHighByte = 0;
@ -104,12 +114,22 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
uint16_t rawTempBasebandBoard = 0; uint16_t rawTempBasebandBoard = 0;
float tempPowerAmplifier = 0; float tempPowerAmplifier = 0;
float tempBasebandBoard = 0; float tempBasebandBoard = 0;
bool commandExecuted = false;
uint8_t commandBuffer[syrlinks::MAX_COMMAND_SIZE]; uint8_t commandBuffer[syrlinks::MAX_COMMAND_SIZE];
enum class StartupState { OFF, ENABLE_TEMPERATURE_PROTECTION, DONE }; enum class InternalState {
OFF,
ENABLE_TEMPERATURE_PROTECTION,
SELECT_MODULATION_BPSK,
SELECT_MODULATION_0QPSK,
SET_TX_MODULATION,
SET_TX_CW,
SET_TX_STANDBY,
IDLE
};
StartupState startupState = StartupState::OFF; InternalState internalState = InternalState::OFF;
/** /**
* This object is used to store the id of the next command to execute. This controls the * This object is used to store the id of the next command to execute. This controls the
@ -216,7 +236,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
}; };
template <typename T> template <typename T>
T SyrlinksHkHandler::convertHexStringTo32bit(const char* characters, uint8_t numberOfChars) { T SyrlinksHandler::convertHexStringTo32bit(const char* characters, uint8_t numberOfChars) {
if (sizeof(T) < 4) { if (sizeof(T) < 4) {
sif::error << "SyrlinksHkHandler::convertHexStringToRaw: Only works for 32-bit conversion" sif::error << "SyrlinksHkHandler::convertHexStringToRaw: Only works for 32-bit conversion"
<< std::endl; << std::endl;
@ -244,4 +264,4 @@ T SyrlinksHkHandler::convertHexStringTo32bit(const char* characters, uint8_t num
return 0; return 0;
} }
} }
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */ #endif /* MISSION_DEVICES_SYRLINKSHANDLER_H_ */

View File

@ -6,9 +6,24 @@
namespace syrlinks { namespace syrlinks {
enum class ParameterId : uint8_t { DATARATE = 0 };
enum Submode {
RX_ONLY,
RX_AND_TX_DEFAULT_DATARATE,
RX_AND_TX_LOW_DATARATE,
RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES
};
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM); static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Transmitter is on now. P1: Submode, P2: Current default datarate.
static constexpr Event TX_ON = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
//! [EXPORT] : [COMMENT] Transmitter is off now.
static constexpr Event TX_OFF = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
static const DeviceCommandId_t NONE = 0; static const DeviceCommandId_t NONE = 0;
static const DeviceCommandId_t RESET_UNIT = 1; static const DeviceCommandId_t RESET_UNIT = 1;
@ -31,9 +46,9 @@ static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_HIGH_BYTE = 13;
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14; static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16;
static const DeviceCommandId_t CONFIG_OQPSK = 17; static const DeviceCommandId_t SET_WAVEFORM_0QPSK = 17;
// After startup syrlinks always in BSPK configuration // After startup syrlinks always in BSPK configuration
static const DeviceCommandId_t CONFIG_BPSK = 18; static const DeviceCommandId_t SET_WAVEFORM_BPSK = 18;
static const DeviceCommandId_t ENABLE_DEBUG = 20; static const DeviceCommandId_t ENABLE_DEBUG = 20;
static const DeviceCommandId_t DISABLE_DEBUG = 21; static const DeviceCommandId_t DISABLE_DEBUG = 21;