some more bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
6503778cd5
commit
557162fe8c
@ -41,6 +41,8 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) {
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
if (switcherSet.p60Dock5VStack.value != switchState) {
|
||||
triggerEvent(power::SWITCH_HAS_CHANGED, switchState, pcdu::Switches::P60_DOCK_5V_STACK);
|
||||
MutexGuard mg(pwrMutex);
|
||||
switchStates[pcdu::P60_DOCK_5V_STACK] = switchState;
|
||||
}
|
||||
switcherSet.p60Dock5VStack.setValid(true);
|
||||
switcherSet.p60Dock5VStack.value = switchState;
|
||||
@ -178,23 +180,23 @@ void PCDUHandler::updatePdu2SwitchStates() {
|
||||
}
|
||||
switcherSet.pdu2Switches.setValid(true);
|
||||
MutexGuard mg(pwrMutex);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]);
|
||||
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH1]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH2_RW_5V, pdu2CoreHk.outputEnables[Channels::RW]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
|
||||
pdu2CoreHk.outputEnables[Channels::TCS_HEATER_IN]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3,
|
||||
pdu2CoreHk.outputEnables[Channels::SUS_REDUNDANT]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
|
||||
pdu2CoreHk.outputEnables[Channels::DEPY_MECHANISM]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH6]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
|
||||
pdu2CoreHk.outputEnables[Channels::ACS_B_SIDE]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_CAMERA]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH1]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH2_RW_5V, pdu2CoreHk.outputEnables[Channels::RW]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
|
||||
pdu2CoreHk.outputEnables[Channels::TCS_HEATER_IN]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3,
|
||||
pdu2CoreHk.outputEnables[Channels::SUS_REDUNDANT]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
|
||||
pdu2CoreHk.outputEnables[Channels::DEPY_MECHANISM]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH6]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
|
||||
pdu2CoreHk.outputEnables[Channels::ACS_B_SIDE]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA,
|
||||
pdu2CoreHk.outputEnables[Channels::PAYLOAD_CAMERA]);
|
||||
if (firstSwitchInfoPdu2) {
|
||||
firstSwitchInfoPdu2 = false;
|
||||
}
|
||||
@ -215,23 +217,24 @@ void PCDUHandler::updatePdu1SwitchStates() {
|
||||
}
|
||||
switcherSet.pdu1Switches.setValid(true);
|
||||
MutexGuard mg(pwrMutex);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V,
|
||||
pdu1CoreHk.outputEnables[Channels::SYRLINKS]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V,
|
||||
pdu1CoreHk.outputEnables[Channels::STR]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH3_MGT_5V, pdu1CoreHk.outputEnables[Channels::MGT]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::SUS_NOMINAL]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V,
|
||||
pdu1CoreHk.outputEnables[Channels::SOL_CELL_EXPERIMENT]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH6_PLOC_12V,
|
||||
pdu1CoreHk.outputEnables[Channels::PLOC]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::ACS_A_SIDE]);
|
||||
checkAndUpdateSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED,
|
||||
pdu1CoreHk.outputEnables[Channels::UNUSED]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V,
|
||||
pdu1CoreHk.outputEnables[Channels::SYRLINKS]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V,
|
||||
pdu1CoreHk.outputEnables[Channels::STR]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH3_MGT_5V,
|
||||
pdu1CoreHk.outputEnables[Channels::MGT]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::SUS_NOMINAL]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V,
|
||||
pdu1CoreHk.outputEnables[Channels::SOL_CELL_EXPERIMENT]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH6_PLOC_12V,
|
||||
pdu1CoreHk.outputEnables[Channels::PLOC]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3,
|
||||
pdu1CoreHk.outputEnables[Channels::ACS_A_SIDE]);
|
||||
checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED,
|
||||
pdu1CoreHk.outputEnables[Channels::UNUSED]);
|
||||
if (firstSwitchInfoPdu1) {
|
||||
firstSwitchInfoPdu1 = false;
|
||||
}
|
||||
@ -450,8 +453,8 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
|
||||
}
|
||||
}
|
||||
|
||||
void PCDUHandler::checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
|
||||
uint8_t setValue) {
|
||||
void PCDUHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
|
||||
uint8_t setValue) {
|
||||
using namespace pcdu;
|
||||
if (switchStates[switchIdx] != setValue) {
|
||||
#if OBSW_INITIALIZE_SWITCHES == 1
|
||||
|
@ -130,7 +130,7 @@ class PCDUHandler : public PowerSwitchIF,
|
||||
*/
|
||||
void updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
|
||||
CCSDSTime::CDS_short* datasetTimeStamp);
|
||||
void checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, uint8_t setValue);
|
||||
void checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, uint8_t setValue);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PCDUHANDLER_H_ */
|
||||
|
@ -9,6 +9,9 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander, bool updateSt
|
||||
if (updateStates) {
|
||||
updateInternalStates();
|
||||
}
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
if (switchIsOn) {
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduIsOn = true;
|
||||
@ -17,10 +20,9 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander, bool updateSt
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
|
||||
handlerState = HandlerState::SWITCH_PENDING;
|
||||
targetState = true;
|
||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON);
|
||||
}
|
||||
|
||||
@ -29,6 +31,11 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander, bool updateS
|
||||
if (updateStates) {
|
||||
updateInternalStates();
|
||||
}
|
||||
// wait for our turn
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
// If the switch is already off, we are done
|
||||
if (not switchIsOn) {
|
||||
if (commander == StackCommander::PL_PCDU) {
|
||||
plPcduIsOn = false;
|
||||
@ -37,14 +44,13 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander, bool updateS
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
return BUSY;
|
||||
}
|
||||
// If one device is still on, do not turn off the switch
|
||||
if ((commander == StackCommander::PL_PCDU and radSensorIsOn) or
|
||||
(commander == StackCommander::RAD_SENSOR and plPcduIsOn)) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
handlerState = HandlerState::SWITCH_PENDING;
|
||||
targetState = false;
|
||||
return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
|
||||
@ -60,22 +66,16 @@ void Stack5VHandler::update() {
|
||||
|
||||
bool Stack5VHandler::updateInternalStates() {
|
||||
if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) {
|
||||
if (not switchIsOn) {
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
}
|
||||
if (handlerState == HandlerState::SWITCH_PENDING and targetState) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
switchIsOn = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (switchIsOn) {
|
||||
if (handlerState == HandlerState::SWITCH_PENDING) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
}
|
||||
} else if (handlerState == HandlerState::SWITCH_PENDING and not targetState) {
|
||||
handlerState = HandlerState::IDLE;
|
||||
switchIsOn = false;
|
||||
radSensorIsOn = false;
|
||||
plPcduIsOn = false;
|
||||
}
|
||||
radSensorIsOn = false;
|
||||
plPcduIsOn = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class Stack5VHandler {
|
||||
MutexIF* stackLock;
|
||||
PowerSwitchIF& switcher;
|
||||
bool switchIsOn = false;
|
||||
bool targetState = false;
|
||||
HandlerState handlerState = HandlerState::IDLE;
|
||||
bool radSensorIsOn = false;
|
||||
bool plPcduIsOn = false;
|
||||
|
Loading…
Reference in New Issue
Block a user