diff --git a/CHANGELOG.md b/CHANGELOG.md index 9830c767..8cc285f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ will consitute of a breaking change warranting a new major release: ## Added - Version of thermal controller which performs basic control tasks. +- PCDU handler can now command switch of the 3V3 stack (switch ID 19) ## Fixed diff --git a/mission/power/PcduHandler.cpp b/mission/power/PcduHandler.cpp index 63f583f4..0561288c 100644 --- a/mission/power/PcduHandler.cpp +++ b/mission/power/PcduHandler.cpp @@ -28,25 +28,35 @@ ReturnValue_t PcduHandler::performOperation(uint8_t counter) { if (counter == DeviceHandlerIF::PERFORM_OPERATION) { readCommandQueue(); } - uint8_t switchState = 0; + uint8_t switchState5V = 0; + uint8_t switchState3V3 = 0; { PoolReadGuard pg(&p60CoreHk.outputEnables); if (pg.getReadResult() == returnvalue::OK) { - switchState = p60CoreHk.outputEnables.value[10]; + switchState5V = p60CoreHk.outputEnables.value[P60Dock::hk::STACK_5V]; + switchState3V3 = p60CoreHk.outputEnables.value[P60Dock::hk::STACK_3V3]; } else { return returnvalue::OK; } } { - PoolReadGuard pg(&switcherSet.p60Dock5VStack); + PoolReadGuard pg(&switcherSet); if (pg.getReadResult() == returnvalue::OK) { - if (switcherSet.p60Dock5VStack.value != switchState) { - triggerEvent(power::SWITCH_HAS_CHANGED, switchState, power::Switches::P60_DOCK_5V_STACK); + if (switcherSet.p60Dock5VStack.value != switchState5V) { + triggerEvent(power::SWITCH_HAS_CHANGED, switchState5V, power::Switches::P60_DOCK_5V_STACK); MutexGuard mg(pwrLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); - switchStates[power::P60_DOCK_5V_STACK] = switchState; + switchStates[power::P60_DOCK_5V_STACK] = switchState5V; + } + if (switcherSet.p60Dock3V3Stack.value != switchState3V3) { + triggerEvent(power::SWITCH_HAS_CHANGED, switchState3V3, + power::Switches::P60_DOCK_3V3_STACK); + MutexGuard mg(pwrLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); + switchStates[power::P60_DOCK_3V3_STACK] = switchState3V3; } switcherSet.p60Dock5VStack.setValid(true); - switcherSet.p60Dock5VStack.value = switchState; + switcherSet.p60Dock5VStack.value = switchState5V; + switcherSet.p60Dock3V3Stack.setValid(true); + switcherSet.p60Dock3V3Stack.value = switchState3V3; } } return returnvalue::OK; @@ -353,6 +363,11 @@ ReturnValue_t PcduHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO module = ObjectManager::instance()->get(objects::P60DOCK_HANDLER); break; } + case power::P60_DOCK_3V3_STACK: { + memoryAddress = P60Dock::CONFIG_ADDRESS_OUT_EN_3V3_STACK; + module = ObjectManager::instance()->get(objects::P60DOCK_HANDLER); + break; + } default: { sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl; @@ -430,7 +445,8 @@ ReturnValue_t PcduHandler::initializeLocalDataPool(localpool::DataPool& localDat using namespace pcdu; localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches); localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches); - localDataPoolMap.emplace(PoolIds::P60DOCK_SWITCHES, &p60Dock5VSwitch); + localDataPoolMap.emplace(PoolIds::P60DOCK_5V, &p60Dock5VSwitch); + localDataPoolMap.emplace(PoolIds::P60DOCK_3V3, &p60Dock3V3Switch); poolManager.subscribeForDiagPeriodicPacket( subdp::DiagnosticsHkPeriodicParams(switcherSet.getSid(), false, 5.0)); return returnvalue::OK; diff --git a/mission/power/PcduHandler.h b/mission/power/PcduHandler.h index a59ae3da..86d3747f 100644 --- a/mission/power/PcduHandler.h +++ b/mission/power/PcduHandler.h @@ -80,6 +80,7 @@ class PcduHandler : public PowerSwitchIF, PoolEntry pdu2Switches = PoolEntry(pcdu::INIT_SWITCHES_PDU2.data(), pcdu::INIT_SWITCHES_PDU2.size()); PoolEntry p60Dock5VSwitch = PoolEntry(); + PoolEntry p60Dock3V3Switch = PoolEntry(); /** The timeStamp of the current pdu2HkTableDataset */ CCSDSTime::CDS_short timeStampPdu2HkDataset; diff --git a/mission/power/defs.h b/mission/power/defs.h index 6cb1d16b..b10fe1ff 100644 --- a/mission/power/defs.h +++ b/mission/power/defs.h @@ -32,6 +32,7 @@ enum Switches : power::Switch_t { PDU2_CH8_PAYLOAD_CAMERA, P60_DOCK_5V_STACK, + P60_DOCK_3V3_STACK, NUMBER_OF_SWITCHES }; diff --git a/mission/power/gsDefs.h b/mission/power/gsDefs.h index d155bb54..d42cabd2 100644 --- a/mission/power/gsDefs.h +++ b/mission/power/gsDefs.h @@ -109,6 +109,7 @@ enum class SetIds : uint32_t { CORE = 1, AUX = 2, CONFIG = 3 }; namespace P60Dock { +static const uint16_t CONFIG_ADDRESS_OUT_EN_3V3_STACK = 0x71; static const uint16_t CONFIG_ADDRESS_OUT_EN_5V_STACK = 0x72; namespace pool { @@ -714,7 +715,7 @@ class AuxHk : public StaticLocalDataSet<12> { namespace pcdu { -enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES, P60DOCK_SWITCHES }; +enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES, P60DOCK_5V, P60DOCK_3V3 }; static const uint8_t ON = 1; static const uint8_t OFF = 0; @@ -745,7 +746,8 @@ class SwitcherStates : public StaticLocalDataSet { lp_vec_t(sid.objectId, PDU1_SWITCHES, this); lp_vec_t pdu2Switches = lp_vec_t(sid.objectId, PDU2_SWITCHES, this); - lp_var_t p60Dock5VStack = lp_var_t(sid.objectId, P60DOCK_SWITCHES, this); + lp_var_t p60Dock5VStack = lp_var_t(sid.objectId, P60DOCK_5V, this); + lp_var_t p60Dock3V3Stack = lp_var_t(sid.objectId, P60DOCK_3V3, this); }; } // namespace pcdu diff --git a/tmtc b/tmtc index b72dad49..f899d169 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b72dad49a9c05a37c094a22d5fdaa15643b5ca7f +Subproject commit f899d169b2a6f7454b2f425dfa2713acf029e016