v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
2 changed files with 33 additions and 26 deletions
Showing only changes of commit b5660d582e - Show all commits

View File

@ -141,29 +141,30 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet
void PCDUHandler::updatePdu2SwitchStates() { void PCDUHandler::updatePdu2SwitchStates() {
using namespace pcduSwitches; using namespace pcduSwitches;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
PoolReadGuard rg(&pdu2HkTableDataset); PoolReadGuard rg(&pdu2HkTableDataset);
if (rg.getReadResult() == RETURN_OK) { if (rg.getReadResult() == RETURN_OK) {
MutexGuard mg(pwrMutex); MutexGuard mg(pwrMutex);
checkAndUpdateSwitch(Switches::PDU2_CH0_Q7S, pdu2HkTableDataset.outEnabledQ7S.value); checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2HkTableDataset.outEnabledQ7S.value);
checkAndUpdateSwitch(Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, checkAndUpdateSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
pdu2HkTableDataset.outEnabledPlPCDUCh1.value); pdu2HkTableDataset.outEnabledPlPCDUCh1.value);
checkAndUpdateSwitch(Switches::PDU2_CH2_RW_5V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH2_RW_5V,
pdu2HkTableDataset.outEnabledReactionWheels.value); pdu2HkTableDataset.outEnabledReactionWheels.value);
checkAndUpdateSwitch(Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value); pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value);
checkAndUpdateSwitch(Switches::PDU2_CH4_SUS_REDUNDANT_3V3, checkAndUpdateSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3,
pdu2HkTableDataset.outEnabledSUSRedundant.value); pdu2HkTableDataset.outEnabledSUSRedundant.value);
checkAndUpdateSwitch(Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
pdu2HkTableDataset.outEnabledDeplMechanism.value); pdu2HkTableDataset.outEnabledDeplMechanism.value);
checkAndUpdateSwitch(Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, checkAndUpdateSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8,
pdu2HkTableDataset.outEnabledPlPCDUCh6.value); pdu2HkTableDataset.outEnabledPlPCDUCh6.value);
checkAndUpdateSwitch(Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3, checkAndUpdateSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
pdu2HkTableDataset.outEnabledAcsBoardSideB.value); pdu2HkTableDataset.outEnabledAcsBoardSideB.value);
checkAndUpdateSwitch(Switches::PDU2_CH8_PAYLOAD_CAMERA, checkAndUpdateSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA,
pdu2HkTableDataset.outEnabledPayloadCamera.value); pdu2HkTableDataset.outEnabledPayloadCamera.value);
if (firstSwitchInfo) { if (firstSwitchInfoPdu2) {
firstSwitchInfo = false; firstSwitchInfoPdu2 = false;
} }
} else { } else {
sif::debug << "PCDUHandler::updatePdu2SwitchStates: Failed to read PDU2 Hk Dataset" sif::debug << "PCDUHandler::updatePdu2SwitchStates: Failed to read PDU2 Hk Dataset"
@ -174,26 +175,27 @@ void PCDUHandler::updatePdu2SwitchStates() {
void PCDUHandler::updatePdu1SwitchStates() { void PCDUHandler::updatePdu1SwitchStates() {
using namespace pcduSwitches; using namespace pcduSwitches;
PoolReadGuard rg(&pdu1HkTableDataset); PoolReadGuard rg(&pdu1HkTableDataset);
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
if (rg.getReadResult() == RETURN_OK) { if (rg.getReadResult() == RETURN_OK) {
MutexGuard mg(pwrMutex); MutexGuard mg(pwrMutex);
checkAndUpdateSwitch(Switches::PDU1_CH0_TCS_BOARD_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3,
pdu1HkTableDataset.outEnabledTCSBoard3V3.value); pdu1HkTableDataset.outEnabledTCSBoard3V3.value);
checkAndUpdateSwitch(Switches::PDU1_CH1_SYRLINKS_12V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V,
pdu1HkTableDataset.outEnabledSyrlinks.value); pdu1HkTableDataset.outEnabledSyrlinks.value);
checkAndUpdateSwitch(Switches::PDU1_CH2_STAR_TRACKER_5V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V,
pdu1HkTableDataset.outEnabledStarTracker.value); pdu1HkTableDataset.outEnabledStarTracker.value);
checkAndUpdateSwitch(Switches::PDU1_CH3_MGT_5V, pdu1HkTableDataset.outEnabledMGT.value); checkAndUpdateSwitch(pdu, Switches::PDU1_CH3_MGT_5V, pdu1HkTableDataset.outEnabledMGT.value);
checkAndUpdateSwitch(Switches::PDU1_CH4_SUS_NOMINAL_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3,
pdu1HkTableDataset.outEnabledSUSNominal.value); pdu1HkTableDataset.outEnabledSUSNominal.value);
checkAndUpdateSwitch(Switches::PDU1_CH5_SOLAR_CELL_EXP_5V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V,
pdu1HkTableDataset.outEnabledSolarCellExp.value); pdu1HkTableDataset.outEnabledSolarCellExp.value);
checkAndUpdateSwitch(Switches::PDU1_CH6_PLOC_12V, pdu1HkTableDataset.outEnabledPLOC.value); checkAndUpdateSwitch(pdu, Switches::PDU1_CH6_PLOC_12V, pdu1HkTableDataset.outEnabledPLOC.value);
checkAndUpdateSwitch(Switches::PDU1_CH7_ACS_A_SIDE_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3,
pdu1HkTableDataset.outEnabledAcsBoardSideA.value); pdu1HkTableDataset.outEnabledAcsBoardSideA.value);
checkAndUpdateSwitch(Switches::PDU1_CH8_UNOCCUPIED, checkAndUpdateSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED,
pdu1HkTableDataset.outEnabledChannel8.value); pdu1HkTableDataset.outEnabledChannel8.value);
if (firstSwitchInfo) { if (firstSwitchInfoPdu1) {
firstSwitchInfo = false; firstSwitchInfoPdu1 = false;
} }
} else { } else {
sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl;
@ -615,10 +617,14 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
} }
} }
void PCDUHandler::checkAndUpdateSwitch(pcduSwitches::Switches switchIdx, uint8_t setValue) { void PCDUHandler::checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcduSwitches::Switches switchIdx,
uint8_t setValue) {
using namespace pcduSwitches; using namespace pcduSwitches;
if (switchStates[switchIdx] != setValue) { if (switchStates[switchIdx] != setValue) {
if (firstSwitchInfo) { // This code initializes the switches to the default init switch states on every reboot.
// This is not done by the PCDU unless it is power-cycled.
if (((pdu == GOMSPACE::Pdu::PDU1) and firstSwitchInfoPdu1) or
((pdu == GOMSPACE::Pdu::PDU2) and firstSwitchInfoPdu2)) {
ReturnValue_t state = PowerSwitchIF::SWITCH_OFF; ReturnValue_t state = PowerSwitchIF::SWITCH_OFF;
if (INIT_SWITCH_STATES[switchIdx] == ON) { if (INIT_SWITCH_STATES[switchIdx] == ON) {
state = PowerSwitchIF::SWITCH_ON; state = PowerSwitchIF::SWITCH_ON;

View File

@ -84,7 +84,8 @@ class PCDUHandler : public PowerSwitchIF,
MessageQueueIF* commandQueue = nullptr; MessageQueueIF* commandQueue = nullptr;
size_t cmdQueueSize; size_t cmdQueueSize;
bool firstSwitchInfo = true; bool firstSwitchInfoPdu1 = true;
bool firstSwitchInfoPdu2 = true;
PeriodicTaskIF* executingTask = nullptr; PeriodicTaskIF* executingTask = nullptr;
@ -118,7 +119,7 @@ class PCDUHandler : public PowerSwitchIF,
*/ */
void updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset, void updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
CCSDSTime::CDS_short* datasetTimeStamp); CCSDSTime::CDS_short* datasetTimeStamp);
void checkAndUpdateSwitch(pcduSwitches::Switches switchIdx, uint8_t setValue); void checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcduSwitches::Switches switchIdx, uint8_t setValue);
}; };
#endif /* MISSION_DEVICES_PCDUHANDLER_H_ */ #endif /* MISSION_DEVICES_PCDUHANDLER_H_ */