testArduino/mission/Controller/TCS_Heater.h

61 lines
1.8 KiB
C++

#ifndef TCS_HEATER_H_
#define TCS_HEATER_H_
//#include <fsfw/devicehandlers/HealthDevice.h>
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/power/PowerSwitchIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/timemanager/Countdown.h>
#include <stdint.h>
#include <fsfw/thermal/Heater.h>
class TCS_Heater: public Heater {
public:
TCS_Heater(uint32_t objectId, uint8_t switchId);
virtual ~TCS_Heater();
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
ReturnValue_t set();
void clear(bool passive);
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
//virtual MessageQueueId_t getCommandQueue() const;
protected:
static const uint32_t INVALID_UPTIME = 0;
enum InternalState {
STATE_ON,
STATE_OFF,
STATE_PASSIVE,
STATE_WAIT_FOR_SWITCHES_ON,
STATE_WAIT_FOR_SWITCHES_OFF,
STATE_WAIT_FOR_FDIR, //used to avoid doing anything until fdir decided what to do
STATE_FAULTY,
STATE_WAIT, //used when waiting for system to recover from miniops
STATE_EXTERNAL_CONTROL //entered when under external control and a fdir reaction would be triggered. This is useful when leaving external control into an unknown state
//if no fdir reaction is triggered under external control the state is still ok and no need for any special treatment is needed
} internalState;
PowerSwitchIF *powerSwitcher;
MessageQueueId_t pcduQueueId;
uint8_t switchId;
bool wasOn;
bool timedOut;
bool reactedToBeingFaulty;
bool passive;
MessageQueueIF* eventQueue;
Countdown heaterOnCountdown;
Countdown switchCountdown;
ParameterHelper parameterHelper;
void doAction(Action action);
};
#endif /* TCS_HEATER_H_ */