add 3v3 stack switching
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-04-03 16:25:32 +02:00
parent e3677f89fe
commit 6b37d292c6
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 32 additions and 11 deletions

View File

@ -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

View File

@ -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<GomspaceDeviceHandler>(objects::P60DOCK_HANDLER);
break;
}
case power::P60_DOCK_3V3_STACK: {
memoryAddress = P60Dock::CONFIG_ADDRESS_OUT_EN_3V3_STACK;
module = ObjectManager::instance()->get<GomspaceDeviceHandler>(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;

View File

@ -80,6 +80,7 @@ class PcduHandler : public PowerSwitchIF,
PoolEntry<uint8_t> pdu2Switches =
PoolEntry<uint8_t>(pcdu::INIT_SWITCHES_PDU2.data(), pcdu::INIT_SWITCHES_PDU2.size());
PoolEntry<uint8_t> p60Dock5VSwitch = PoolEntry<uint8_t>();
PoolEntry<uint8_t> p60Dock3V3Switch = PoolEntry<uint8_t>();
/** The timeStamp of the current pdu2HkTableDataset */
CCSDSTime::CDS_short timeStampPdu2HkDataset;

View File

@ -32,6 +32,7 @@ enum Switches : power::Switch_t {
PDU2_CH8_PAYLOAD_CAMERA,
P60_DOCK_5V_STACK,
P60_DOCK_3V3_STACK,
NUMBER_OF_SWITCHES
};

View File

@ -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<power::NUMBER_OF_SWITCHES> {
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU1_SWITCHES, this);
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu2Switches =
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU2_SWITCHES, this);
lp_var_t<uint8_t> p60Dock5VStack = lp_var_t<uint8_t>(sid.objectId, P60DOCK_SWITCHES, this);
lp_var_t<uint8_t> p60Dock5VStack = lp_var_t<uint8_t>(sid.objectId, P60DOCK_5V, this);
lp_var_t<uint8_t> p60Dock3V3Stack = lp_var_t<uint8_t>(sid.objectId, P60DOCK_3V3, this);
};
} // namespace pcdu

2
tmtc

@ -1 +1 @@
Subproject commit b72dad49a9c05a37c094a22d5fdaa15643b5ca7f
Subproject commit f899d169b2a6f7454b2f425dfa2713acf029e016