first version of ACS board ASS working
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

- Testes transition OFF to NORMAL for A side
- Refactored power switching so it can be used by SUS ass as well
- Generate events for sending switch command
- Generate event if switch state changes
- Deny Q7S switch commanding
This commit is contained in:
2022-03-05 03:02:09 +01:00
parent cbb8103278
commit 32def71502
17 changed files with 469 additions and 274 deletions

View File

@ -6,6 +6,8 @@
#include <fsfw/devicehandlers/AssemblyBase.h>
#include <fsfw/objectmanager/frameworkObjects.h>
#include "DualLanePowerStateMachine.h"
struct AcsBoardHelper {
AcsBoardHelper(object_id_t mgm0Id, object_id_t mgm1Id, object_id_t mgm2Id, object_id_t mgm3Id,
object_id_t gyro0Id, object_id_t gyro1Id, object_id_t gyro2Id, object_id_t gyro3Id,
@ -58,6 +60,17 @@ enum ModeTableIdx : uint8_t {
class PowerSwitchIF;
class GpioIF;
/**
* @brief Assembly class which manages redundant ACS board sides
* @details
* This class takes care of ensuring that enough devices on the ACS board are available at all
* times. It does so by doing autonomous transitions to the redundant side or activating both sides
* if not enough devices are available.
*
* This class also takes care of switching on the A side and/or B side power lanes. Normally,
* doing this task would be performed by the device handlers, but this is not possible for the
* ACS board where multiple sensors share the same power supply.
*/
class AcsBoardAssembly : public AssemblyBase {
public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_BOARD_ASS;
@ -67,19 +80,17 @@ class AcsBoardAssembly : public AssemblyBase {
event::makeEvent(SUBSYSTEM_ID, 1, severity::HIGH);
static constexpr uint8_t NUMBER_DEVICES_MODE_TABLE = 9;
enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
AcsBoardAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
AcsBoardHelper helper, GpioIF* gpioIF);
void setPreferredSide(Submodes submode);
void setPreferredSide(duallane::Submodes submode);
/**
* In dual mode, the A side or the B side GPS device can be used, but not both.
* This function can be used to switch the used GPS device.
* @param side
*/
void selectGpsInDualMode(Submodes side);
void selectGpsInDualMode(duallane::Submodes side);
private:
static constexpr pcduSwitches::Switches SWITCH_A =
@ -87,13 +98,13 @@ class AcsBoardAssembly : public AssemblyBase {
static constexpr pcduSwitches::Switches SWITCH_B =
pcduSwitches::Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3;
enum class States { IDLE, SWITCHING_POWER, MODE_COMMANDING } state = States::IDLE;
PowerSwitchIF* pwrSwitcher = nullptr;
// This helper object complete encapsulates power switching
DualLanePowerStateMachine pwrStateMachine;
bool tryingOtherSide = false;
AcsBoardHelper helper;
GpioIF* gpioIF = nullptr;
Submodes defaultSubmode = Submodes::A_SIDE;
duallane::PwrStates state = duallane::PwrStates::IDLE;
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
bool dualModeErrorSwitch = true;
FixedArrayList<ModeListEntry, NUMBER_DEVICES_MODE_TABLE> modeTable;
@ -103,7 +114,8 @@ class AcsBoardAssembly : public AssemblyBase {
ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override;
ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override;
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
void handleChildrenTransition() override;
void performChildOperation() override;
void startTransition(Mode_t mode, Submode_t submode) override;
void handleModeReached() override;
void handleModeTransitionFailed(ReturnValue_t result) override;
void handleChildrenLostMode(ReturnValue_t result) override;
@ -116,9 +128,16 @@ class AcsBoardAssembly : public AssemblyBase {
*/
bool isUseable(object_id_t object, Mode_t mode);
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
void powerStateMachine(Mode_t mode, Submode_t submode);
void initModeTableEntry(object_id_t id, ModeListEntry& entry);
void refreshHelperModes();
void finishModeOp();
/**
* Thin wrapper function which is required because the helper class
* can not access protected member functions.
* @param mode
* @param submode
*/
void pwrStateMachineWrapper(Mode_t mode, Submode_t submode);
};
#endif /* MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ */