Merge remote-tracking branch 'origin/develop' into mueller/refactoring-conf-handling

This commit is contained in:
Robin Müller 2022-05-03 00:01:55 +02:00
commit 0f4fe7694b
31 changed files with 366 additions and 42 deletions

View File

@ -13,6 +13,12 @@ list yields a list of all related PRs for each release.
# [v1.11.0] # [v1.11.0]
## Added
- Custom Syrlinks FDIR which disabled most of the default FDIR functionality
## Changed ## Changed
- PCDU handler only called once in PST, but can handle multiple messages now - PCDU handler only called once in PST, but can handle multiple messages now

View File

@ -1,5 +1,8 @@
#include "bsp_q7s/core/ObjectFactory.h" #include "bsp_q7s/core/ObjectFactory.h"
#include <mission/system/fdir/GomspacePowerFdir.h>
#include <mission/system/fdir/SyrlinksFdir.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/callbacks/gnssCallback.h" #include "bsp_q7s/callbacks/gnssCallback.h"
@ -37,11 +40,11 @@
#include "linux/obc/PdecHandler.h" #include "linux/obc/PdecHandler.h"
#include "linux/obc/Ptme.h" #include "linux/obc/Ptme.h"
#include "linux/obc/PtmeConfig.h" #include "linux/obc/PtmeConfig.h"
#include "mission/system/AcsBoardFdir.h"
#include "mission/system/RtdFdir.h"
#include "mission/system/SusAssembly.h" #include "mission/system/SusAssembly.h"
#include "mission/system/SusFdir.h"
#include "mission/system/TcsBoardAssembly.h" #include "mission/system/TcsBoardAssembly.h"
#include "mission/system/fdir/AcsBoardFdir.h"
#include "mission/system/fdir/RtdFdir.h"
#include "mission/system/fdir/SusFdir.h"
#include "tmtc/apid.h" #include "tmtc/apid.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
@ -251,14 +254,22 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
/* Device Handler */
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
P60DockHandler* p60dockhandler = P60DockHandler* p60dockhandler =
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie, p60Fdir);
auto pdu1Fdir = new GomspacePowerFdir(objects::PDU1_HANDLER);
PDU1Handler* pdu1handler = PDU1Handler* pdu1handler =
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie, pdu1Fdir);
auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER);
PDU2Handler* pdu2handler = PDU2Handler* pdu2handler =
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie);
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
ACUHandler* acuhandler =
new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir);
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50);
/** /**
@ -641,8 +652,10 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven(); syrlinksUartCookie->setParityEven();
auto syrlinksHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V); auto syrlinksHandler =
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher); syrlinksHandler->setPowerSwitcher(pwrSwitcher);
#if OBSW_DEBUG_SYRLINKS == 1 #if OBSW_DEBUG_SYRLINKS == 1
syrlinksHandler->setDebugMode(true); syrlinksHandler->setDebugMode(true);

View File

@ -30,6 +30,7 @@ enum: uint8_t {
PDU1_HANDLER = 133, PDU1_HANDLER = 133,
PDU2_HANDLER = 134, PDU2_HANDLER = 134,
ACU_HANDLER = 135, ACU_HANDLER = 135,
SYRLINKS = 136,
COMMON_SUBSYSTEM_ID_END COMMON_SUBSYSTEM_ID_END
}; };
} }

View File

@ -9,10 +9,10 @@
#include <linux/callbacks/gpioCallbacks.h> #include <linux/callbacks/gpioCallbacks.h>
#include <mission/devices/Max31865PT1000Handler.h> #include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/SusHandler.h> #include <mission/devices/SusHandler.h>
#include <mission/system/RtdFdir.h>
#include <mission/system/SusAssembly.h> #include <mission/system/SusAssembly.h>
#include <mission/system/SusFdir.h>
#include <mission/system/TcsBoardAssembly.h> #include <mission/system/TcsBoardAssembly.h>
#include <mission/system/fdir/RtdFdir.h>
#include <mission/system/fdir/SusFdir.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "devConf.h" #include "devConf.h"

View File

@ -2,8 +2,9 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
: GomspaceDeviceHandler(objectId, comIF, comCookie, ACU::MAX_CONFIGTABLE_ADDRESS, FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE), ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
acuHkTableDataset(this) {} acuHkTableDataset(this) {}

View File

@ -12,7 +12,8 @@
*/ */
class ACUHandler : public GomspaceDeviceHandler { class ACUHandler : public GomspaceDeviceHandler {
public: public:
ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie); ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir);
virtual ~ACUHandler(); virtual ~ACUHandler();
void setDebugMode(bool enable); void setDebugMode(bool enable);

View File

@ -7,9 +7,10 @@
#include "devicedefinitions/powerDefinitions.h" #include "devicedefinitions/powerDefinitions.h"
GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF, GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF,
CookieIF* comCookie, uint16_t maxConfigTableAddress, CookieIF* comCookie, FailureIsolationBase* customFdir,
uint16_t maxConfigTableAddress,
uint16_t maxHkTableAddress, uint16_t hkTableReplySize) uint16_t maxHkTableAddress, uint16_t hkTableReplySize)
: DeviceHandlerBase(objectId, comIF, comCookie), : DeviceHandlerBase(objectId, comIF, comCookie, customFdir),
maxConfigTableAddress(maxConfigTableAddress), maxConfigTableAddress(maxConfigTableAddress),
maxHkTableAddress(maxHkTableAddress), maxHkTableAddress(maxHkTableAddress),
hkTableReplySize(hkTableReplySize) { hkTableReplySize(hkTableReplySize) {

View File

@ -38,8 +38,8 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
* device. * device.
*/ */
GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress, FailureIsolationBase *customFdir, uint16_t maxConfigTableAddress,
uint16_t hkTableReplySize); uint16_t maxHkTableAddress, uint16_t hkTableReplySize);
virtual ~GomspaceDeviceHandler(); virtual ~GomspaceDeviceHandler();
/** /**

View File

@ -4,9 +4,11 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
: GomspaceDeviceHandler(objectId, comIF, comCookie, P60Dock::MAX_CONFIGTABLE_ADDRESS, FailureIsolationBase *customFdir)
P60Dock::MAX_HKTABLE_ADDRESS, P60Dock::HK_TABLE_REPLY_SIZE), : GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir,
P60Dock::MAX_CONFIGTABLE_ADDRESS, P60Dock::MAX_HKTABLE_ADDRESS,
P60Dock::HK_TABLE_REPLY_SIZE),
coreHk(this), coreHk(this),
auxHk(this) {} auxHk(this) {}

View File

@ -21,7 +21,8 @@ class P60DockHandler : public GomspaceDeviceHandler {
//! [EXPORT] : [COMMENT] Battery mode has changed. P1: Old mode. P2: New mode //! [EXPORT] : [COMMENT] Battery mode has changed. P1: Old mode. P2: New mode
static constexpr Event BATT_MODE_CHANGED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM); static constexpr Event BATT_MODE_CHANGED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie); P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir);
virtual ~P60DockHandler(); virtual ~P60DockHandler();
void setDebugMode(bool enable); void setDebugMode(bool enable);

View File

@ -100,14 +100,9 @@ void PCDUHandler::readCommandQueue() {
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
result = commandQueue->receiveMessage(&command)) { result = commandQueue->receiveMessage(&command)) {
result = commandQueue->receiveMessage(&command);
if (result != RETURN_OK) {
return;
}
result = poolManager.handleHousekeepingMessage(&command); result = poolManager.handleHousekeepingMessage(&command);
if (result == RETURN_OK) { if (result == RETURN_OK) {
return; continue;
} }
} }
} }

View File

@ -5,8 +5,9 @@
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
: GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE),
coreHk(this), coreHk(this),
auxHk(this) {} auxHk(this) {}

View File

@ -21,7 +21,8 @@
*/ */
class PDU1Handler : public GomspaceDeviceHandler { class PDU1Handler : public GomspaceDeviceHandler {
public: public:
PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie); PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir);
virtual ~PDU1Handler(); virtual ~PDU1Handler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,

View File

@ -5,8 +5,9 @@
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
: GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE),
coreHk(this), coreHk(this),
auxHk(this) {} auxHk(this) {}

View File

@ -21,7 +21,8 @@
*/ */
class PDU2Handler : public GomspaceDeviceHandler { class PDU2Handler : public GomspaceDeviceHandler {
public: public:
PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie); PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir);
virtual ~PDU2Handler(); virtual ~PDU2Handler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,

View File

@ -5,8 +5,8 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch) power::Switch_t powerSwitch, FailureIsolationBase* customFdir)
: DeviceHandlerBase(objectId, comIF, comCookie), : DeviceHandlerBase(objectId, comIF, comCookie, customFdir),
rxDataset(this), rxDataset(this),
txDataset(this), txDataset(this),
temperatureSet(this), temperatureSet(this),

View File

@ -20,7 +20,7 @@
class SyrlinksHkHandler : public DeviceHandlerBase { class SyrlinksHkHandler : public DeviceHandlerBase {
public: public:
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch); power::Switch_t powerSwitch, FailureIsolationBase* customFdir);
virtual ~SyrlinksHkHandler(); virtual ~SyrlinksHkHandler();
/** /**

View File

@ -1,8 +1,14 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#include <commonSubsystemIds.h>
namespace syrlinks { namespace syrlinks {
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
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;
/** Reads out all status registers */ /** Reads out all status registers */

View File

@ -15,6 +15,8 @@ static constexpr Event SWITCH_CMD_SENT = event::makeEvent(SUBSYSTEM_ID, 0, sever
static constexpr Event SWITCH_HAS_CHANGED = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO); static constexpr Event SWITCH_HAS_CHANGED = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
static constexpr Event SWITCHING_Q7S_DENIED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM); static constexpr Event SWITCHING_Q7S_DENIED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
} // namespace power } // namespace power
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_POWERDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_POWERDEFINITIONS_H_ */

View File

@ -10,8 +10,6 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
PowerStateMachineBase.cpp PowerStateMachineBase.cpp
DualLaneAssemblyBase.cpp DualLaneAssemblyBase.cpp
TcsBoardAssembly.cpp TcsBoardAssembly.cpp
)
AcsBoardFdir.cpp add_subdirectory(fdir)
SusFdir.cpp
RtdFdir.cpp
)

View File

@ -0,0 +1,7 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE
AcsBoardFdir.cpp
RtdFdir.cpp
SusFdir.cpp
SyrlinksFdir.cpp
GomspacePowerFdir.cpp
)

View File

@ -0,0 +1,128 @@
#include "GomspacePowerFdir.h"
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
#include "fsfw/health/HealthTableIF.h"
#include "fsfw/modes/HasModesIF.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/power/Fuse.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/thermal/ThermalComponentIF.h"
#include "mission/devices/devicedefinitions/powerDefinitions.h"
GomspacePowerFdir::GomspacePowerFdir(object_id_t devId, object_id_t parentId)
: DeviceHandlerFailureIsolation(devId, parentId) {}
ReturnValue_t GomspacePowerFdir::eventReceived(EventMessage* event) {
if (isFdirInActionOrAreWeFaulty(event)) {
return RETURN_OK;
}
ReturnValue_t result = RETURN_FAILED;
switch (event->getEvent()) {
case HasModesIF::MODE_TRANSITION_FAILED:
case HasModesIF::OBJECT_IN_INVALID_MODE:
case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT:
// We'll try a recovery as long as defined in MAX_REBOOT.
// Might cause some AssemblyBase cycles, so keep number low.
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_UNREQUESTED_REPLY:
case DeviceHandlerIF::DEVICE_UNKNOWN_REPLY: // Some DH's generate generic reply-ids.
case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED:
// These faults all mean that there were stupid replies from a device.
if (strangeReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
// The two above should never be confirmed.
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
result = sendConfirmationRequest(event);
if (result == HasReturnvaluesIF::RETURN_OK) {
break;
}
// else
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case StorageManagerIF::GET_DATA_FAILED:
case StorageManagerIF::STORE_DATA_FAILED:
// Rather strange bugs, occur in RAW mode only. Ignore.
break;
case DeviceHandlerIF::INVALID_DEVICE_COMMAND:
// Ignore, is bad configuration. We can't do anything in flight.
break;
case HasHealthIF::HEALTH_INFO:
case HasModesIF::MODE_INFO:
case HasModesIF::CHANGING_MODE:
// Do nothing, but mark as handled.
break;
//****Power*****
case PowerSwitchIF::SWITCH_WENT_OFF:
if (powerConfirmation != MessageQueueIF::NO_QUEUE) {
result = sendConfirmationRequest(event, powerConfirmation);
if (result == RETURN_OK) {
setFdirState(DEVICE_MIGHT_BE_OFF);
}
}
break;
case Fuse::FUSE_WENT_OFF:
// Not so good, because PCDU reacted.
case Fuse::POWER_ABOVE_HIGH_LIMIT:
// Better, because software detected over-current.
setFaulty(event->getEvent());
break;
case Fuse::POWER_BELOW_LOW_LIMIT:
// Device might got stuck during boot, retry.
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
//****Thermal*****
case ThermalComponentIF::COMPONENT_TEMP_LOW:
case ThermalComponentIF::COMPONENT_TEMP_HIGH:
case ThermalComponentIF::COMPONENT_TEMP_OOL_LOW:
case ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH:
// Well, the device is not really faulty, but it is required to stay off as long as possible.
setFaulty(event->getEvent());
break;
case ThermalComponentIF::TEMP_NOT_IN_OP_RANGE:
// Ignore, is information only.
break;
//*******Default monitoring variables. Are currently not used.*****
// case DeviceHandlerIF::MONITORING_LIMIT_EXCEEDED:
// setFaulty(event->getEvent());
// break;
// case DeviceHandlerIF::MONITORING_AMBIGUOUS:
// break;
default:
// We don't know the event, someone else should handle it.
return RETURN_FAILED;
}
return RETURN_OK;
}
void GomspacePowerFdir::eventConfirmed(EventMessage* event) {
switch (event->getEvent()) {
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case PowerSwitchIF::SWITCH_WENT_OFF:
// This means the switch went off only for one device.
// handleRecovery(event->getEvent());
triggerEvent(power::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
default:
break;
}
}

View File

@ -0,0 +1,15 @@
#ifndef MISSION_SYSTEM_FDIR_GOMSPACEPOWERFDIR_H_
#define MISSION_SYSTEM_FDIR_GOMSPACEPOWERFDIR_H_
#include <fsfw/devicehandlers/DeviceHandlerFailureIsolation.h>
class GomspacePowerFdir : public DeviceHandlerFailureIsolation {
public:
GomspacePowerFdir(object_id_t devId, object_id_t parentId = objects::NO_OBJECT);
private:
ReturnValue_t eventReceived(EventMessage* event) override;
void eventConfirmed(EventMessage* event) override;
};
#endif /* MISSION_SYSTEM_FDIR_GOMSPACEPOWERFDIR_H_ */

View File

@ -0,0 +1,128 @@
#include "SyrlinksFdir.h"
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
#include "fsfw/health/HealthTableIF.h"
#include "fsfw/modes/HasModesIF.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/power/Fuse.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/thermal/ThermalComponentIF.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
SyrlinksFdir::SyrlinksFdir(object_id_t syrlinksId)
: DeviceHandlerFailureIsolation(syrlinksId, objects::NO_OBJECT) {}
ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
if (isFdirInActionOrAreWeFaulty(event)) {
return RETURN_OK;
}
ReturnValue_t result = RETURN_FAILED;
switch (event->getEvent()) {
case HasModesIF::MODE_TRANSITION_FAILED:
case HasModesIF::OBJECT_IN_INVALID_MODE:
case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT:
// We'll try a recovery as long as defined in MAX_REBOOT.
// Might cause some AssemblyBase cycles, so keep number low.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_UNREQUESTED_REPLY:
case DeviceHandlerIF::DEVICE_UNKNOWN_REPLY: // Some DH's generate generic reply-ids.
case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED:
// These faults all mean that there were stupid replies from a device.
if (strangeReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
// The two above should never be confirmed.
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
result = sendConfirmationRequest(event);
if (result == HasReturnvaluesIF::RETURN_OK) {
break;
}
// else
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case StorageManagerIF::GET_DATA_FAILED:
case StorageManagerIF::STORE_DATA_FAILED:
// Rather strange bugs, occur in RAW mode only. Ignore.
break;
case DeviceHandlerIF::INVALID_DEVICE_COMMAND:
// Ignore, is bad configuration. We can't do anything in flight.
break;
case HasHealthIF::HEALTH_INFO:
case HasModesIF::MODE_INFO:
case HasModesIF::CHANGING_MODE:
// Do nothing, but mark as handled.
break;
//****Power*****
case PowerSwitchIF::SWITCH_WENT_OFF:
if (powerConfirmation != MessageQueueIF::NO_QUEUE) {
result = sendConfirmationRequest(event, powerConfirmation);
if (result == RETURN_OK) {
setFdirState(DEVICE_MIGHT_BE_OFF);
}
}
break;
case Fuse::FUSE_WENT_OFF:
// Not so good, because PCDU reacted.
case Fuse::POWER_ABOVE_HIGH_LIMIT:
// Better, because software detected over-current.
setFaulty(event->getEvent());
break;
case Fuse::POWER_BELOW_LOW_LIMIT:
// Device might got stuck during boot, retry.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
//****Thermal*****
case ThermalComponentIF::COMPONENT_TEMP_LOW:
case ThermalComponentIF::COMPONENT_TEMP_HIGH:
case ThermalComponentIF::COMPONENT_TEMP_OOL_LOW:
case ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH:
// Well, the device is not really faulty, but it is required to stay off as long as possible.
setFaulty(event->getEvent());
break;
case ThermalComponentIF::TEMP_NOT_IN_OP_RANGE:
// Ignore, is information only.
break;
//*******Default monitoring variables. Are currently not used.*****
// case DeviceHandlerIF::MONITORING_LIMIT_EXCEEDED:
// setFaulty(event->getEvent());
// break;
// case DeviceHandlerIF::MONITORING_AMBIGUOUS:
// break;
default:
// We don't know the event, someone else should handle it.
return RETURN_FAILED;
}
return RETURN_OK;
}
void SyrlinksFdir::eventConfirmed(EventMessage* event) {
switch (event->getEvent()) {
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case PowerSwitchIF::SWITCH_WENT_OFF:
// This means the switch went off only for one device.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
default:
break;
}
}

View File

@ -0,0 +1,15 @@
#ifndef MISSION_DEVICES_SYRLINKSFDIR_H_
#define MISSION_DEVICES_SYRLINKSFDIR_H_
#include <fsfw/devicehandlers/DeviceHandlerFailureIsolation.h>
class SyrlinksFdir : public DeviceHandlerFailureIsolation {
public:
SyrlinksFdir(object_id_t syrlinksId);
private:
ReturnValue_t eventReceived(EventMessage* event) override;
void eventConfirmed(EventMessage* event) override;
};
#endif /* MISSION_DEVICES_SYRLINKSFDIR_H_ */