Robin Mueller
3cfb58d681
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
67 lines
2.4 KiB
C++
67 lines
2.4 KiB
C++
#ifndef MISSION_SYSTEM_SUSASSEMBLY_H_
|
|
#define MISSION_SYSTEM_SUSASSEMBLY_H_
|
|
|
|
#include <devices/powerSwitcherList.h>
|
|
#include <fsfw/devicehandlers/AssemblyBase.h>
|
|
|
|
#include "DualLaneAssemblyBase.h"
|
|
|
|
struct SusAssHelper {
|
|
public:
|
|
SusAssHelper(std::array<object_id_t, 12> susIds) : susIds(susIds) {}
|
|
std::array<object_id_t, 12> susIds = {objects::NO_OBJECT};
|
|
std::array<Mode_t, 12> susModes = {HasModesIF::MODE_OFF};
|
|
};
|
|
|
|
class PowerSwitchIF;
|
|
|
|
class SusAssembly : DualLaneAssemblyBase {
|
|
public:
|
|
static constexpr uint8_t NUMBER_SUN_SENSORS_ONE_SIDE = 6;
|
|
static constexpr uint8_t NUMBER_SUN_SENSORS = 12;
|
|
|
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SUS_BOARD_ASS;
|
|
static constexpr Event TRANSITION_OTHER_SIDE_FAILED =
|
|
event::makeEvent(SUBSYSTEM_ID, TRANSITION_OTHER_SIDE_FAILED_ID, severity::HIGH);
|
|
static constexpr Event NOT_ENOUGH_DEVICES_DUAL_MODE =
|
|
event::makeEvent(SUBSYSTEM_ID, NOT_ENOUGH_DEVICES_DUAL_MODE_ID, severity::HIGH);
|
|
static constexpr Event POWER_STATE_MACHINE_TIMEOUT =
|
|
event::makeEvent(SUBSYSTEM_ID, POWER_STATE_MACHINE_TIMEOUT_ID, severity::MEDIUM);
|
|
|
|
SusAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
|
|
SusAssHelper helper);
|
|
|
|
private:
|
|
enum class States { IDLE, SWITCHING_POWER, MODE_COMMANDING } state = States::IDLE;
|
|
static constexpr pcduSwitches::Switches SWITCH_NOM =
|
|
pcduSwitches::Switches::PDU1_CH4_SUS_NOMINAL_3V3;
|
|
static constexpr pcduSwitches::Switches SWITCH_RED =
|
|
pcduSwitches::Switches::PDU2_CH4_SUS_REDUNDANT_3V3;
|
|
FixedArrayList<ModeListEntry, NUMBER_SUN_SENSORS> modeTable;
|
|
|
|
SusAssHelper helper;
|
|
PowerSwitchIF* pwrSwitcher = nullptr;
|
|
|
|
ReturnValue_t initialize() override;
|
|
|
|
// AssemblyBase overrides
|
|
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 handleModeReached() override;
|
|
void handleModeTransitionFailed(ReturnValue_t result) override;
|
|
|
|
/**
|
|
* Check whether it makes sense to send mode commands to the device
|
|
* @param object
|
|
* @param mode
|
|
* @return
|
|
*/
|
|
bool isUseable(object_id_t object, Mode_t mode);
|
|
void powerStateMachine(Mode_t mode, Submode_t submode);
|
|
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
|
|
void refreshHelperModes();
|
|
};
|
|
|
|
#endif /* MISSION_SYSTEM_SUSASSEMBLY_H_ */
|