system folder restructuring
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
33
mission/system/objects/PowerStateMachineBase.cpp
Normal file
33
mission/system/objects/PowerStateMachineBase.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "PowerStateMachineBase.h"
|
||||
|
||||
PowerStateMachineBase::PowerStateMachineBase(PowerSwitchIF *pwrSwitcher, dur_millis_t checkTimeout)
|
||||
: pwrSwitcher(pwrSwitcher), checkTimeout(checkTimeout) {}
|
||||
|
||||
void PowerStateMachineBase::reset() {
|
||||
state = power::States::IDLE;
|
||||
opResult = power::OpCodes::NONE;
|
||||
targetMode = HasModesIF::MODE_OFF;
|
||||
targetSubmode = 0;
|
||||
checkTimeout.resetTimer();
|
||||
}
|
||||
|
||||
void PowerStateMachineBase::setCheckTimeout(dur_millis_t timeout) {
|
||||
checkTimeout.setTimeout(timeout);
|
||||
}
|
||||
|
||||
void PowerStateMachineBase::start(Mode_t mode, Submode_t submode) {
|
||||
reset();
|
||||
checkTimeout.resetTimer();
|
||||
targetMode = mode;
|
||||
targetSubmode = submode;
|
||||
state = power::States::SWITCHING_POWER;
|
||||
}
|
||||
|
||||
power::States PowerStateMachineBase::getState() const { return state; }
|
||||
|
||||
bool PowerStateMachineBase::active() {
|
||||
if (state == power::States::IDLE or state == power::States::MODE_COMMANDING) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
Reference in New Issue
Block a user