eive-obsw/mission/system/RwAssembly.h
Robin Mueller 91b69eacf6
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
A lot of stuff
- refactored and simplified RW assemblies
- create separate SPI Com IF for RWs
- Update .cproject file: Fixed to decrease indexer parsing times
2022-05-11 01:48:26 +02:00

52 lines
1.7 KiB
C++

#ifndef MISSION_SYSTEM_RWASS_H_
#define MISSION_SYSTEM_RWASS_H_
#include <fsfw/devicehandlers/AssemblyBase.h>
#include <fsfw/power/PowerSwitcher.h>
struct RwHelper {
RwHelper(std::array<object_id_t, 4> rwIds) : rwIds(rwIds) {}
std::array<object_id_t, 4> rwIds = {};
};
class RwAssembly : public AssemblyBase {
public:
RwAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
power::Switch_t switcher, RwHelper helper);
private:
static constexpr uint8_t NUMBER_RWS = 4;
RwHelper helper;
PowerSwitcher switcher;
bool warningSwitch = true;
bool modeTransitionFailedSwitch = true;
FixedArrayList<ModeListEntry, NUMBER_RWS> modeTable;
ReturnValue_t initialize() override;
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
/**
* 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);
// AssemblyBase implementation
void performChildOperation() override;
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 startTransition(Mode_t mode, Submode_t submode) override;
void handleModeReached() override;
// These two overrides prevent a transition of the whole assembly back to off just because
// some devices are not working
void handleChildrenLostMode(ReturnValue_t result) override;
void handleModeTransitionFailed(ReturnValue_t result) override;
};
#endif /* MISSION_SYSTEM_RWASS_H_ */