53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
|
#ifndef MISSION_SYSTEM_SUSASSEMBLY_H_
|
||
|
#define MISSION_SYSTEM_SUSASSEMBLY_H_
|
||
|
|
||
|
#include <fsfw/devicehandlers/AssemblyBase.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 : AssemblyBase {
|
||
|
public:
|
||
|
static constexpr uint8_t NUMBER_SUN_SENSORS = 12;
|
||
|
|
||
|
static constexpr Submode_t NOMINAL = 0;
|
||
|
static constexpr Submode_t REDUNDANT = 1;
|
||
|
static constexpr Submode_t DUAL_MODE = 2;
|
||
|
|
||
|
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;
|
||
|
|
||
|
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;
|
||
|
|
||
|
/**
|
||
|
* 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);
|
||
|
void refreshHelperModes();
|
||
|
};
|
||
|
|
||
|
#endif /* MISSION_SYSTEM_SUSASSEMBLY_H_ */
|