v1.10.0 #220

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

View File

@ -10,8 +10,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void*
return; return;
} }
if (pdu == GOMSPACE::Pdu::PDU1) { if (pdu == GOMSPACE::Pdu::PDU1) {
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel); PDU1::Channels typedChannel = static_cast<PDU1::Channels>(channel);
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) { if (typedChannel == PDU1::Channels::ACS_A_SIDE) {
if (state) { if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET); gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
} else { } else {
@ -20,8 +20,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void*
} }
} else if (pdu == GOMSPACE::Pdu::PDU2) { } else if (pdu == GOMSPACE::Pdu::PDU2) {
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel); PDU2::Channels typedChannel = static_cast<PDU2::Channels>(channel);
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) { if (typedChannel == PDU2::Channels::ACS_B_SIDE) {
if (state) { if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET); gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
} else { } else {

View File

@ -192,7 +192,7 @@ void ObjectFactory::produce(void* args) {
starTrackerCookie->setNoFixedSizeReply(); starTrackerCookie->setNoFixedSizeReply();
StrHelper* strHelper = new StrHelper(objects::STR_HELPER); StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper, new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper,
pcduSwitches::PDU1_CH2_STAR_TRACKER_5V); pcdu::PDU1_CH2_STAR_TRACKER_5V);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
@ -601,7 +601,7 @@ void ObjectFactory::createHeaterComponents() {
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
objects::PCDU_HANDLER, pcduSwitches::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V); objects::PCDU_HANDLER, pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
} }
void ObjectFactory::createSolarArrayDeploymentComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() {
@ -621,7 +621,7 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
// TODO: Find out burn time. For now set to 1000 ms. // TODO: Find out burn time. For now set to 1000 ms.
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF, new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
solarArrayDeplCookie, objects::PCDU_HANDLER, solarArrayDeplCookie, objects::PCDU_HANDLER,
pcduSwitches::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000); gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
} }
@ -632,7 +632,7 @@ void ObjectFactory::createSyrlinksComponents() {
syrlinksUartCookie->setParityEven(); syrlinksUartCookie->setParityEven();
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcduSwitches::PDU1_CH1_SYRLINKS_12V); pcdu::PDU1_CH1_SYRLINKS_12V);
} }
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
@ -668,7 +668,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
supervisorCookie->setNoFixedSizeReply(); supervisorCookie->setNoFixedSizeReply();
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
pcduSwitches::PDU1_CH6_PLOC_12V); pcdu::PDU1_CH6_PLOC_12V);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
static_cast<void>(consumer); static_cast<void>(consumer);
} }
@ -925,8 +925,8 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
// Create device handler components // Create device handler components
auto plPcduHandler = new PayloadPcduHandler( auto plPcduHandler = new PayloadPcduHandler(
objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF, SdCardManager::instance(), objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF, SdCardManager::instance(),
pwrSwitcher, pcduSwitches::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
pcduSwitches::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false); pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false);
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler); spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
// plPcduHandler->enablePeriodicPrintout(true, 5); // plPcduHandler->enablePeriodicPrintout(true, 5);
// static_cast<void>(plPcduHandler); // static_cast<void>(plPcduHandler);

View File

@ -1,72 +1,6 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ #ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ #define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include "OBSWConfig.h" #include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include <fsfw/power/definitions.h>
#include <array>
#include <cstdint>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum Switches: power::Switch_t {
PDU1_CH0_TCS_BOARD_3V3,
PDU1_CH1_SYRLINKS_12V,
PDU1_CH2_STAR_TRACKER_5V,
PDU1_CH3_MGT_5V,
PDU1_CH4_SUS_NOMINAL_3V3,
PDU1_CH5_SOLAR_CELL_EXP_5V,
PDU1_CH6_PLOC_12V,
PDU1_CH7_ACS_A_SIDE_3V3,
PDU1_CH8_UNOCCUPIED,
PDU2_CH0_Q7S,
PDU2_CH1_PL_PCDU_BATT_0_14V8,
PDU2_CH2_RW_5V,
PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
PDU2_CH4_SUS_REDUNDANT_3V3,
PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
PDU2_CH6_PL_PCDU_BATT_1_14V8,
PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
PDU2_CH8_PAYLOAD_CAMERA,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
// Output states after reboot of the PDUs
const std::array<uint8_t, NUMBER_OF_SWITCHES> INIT_SWITCH_STATES = {
// PDU 1
// Because the TE0720 is not connected to the PCDU, this switch is always on
#ifdef TE0720_1CFA
ON,
#else
OFF,
#endif
OFF,
OFF,
OFF,
OFF,
OFF,
OFF,
OFF,
OFF,
// PDU 2
ON,
OFF,
OFF,
OFF,
OFF,
OFF,
OFF,
OFF,
OFF
};
}
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */ #endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit a11d7455dfaf2e736f73f6c4dda1f8c06b9f1234 Subproject commit 94ed5822971575e9715c39c86ab4466c81718441

View File

@ -280,7 +280,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
TcsBoardHelper helper(rtdIds); TcsBoardHelper helper(rtdIds);
TcsBoardAssembly* tcsBoardAss = TcsBoardAssembly* tcsBoardAss =
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
pcduSwitches::Switches::PDU1_CH0_TCS_BOARD_3V3, helper); pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss); static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1 #endif // OBSW_ADD_RTD_DEVICES == 1
} }

View File

@ -1,6 +1,7 @@
#include "GomspaceDeviceHandler.h" #include "GomspaceDeviceHandler.h"
#include <common/config/commonObjects.h> #include <common/config/commonObjects.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include "devicedefinitions/GomSpacePackets.h" #include "devicedefinitions/GomSpacePackets.h"
#include "devicedefinitions/powerDefinitions.h" #include "devicedefinitions/powerDefinitions.h"
@ -356,6 +357,46 @@ ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& u
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t GomspaceDeviceHandler::initializePduPool(
localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager,
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb) {
localDataPoolMap.emplace(P60System::pool::PDU_CURRENTS, new PoolEntry<int16_t>(9));
localDataPoolMap.emplace(P60System::pool::PDU_VOLTAGES, new PoolEntry<int16_t>(9));
localDataPoolMap.emplace(P60System::pool::PDU_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_CONV_EN_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_CONV_EN_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_CONV_EN_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_OUT_ENABLE,
new PoolEntry<uint8_t>(initOutEnb.data(), initOutEnb.size()));
localDataPoolMap.emplace(P60System::pool::PDU_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_LATCHUPS, new PoolEntry<uint16_t>(9));
localDataPoolMap.emplace(P60System::pool::PDU_DEVICES, new PoolEntry<uint8_t>(8));
localDataPoolMap.emplace(P60System::pool::PDU_STATUSES, new PoolEntry<uint8_t>(8));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
return RETURN_OK;
}
ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
WatchdogResetCommand watchdogResetCommand; WatchdogResetCommand watchdogResetCommand;
size_t cspPacketLen = 0; size_t cspPacketLen = 0;
@ -405,3 +446,112 @@ ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) {
sif::info << "No printHkTable implementation given.." << std::endl; sif::info << "No printHkTable implementation given.." << std::endl;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU::PduAuxHk& auxHk,
const uint8_t* packet) {
uint16_t dataOffset = 0;
PoolReadGuard pg0(&coreHk);
PoolReadGuard pg1(&auxHk);
if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or
pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 datasets failed!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
/* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address. */
dataOffset += 12;
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.currents[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4;
}
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.voltages[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4;
}
auxHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
auxHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
coreHk.temperature = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
auxHk.converterEnable1 = *(packet + dataOffset);
dataOffset += 3;
auxHk.converterEnable2 = *(packet + dataOffset);
dataOffset += 3;
auxHk.converterEnable3 = *(packet + dataOffset);
dataOffset += 3;
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.outputEnables[idx] = packet[dataOffset];
dataOffset += 3;
}
auxHk.bootcause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
coreHk.bootcount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.resetcause = *(packet + dataOffset + 1) << 8 | *(packet + dataOffset);
dataOffset += 4;
coreHk.battMode = *(packet + dataOffset);
/* +10 because here begins the second gomspace csp packet */
dataOffset += 3 + 10;
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
auxHk.latchups[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
}
for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) {
auxHk.deviceTypes[idx] = *(packet + dataOffset);
dataOffset += 3;
}
for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) {
auxHk.devicesStatus[idx] = *(packet + dataOffset);
dataOffset += 3;
}
auxHk.gndWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.i2cWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.canWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.csp1WdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.csp2WdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.groundWatchdogSecondsLeft = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.i2cWatchdogSecondsLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.canWatchdogSecondsLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.csp1WatchdogPingsLeft = *(packet + dataOffset);
dataOffset += 3;
auxHk.csp2WatchdogPingsLeft = *(packet + dataOffset);
coreHk.setChanged(true);
if (not coreHk.isValid()) {
coreHk.setValidity(true, true);
}
if (not auxHk.isValid()) {
auxHk.setValidity(true, true);
}
return RETURN_OK;
}

View File

@ -110,6 +110,12 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
virtual ReturnValue_t childCommandHook(DeviceCommandId_t cmd, const uint8_t *commandData, virtual ReturnValue_t childCommandHook(DeviceCommandId_t cmd, const uint8_t *commandData,
size_t commandDataLen); size_t commandDataLen);
ReturnValue_t parsePduHkTable(PDU::PduCoreHk &coreHk, PDU::PduAuxHk &auxHk,
const uint8_t *packet);
ReturnValue_t initializePduPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager,
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb);
private: private:
SetParamMessageUnpacker setParamCacher; SetParamMessageUnpacker setParamCacher;
/** /**

View File

@ -216,11 +216,11 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
using namespace P60System; using namespace P60System;
localDataPoolMap.emplace(pool::CURRENTS, &hkCurrents); localDataPoolMap.emplace(pool::P60_CURRENTS, &hkCurrents);
localDataPoolMap.emplace(pool::VOLTAGES, &hkVoltages); localDataPoolMap.emplace(pool::P60_VOLTAGES, &hkVoltages);
localDataPoolMap.emplace(pool::OUTPUT_ENABLE, &outputEnables); localDataPoolMap.emplace(pool::P60_OUTPUT_ENABLE, &outputEnables);
localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_1, new PoolEntry<int16_t>({0})); localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_1, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_2, new PoolEntry<int16_t>({0})); localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_2, new PoolEntry<int16_t>({0}));

View File

@ -11,8 +11,9 @@
PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
: SystemObject(setObjectId), : SystemObject(setObjectId),
poolManager(this, nullptr), poolManager(this, nullptr),
pdu2HkTableDataset(this), pdu1CoreHk(this),
pdu1HkTableDataset(this), pdu2CoreHk(this),
switcherSet(this),
cmdQueueSize(cmdQueueSize) { cmdQueueSize(cmdQueueSize) {
auto mqArgs = MqArgs(setObjectId, static_cast<void*>(this)); auto mqArgs = MqArgs(setObjectId, static_cast<void*>(this));
commandQueue = QueueFactory::instance()->createMessageQueue( commandQueue = QueueFactory::instance()->createMessageQueue(
@ -51,8 +52,8 @@ ReturnValue_t PCDUHandler::initialize() {
return RETURN_FAILED; return RETURN_FAILED;
} }
result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage(
static_cast<uint32_t>(P60System::SetIds::PDU_2), this->getObjectId(), commandQueue->getId(), static_cast<uint32_t>(P60System::SetIds::PDU_2_CORE), this->getObjectId(),
true); commandQueue->getId(), true);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from "
<< "PDU2Handler" << std::endl; << "PDU2Handler" << std::endl;
@ -67,8 +68,8 @@ ReturnValue_t PCDUHandler::initialize() {
return RETURN_FAILED; return RETURN_FAILED;
} }
result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage(
static_cast<uint32_t>(P60System::SetIds::PDU_1), this->getObjectId(), commandQueue->getId(), static_cast<uint32_t>(P60System::SetIds::PDU_1_CORE), this->getObjectId(),
true); commandQueue->getId(), true);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from "
<< "PDU1Handler" << std::endl; << "PDU1Handler" << std::endl;
@ -79,9 +80,13 @@ ReturnValue_t PCDUHandler::initialize() {
} }
void PCDUHandler::initializeSwitchStates() { void PCDUHandler::initializeSwitchStates() {
using namespace pcduSwitches; using namespace pcdu;
for (uint8_t idx = 0; idx < Switches::NUMBER_OF_SWITCHES; idx++) { for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
switchStates[idx] = INIT_SWITCH_STATES[idx]; if (idx < PDU::CHANNELS_LEN) {
switchStates[idx] = INIT_SWITCHES_PDU1[idx];
} else {
switchStates[idx] = INIT_SWITCHES_PDU2[idx];
}
} }
} }
@ -103,11 +108,12 @@ void PCDUHandler::readCommandQueue() {
MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); }
void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::PDU_2))) { if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::PDU_2_CORE))) {
updateHkTableDataset(storeId, &pdu2HkTableDataset, &timeStampPdu2HkDataset); updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset);
updatePdu2SwitchStates(); updatePdu2SwitchStates();
} else if (sid == sid_t(objects::PDU1_HANDLER, static_cast<uint32_t>(P60System::SetIds::PDU_1))) { } else if (sid ==
updateHkTableDataset(storeId, &pdu1HkTableDataset, &timeStampPdu1HkDataset); sid_t(objects::PDU1_HANDLER, static_cast<uint32_t>(P60System::SetIds::PDU_1_CORE))) {
updateHkTableDataset(storeId, &pdu1CoreHk, &timeStampPdu1HkDataset);
updatePdu1SwitchStates(); updatePdu1SwitchStates();
} else { } else {
sif::error << "PCDUHandler::handleChangedDataset: Invalid sid" << std::endl; sif::error << "PCDUHandler::handleChangedDataset: Invalid sid" << std::endl;
@ -143,29 +149,33 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet
} }
void PCDUHandler::updatePdu2SwitchStates() { void PCDUHandler::updatePdu2SwitchStates() {
using namespace pcduSwitches; using namespace pcdu;
using namespace PDU2;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
PoolReadGuard rg(&pdu2HkTableDataset); PoolReadGuard rg0(&switcherSet);
if (rg.getReadResult() == RETURN_OK) { PoolReadGuard rg1(&pdu2CoreHk);
if (rg0.getReadResult() == RETURN_OK and rg1.getReadResult() == RETURN_OK) {
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
switcherSet.pdu2Switches[idx] = pdu2CoreHk.outputEnables[idx];
}
MutexGuard mg(pwrMutex); MutexGuard mg(pwrMutex);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2HkTableDataset.outEnabledQ7S.value); checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, checkAndUpdateSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
pdu2HkTableDataset.outEnabledPlPCDUCh1.value); pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH1]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH2_RW_5V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH2_RW_5V, pdu2CoreHk.outputEnables[Channels::RW]);
pdu2HkTableDataset.outEnabledReactionWheels.value);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value); pdu2CoreHk.outputEnables[Channels::TCS_HEATER_IN]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3, checkAndUpdateSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3,
pdu2HkTableDataset.outEnabledSUSRedundant.value); pdu2CoreHk.outputEnables[Channels::SUS_REDUNDANT]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, checkAndUpdateSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
pdu2HkTableDataset.outEnabledDeplMechanism.value); pdu2CoreHk.outputEnables[Channels::DEPY_MECHANISM]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, checkAndUpdateSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8,
pdu2HkTableDataset.outEnabledPlPCDUCh6.value); pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH6]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3, checkAndUpdateSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
pdu2HkTableDataset.outEnabledAcsBoardSideB.value); pdu2CoreHk.outputEnables[Channels::ACS_B_SIDE]);
checkAndUpdateSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA, checkAndUpdateSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA,
pdu2HkTableDataset.outEnabledPayloadCamera.value); pdu2CoreHk.outputEnables[Channels::PAYLOAD_CAMERA]);
if (firstSwitchInfoPdu2) { if (firstSwitchInfoPdu2) {
firstSwitchInfoPdu2 = false; firstSwitchInfoPdu2 = false;
} }
@ -176,27 +186,33 @@ void PCDUHandler::updatePdu2SwitchStates() {
} }
void PCDUHandler::updatePdu1SwitchStates() { void PCDUHandler::updatePdu1SwitchStates() {
using namespace pcduSwitches; using namespace pcdu;
PoolReadGuard rg(&pdu1HkTableDataset); using namespace PDU1;
PoolReadGuard rg0(&switcherSet);
PoolReadGuard rg1(&pdu1CoreHk);
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
if (rg.getReadResult() == RETURN_OK) { if (rg0.getReadResult() == RETURN_OK and rg1.getReadResult() == RETURN_OK) {
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
switcherSet.pdu1Switches[idx] = pdu1CoreHk.outputEnables[idx];
}
MutexGuard mg(pwrMutex); MutexGuard mg(pwrMutex);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3,
pdu1HkTableDataset.outEnabledTCSBoard3V3.value); pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V,
pdu1HkTableDataset.outEnabledSyrlinks.value); pdu1CoreHk.outputEnables[Channels::SYRLINKS]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V,
pdu1HkTableDataset.outEnabledStarTracker.value); pdu1CoreHk.outputEnables[Channels::STR]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH3_MGT_5V, pdu1HkTableDataset.outEnabledMGT.value); checkAndUpdateSwitch(pdu, Switches::PDU1_CH3_MGT_5V, pdu1CoreHk.outputEnables[Channels::MGT]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3,
pdu1HkTableDataset.outEnabledSUSNominal.value); pdu1CoreHk.outputEnables[Channels::SUS_NOMINAL]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V, checkAndUpdateSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V,
pdu1HkTableDataset.outEnabledSolarCellExp.value); pdu1CoreHk.outputEnables[Channels::SOL_CELL_EXPERIMENT]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH6_PLOC_12V, pdu1HkTableDataset.outEnabledPLOC.value); checkAndUpdateSwitch(pdu, Switches::PDU1_CH6_PLOC_12V,
pdu1CoreHk.outputEnables[Channels::PLOC]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3, checkAndUpdateSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3,
pdu1HkTableDataset.outEnabledAcsBoardSideA.value); pdu1CoreHk.outputEnables[Channels::ACS_A_SIDE]);
checkAndUpdateSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED, checkAndUpdateSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED,
pdu1HkTableDataset.outEnabledChannel8.value); pdu1CoreHk.outputEnables[Channels::UNUSED]);
if (firstSwitchInfoPdu1) { if (firstSwitchInfoPdu1) {
firstSwitchInfoPdu1 = false; firstSwitchInfoPdu1 = false;
} }
@ -208,7 +224,7 @@ void PCDUHandler::updatePdu1SwitchStates() {
LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; } LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; }
ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
using namespace pcduSwitches; using namespace pcdu;
ReturnValue_t result; ReturnValue_t result;
uint16_t memoryAddress = 0; uint16_t memoryAddress = 0;
size_t parameterValueSize = sizeof(uint8_t); size_t parameterValueSize = sizeof(uint8_t);
@ -216,94 +232,94 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
GomspaceDeviceHandler* pdu = nullptr; GomspaceDeviceHandler* pdu = nullptr;
switch (switchNr) { switch (switchNr) {
case pcduSwitches::PDU1_CH0_TCS_BOARD_3V3: { case pcdu::PDU1_CH0_TCS_BOARD_3V3: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH1_SYRLINKS_12V: { case pcdu::PDU1_CH1_SYRLINKS_12V: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SYRLINKS; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SYRLINKS;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH2_STAR_TRACKER_5V: { case pcdu::PDU1_CH2_STAR_TRACKER_5V: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_STAR_TRACKER; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_STAR_TRACKER;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH3_MGT_5V: { case pcdu::PDU1_CH3_MGT_5V: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_MGT; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_MGT;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH4_SUS_NOMINAL_3V3: { case pcdu::PDU1_CH4_SUS_NOMINAL_3V3: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH5_SOLAR_CELL_EXP_5V: { case pcdu::PDU1_CH5_SOLAR_CELL_EXP_5V: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH6_PLOC_12V: { case pcdu::PDU1_CH6_PLOC_12V: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_PLOC; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_PLOC;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH7_ACS_A_SIDE_3V3: { case pcdu::PDU1_CH7_ACS_A_SIDE_3V3: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
case pcduSwitches::PDU1_CH8_UNOCCUPIED: { case pcdu::PDU1_CH8_UNOCCUPIED: {
memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_CHANNEL8; memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_CHANNEL8;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU1_HANDLER);
break; break;
} }
// This is a dangerous command. Reject/Igore it for now // This is a dangerous command. Reject/Igore it for now
case pcduSwitches::PDU2_CH0_Q7S: { case pcdu::PDU2_CH0_Q7S: {
return RETURN_FAILED; return RETURN_FAILED;
// memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_Q7S; // memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_Q7S;
// pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); // pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
// break; // break;
} }
case pcduSwitches::PDU2_CH1_PL_PCDU_BATT_0_14V8: { case pcdu::PDU2_CH1_PL_PCDU_BATT_0_14V8: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH2_RW_5V: { case pcdu::PDU2_CH2_RW_5V: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_RW; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_RW;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V: { case pcdu::PDU2_CH3_TCS_BOARD_HEATER_IN_8V: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH4_SUS_REDUNDANT_3V3: { case pcdu::PDU2_CH4_SUS_REDUNDANT_3V3: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V: { case pcdu::PDU2_CH5_DEPLOYMENT_MECHANISM_8V: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH6_PL_PCDU_BATT_1_14V8: { case pcdu::PDU2_CH6_PL_PCDU_BATT_1_14V8: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3: { case pcdu::PDU2_CH7_ACS_BOARD_SIDE_B_3V3: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
} }
case pcduSwitches::PDU2_CH8_PAYLOAD_CAMERA: { case pcdu::PDU2_CH8_PAYLOAD_CAMERA: {
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA; memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA;
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER); pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break; break;
@ -355,7 +371,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; } ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; }
ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) { if (switchNr >= pcdu::NUMBER_OF_SWITCHES) {
sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl; sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -377,212 +393,10 @@ object_id_t PCDUHandler::getObjectId() const { return SystemObject::getObjectId(
ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
using namespace pcduSwitches; using namespace pcdu;
using namespace P60System; localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_Q7S, new PoolEntry<int16_t>({0})); localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu2Switches);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, new PoolEntry<int16_t>({0})); poolManager.subscribeForPeriodicPacket(switcherSet.getSid(), false, 5.0, true);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_RW, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_SUS_REDUNDANT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_Q7S, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_RW, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_Q7S,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH0_Q7S]}));
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH1,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8]}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_RW,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH2_RW_5V]}));
#ifdef TE0720_1CFA
localDataPoolMap.emplace(pool::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1}));
#else
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_TCS_BOARD_HEATER_IN,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V]}));
#endif
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_SUS_REDUNDANT,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH4_SUS_REDUNDANT_3V3]}));
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_DEPLOYMENT_MECHANISM,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V]}));
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH6,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8]}));
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_ACS_BOARD_SIDE_B,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3]}));
localDataPoolMap.emplace(
pool::PDU2_OUT_EN_PAYLOAD_CAMERA,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH8_PAYLOAD_CAMERA]}));
localDataPoolMap.emplace(pool::PDU2_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_Q7S, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_RW, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_0, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_5, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_7, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_0_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_1_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_2_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_3_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_4_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_5_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_6_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_7_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_TCS_BOARD_3V3, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_SYRLINKS, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_STAR_TRACKER, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_MGT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_SUS_NOMINAL, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_SOLAR_CELL_EXP, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_PLOC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CURRENT_OUT_CHANNEL8, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_TCS_BOARD_3V3,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH0_TCS_BOARD_3V3]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_SYRLINKS,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH1_SYRLINKS_12V]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_STAR_TRACKER,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH2_STAR_TRACKER_5V]}));
localDataPoolMap.emplace(pool::PDU1_VOLTAGE_OUT_MGT,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH3_MGT_5V]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_SUS_NOMINAL,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH4_SUS_NOMINAL_3V3]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH5_SOLAR_CELL_EXP_5V]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_PLOC,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH6_PLOC_12V]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH7_ACS_A_SIDE_3V3]}));
localDataPoolMap.emplace(
pool::PDU1_VOLTAGE_OUT_CHANNEL8,
new PoolEntry<int16_t>({INIT_SWITCH_STATES[Switches::PDU1_CH8_UNOCCUPIED]}));
localDataPoolMap.emplace(pool::PDU1_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CONV_EN_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CONV_EN_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_CONV_EN_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_TCS_BOARD_3V3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_SYRLINKS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_STAR_TRACKER, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_MGT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_SUS_NOMINAL, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_SOLAR_CELL_EXP, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_PLOC, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_ACS_BOARD_SIDE_A, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_OUT_EN_CHANNEL8, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_TCS_BOARD_3V3, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_SYRLINKS, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_STAR_TRACKER, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_MGT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_SUS_NOMINAL, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_SOLAR_CELL_EXP, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_PLOC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_ACS_BOARD_SIDE_A, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_LATCHUP_CHANNEL8, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_0, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_5, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_7, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_0_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_1_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_2_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_3_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_4_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_5_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_6_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_DEVICE_7_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU1_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -602,17 +416,17 @@ uint32_t PCDUHandler::getPeriodicOperationFrequency() const { return pstInterval
void PCDUHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; } void PCDUHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; }
LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
if (sid == pdu2HkTableDataset.getSid()) { if (sid == switcherSet.getSid()) {
return &pdu2HkTableDataset; return &switcherSet;
} else { } else {
sif::error << "PCDUHandler::getDataSetHandle: Invalid sid" << std::endl; sif::error << "PCDUHandler::getDataSetHandle: Invalid sid" << std::endl;
return nullptr; return nullptr;
} }
} }
void PCDUHandler::checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcduSwitches::Switches switchIdx, void PCDUHandler::checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
uint8_t setValue) { uint8_t setValue) {
using namespace pcduSwitches; using namespace pcdu;
if (switchStates[switchIdx] != setValue) { if (switchStates[switchIdx] != setValue) {
#if OBSW_INITIALIZE_SWITCHES == 1 #if OBSW_INITIALIZE_SWITCHES == 1
// This code initializes the switches to the default init switch states on every reboot. // This code initializes the switches to the default init switch states on every reboot.

View File

@ -2,6 +2,7 @@
#define MISSION_DEVICES_PCDUHANDLER_H_ #define MISSION_DEVICES_PCDUHANDLER_H_
#include <devices/powerSwitcherList.h> #include <devices/powerSwitcherList.h>
#include <fsfw/datapool/PoolEntry.h>
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h> #include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
#include <fsfw/objectmanager/SystemObject.h> #include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/power/PowerSwitchIF.h> #include <fsfw/power/PowerSwitchIF.h>
@ -56,21 +57,29 @@ class PCDUHandler : public PowerSwitchIF,
/** Housekeeping manager. Handles updates of local pool variables. */ /** Housekeeping manager. Handles updates of local pool variables. */
LocalDataPoolManager poolManager; LocalDataPoolManager poolManager;
/** Hk table dataset of PDU1 */
PDU1::Pdu1CoreHk pdu1CoreHk;
/** /**
* The dataset holding the hk table of PDU2. This dataset is a copy of the PDU2 HK dataset * The dataset holding the hk table of PDU2. This dataset is a copy of the PDU2 HK dataset
* of the PDU2Handler. Each time the PDU2Handler updates his HK dataset, a copy is sent * of the PDU2Handler. Each time the PDU2Handler updates his HK dataset, a copy is sent
* to this object via a HousekeepingMessage. * to this object via a HousekeepingMessage.
*/ */
PDU2::PDU2HkTableDataset pdu2HkTableDataset; PDU2::Pdu2CoreHk pdu2CoreHk;
pcdu::SwitcherStates switcherSet;
PoolEntry<uint8_t> pdu1Switches =
PoolEntry<uint8_t>(pcdu::INIT_SWITCHES_PDU1.data(), pcdu::INIT_SWITCHES_PDU1.size());
PoolEntry<uint8_t> pdu2Switches =
PoolEntry<uint8_t>(pcdu::INIT_SWITCHES_PDU2.data(), pcdu::INIT_SWITCHES_PDU2.size());
/** The timeStamp of the current pdu2HkTableDataset */ /** The timeStamp of the current pdu2HkTableDataset */
CCSDSTime::CDS_short timeStampPdu2HkDataset; CCSDSTime::CDS_short timeStampPdu2HkDataset;
/** Hk table dataset of PDU1 */
PDU1::PDU1HkTableDataset pdu1HkTableDataset;
/** The timeStamp of the current pdu1HkTableDataset */ /** The timeStamp of the current pdu1HkTableDataset */
CCSDSTime::CDS_short timeStampPdu1HkDataset; CCSDSTime::CDS_short timeStampPdu1HkDataset;
uint8_t switchStates[pcduSwitches::NUMBER_OF_SWITCHES]; uint8_t switchStates[pcdu::NUMBER_OF_SWITCHES];
/** /**
* Pointer to the IPCStore. * Pointer to the IPCStore.
* This caches the pointer received from the objectManager in the constructor. * This caches the pointer received from the objectManager in the constructor.
@ -119,7 +128,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(GOMSPACE::Pdu pdu, pcduSwitches::Switches switchIdx, uint8_t setValue); void checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, uint8_t setValue);
}; };
#endif /* MISSION_DEVICES_PCDUHANDLER_H_ */ #endif /* MISSION_DEVICES_PCDUHANDLER_H_ */

View File

@ -3,12 +3,13 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include "OBSWConfig.h" #include "devices/powerSwitcherList.h"
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie)
: GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, : GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE),
pdu1HkTableDataset(this) {} coreHk(this),
auxHk(this) {}
PDU1Handler::~PDU1Handler() {} PDU1Handler::~PDU1Handler() {}
@ -19,52 +20,7 @@ ReturnValue_t PDU1Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet); parseHkTableReply(packet);
handleDeviceTM(&pdu1HkTableDataset, id, true); handleDeviceTM(&coreHk, id, true);
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PDU1 == 1
pdu1HkTableDataset.read();
sif::info << "PDU1 TCS Board voltage: " << pdu1HkTableDataset.voltageOutTCSBoard3V3 << std::endl;
sif::info << "PDU1 Syrlinks voltage: " << pdu1HkTableDataset.voltageOutSyrlinks << std::endl;
sif::info << "PDU1 star tracker voltage: " << pdu1HkTableDataset.voltageOutStarTracker
<< std::endl;
sif::info << "PDU1 MGT voltage: " << pdu1HkTableDataset.voltageOutMGT << std::endl;
sif::info << "PDU1 SUS nominal voltage: " << pdu1HkTableDataset.voltageOutSUSNominal << std::endl;
sif::info << "PDU1 solar cell experiment voltage: " << pdu1HkTableDataset.voltageOutSolarCellExp
<< std::endl;
sif::info << "PDU1 PLOC voltage: " << pdu1HkTableDataset.voltageOutPLOC << std::endl;
sif::info << "PDU1 ACS Side A voltage: " << pdu1HkTableDataset.voltageOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 channel 8 voltage: " << pdu1HkTableDataset.voltageOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 TCS Board current: " << pdu1HkTableDataset.currentOutTCSBoard3V3 << std::endl;
sif::info << "PDU1 Syrlinks current: " << pdu1HkTableDataset.currentOutSyrlinks << std::endl;
sif::info << "PDU1 star tracker current: " << pdu1HkTableDataset.currentOutStarTracker
<< std::endl;
sif::info << "PDU1 MGT current: " << pdu1HkTableDataset.currentOutMGT << std::endl;
sif::info << "PDU1 SUS nominal current: " << pdu1HkTableDataset.currentOutSUSNominal << std::endl;
sif::info << "PDU1 solar cell experiment current: " << pdu1HkTableDataset.currentOutSolarCellExp
<< std::endl;
sif::info << "PDU1 PLOC current: " << pdu1HkTableDataset.currentOutPLOC << std::endl;
sif::info << "PDU1 ACS Side A current: " << pdu1HkTableDataset.currentOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8 << std::endl;
printOutputSwitchStates();
sif::info << "PDU1 battery mode: " << static_cast<unsigned int>(pdu1HkTableDataset.battMode.value)
<< std::endl;
sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl;
float vbat = pdu1HkTableDataset.vbat.value * 0.001;
sif::info << "PDU1 VBAT: " << vbat << "V" << std::endl;
float temperatureC = pdu1HkTableDataset.temperature.value * 0.1;
sif::info << "PDU1 Temperature: " << temperatureC << " °C" << std::endl;
sif::info << "PDU1 csp1 watchdog pings before reboot: "
<< static_cast<unsigned int>(pdu1HkTableDataset.csp1WatchdogPingsLeft.value)
<< std::endl;
sif::info << "PDU1 csp2 watchdog pings before reboot: "
<< static_cast<unsigned int>(pdu1HkTableDataset.csp2WatchdogPingsLeft.value)
<< std::endl;
pdu1HkTableDataset.commit();
#endif
} }
void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
@ -123,315 +79,22 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
} }
void PDU1Handler::parseHkTableReply(const uint8_t *packet) { void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0; GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet);
PoolReadGuard pg(&pdu1HkTableDataset);
ReturnValue_t readResult = pg.getReadResult();
if (readResult != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
return;
}
/* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address. */
dataOffset += 12;
pdu1HkTableDataset.currentOutTCSBoard3V3 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutSyrlinks = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutStarTracker =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutMGT = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutSUSNominal =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutSolarCellExp =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutPLOC = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutACSBoardSideA =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.currentOutChannel8 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutTCSBoard3V3 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutSyrlinks = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutStarTracker =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutMGT = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutSUSNominal =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutSolarCellExp =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutPLOC = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutACSBoardSideA =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.voltageOutChannel8 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.temperature = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.converterEnable1 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.converterEnable2 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.converterEnable3 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledTCSBoard3V3 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledSyrlinks = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledStarTracker = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledMGT = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledSUSNominal = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledSolarCellExp = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledPLOC = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledAcsBoardSideA = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.outEnabledChannel8 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.bootcause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.bootcount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.resetcause = *(packet + dataOffset + 1) << 8 | *(packet + dataOffset);
dataOffset += 4;
pdu1HkTableDataset.battMode = *(packet + dataOffset);
/* +10 because here begins the second gomspace csp packet */
dataOffset += 3 + 10;
pdu1HkTableDataset.latchupsTcsBoard3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsSyrlinks = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsStarTracker = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsMgt = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsSusNominal = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsSolarCellExp =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsPloc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsAcsBoardSideA =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.latchupsChannel8 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu1HkTableDataset.device0 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device1 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device2 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device3 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device4 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device5 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device6 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device7 = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device0Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device1Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device2Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device3Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device4Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device5Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device6Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.device7Status = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.gndWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.i2cWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.canWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.csp1WdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.csp2WdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.groundWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.i2cWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.canWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu1HkTableDataset.csp1WatchdogPingsLeft = *(packet + dataOffset);
dataOffset += 3;
pdu1HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset);
pdu1HkTableDataset.setChanged(true);
if (not pdu1HkTableDataset.isValid()) {
pdu1HkTableDataset.setValidity(true, true);
}
} }
ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_TCS_BOARD_3V3, initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1);
new PoolEntry<int16_t>({0})); poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, false);
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_SYRLINKS, new PoolEntry<int16_t>({0})); poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_STAR_TRACKER,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_MGT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_SUS_NOMINAL,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_SOLAR_CELL_EXP,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_PLOC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CURRENT_OUT_CHANNEL8, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_TCS_BOARD_3V3,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_SYRLINKS, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_STAR_TRACKER,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_MGT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_SUS_NOMINAL,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_PLOC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VOLTAGE_OUT_CHANNEL8, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CONV_EN_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CONV_EN_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_CONV_EN_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_TCS_BOARD_3V3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_SYRLINKS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_STAR_TRACKER, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_MGT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_SUS_NOMINAL, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_SOLAR_CELL_EXP,
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_PLOC, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_ACS_BOARD_SIDE_A,
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_OUT_EN_CHANNEL8, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_TCS_BOARD_3V3,
new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_SYRLINKS, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_STAR_TRACKER,
new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_MGT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_SUS_NOMINAL, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_SOLAR_CELL_EXP,
new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_PLOC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_ACS_BOARD_SIDE_A,
new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_LATCHUP_CHANNEL8, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_0, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_5, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_7, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_0_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_1_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_2_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_3_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_4_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_5_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_6_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_DEVICE_7_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU1_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
poolManager.subscribeForPeriodicPacket(pdu1HkTableDataset.getSid(), false, 0.4, true);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) {
if (sid == pdu1HkTableDataset.getSid()) { if (sid == coreHk.getSid()) {
return &pdu1HkTableDataset; return &coreHk;
} else if (sid == auxHk.getSid()) {
return &auxHk;
} }
return nullptr; return nullptr;
} }
@ -440,7 +103,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
switch (cmd) { switch (cmd) {
case (GOMSPACE::PRINT_SWITCH_V_I): { case (GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&pdu1HkTableDataset); PoolReadGuard pg(&coreHk);
result = pg.getReadResult(); result = pg.getReadResult();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
break; break;
@ -449,7 +112,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
break; break;
} }
case (GOMSPACE::PRINT_LATCHUPS): { case (GOMSPACE::PRINT_LATCHUPS): {
PoolReadGuard pg(&pdu1HkTableDataset); PoolReadGuard pg(&auxHk);
result = pg.getReadResult(); result = pg.getReadResult();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
break; break;
@ -468,72 +131,46 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
} }
void PDU1Handler::printHkTableSwitchVI() { void PDU1Handler::printHkTableSwitchVI() {
using namespace PDU1;
sif::info << "PDU1 Info: " << std::endl; sif::info << "PDU1 Info: " << std::endl;
sif::info << "Boot Cause: " << pdu1HkTableDataset.bootcause << " | Boot Count: " << std::setw(4) sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right
<< std::right << pdu1HkTableDataset.bootcount << std::endl; << coreHk.bootcount << std::endl;
sif::info << "Reset Cause: " << pdu1HkTableDataset.resetcause sif::info << "Reset Cause: " << auxHk.resetcause
<< " | Battery Mode: " << static_cast<int>(pdu1HkTableDataset.battMode.value) << " | Battery Mode: " << static_cast<int>(coreHk.battMode.value) << std::endl;
<< std::endl;
sif::info << "SwitchState, Currents [mA], Voltages [mV]:" << std::endl; sif::info << "SwitchState, Currents [mA], Voltages [mV]:" << std::endl;
sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " auto printerHelper = [&](std::string channelStr, Channels idx) {
<< unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " << std::setw(4) sif::info << std::setw(30) << std::left << channelStr << std::dec << "| "
<< std::right << pdu1HkTableDataset.currentOutTCSBoard3V3.value << ", " << std::setw(4) << unsigned(coreHk.outputEnables[idx]) << ", " << std::setw(4) << std::right
<< pdu1HkTableDataset.voltageOutTCSBoard3V3.value << std::endl; << coreHk.currents[idx] << ", " << std::setw(4) << coreHk.voltages[idx] << std::endl;
sif::info << std::setw(30) << std::left << "Syrlinks" << std::dec << "| " };
<< unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " << std::setw(4)
<< std::right << pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) printerHelper("TCS Board", Channels::TCS_BOARD_3V3);
<< pdu1HkTableDataset.voltageOutSyrlinks.value << std::endl; printerHelper("Syrlinks", Channels::SYRLINKS);
sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " printerHelper("Star Tracker", Channels::STR);
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " printerHelper("MGT", Channels::MGT);
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutStarTracker.value << ", " printerHelper("SUS Nominal", Channels::SUS_NOMINAL);
<< std::setw(4) << pdu1HkTableDataset.voltageOutStarTracker.value << std::endl; printerHelper("SCEX", Channels::SOL_CELL_EXPERIMENT);
sif::info << std::setw(30) << std::left << "MGT" << std::dec << "| " printerHelper("PLOC", Channels::PLOC);
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << ", " printerHelper("ACS Board A Side", Channels::ACS_A_SIDE);
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutMGT.value << ", " printerHelper("Channel 8", Channels::UNUSED);
<< std::setw(4) << pdu1HkTableDataset.voltageOutMGT.value << std::endl; printerHelper("Syrlinks", Channels::SYRLINKS);
sif::info << std::setw(30) << std::left << "SuS nominal" << std::dec << "| "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << ", "
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutSUSNominal.value << ", "
<< std::setw(4) << pdu1HkTableDataset.voltageOutSUSNominal.value << std::endl;
sif::info << std::setw(30) << std::left << "Solar Cell Experiment" << std::dec << "| "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << ", "
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutSolarCellExp.value << ", "
<< std::setw(4) << pdu1HkTableDataset.voltageOutSolarCellExp.value << std::endl;
sif::info << std::setw(30) << std::left << "PLOC" << std::dec << "| "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << ", "
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutPLOC.value << ", "
<< std::setw(4) << pdu1HkTableDataset.voltageOutPLOC.value << std::endl;
sif::info << std::setw(30) << std::left << "ACS Side A" << std::dec << "| "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << ", "
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutACSBoardSideA.value
<< ", " << std::setw(4) << pdu1HkTableDataset.voltageOutACSBoardSideA.value
<< std::endl;
sif::info << std::setw(30) << std::left << "Channel 8" << std::dec << "| "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << ", "
<< std::setw(4) << std::right << pdu1HkTableDataset.currentOutChannel8.value << ", "
<< std::setw(4) << pdu1HkTableDataset.voltageOutChannel8.value << std::right
<< std::endl;
} }
void PDU1Handler::printHkTableLatchups() { void PDU1Handler::printHkTableLatchups() {
using namespace PDU1;
sif::info << "PDU1 Latchup Information" << std::endl; sif::info << "PDU1 Latchup Information" << std::endl;
auto printerHelper = [&](std::string channelStr, Channels idx) {
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "TCS Board" << std::dec << "| " sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "TCS Board" << std::dec << "| "
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsTcsBoard3V3 << std::endl; << std::setw(4) << std::right << auxHk.latchups[idx] << std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Syrlinks" << std::dec << "| " };
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsSyrlinks << std::endl; printerHelper("TCS Board", Channels::TCS_BOARD_3V3);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Star Tracker" << std::dec << "| " printerHelper("Syrlinks", Channels::SYRLINKS);
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsStarTracker << std::endl; printerHelper("Star Tracker", Channels::STR);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "MGT" << std::dec << "| " printerHelper("MGT", Channels::MGT);
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsMgt << std::endl; printerHelper("SUS Nominal", Channels::SUS_NOMINAL);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "SuS Nominal" << std::dec << "| " printerHelper("SCEX", Channels::SOL_CELL_EXPERIMENT);
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsSusNominal << std::endl; printerHelper("PLOC", Channels::PLOC);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Solar Cell Experiment" << std::dec printerHelper("ACS Board A Side", Channels::ACS_A_SIDE);
<< "| " << std::setw(4) << std::right << pdu1HkTableDataset.latchupsSolarCellExp printerHelper("Channel 8", Channels::UNUSED);
<< std::endl; printerHelper("Syrlinks", Channels::SYRLINKS);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "PLOC" << std::dec << "| "
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsPloc << std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "ACS A Side" << std::dec << "| "
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsAcsBoardSideA << std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Channel 8" << std::dec << "| "
<< std::setw(4) << std::right << pdu1HkTableDataset.latchupsChannel8 << std::endl;
} }

View File

@ -43,7 +43,8 @@ class PDU1Handler : public GomspaceDeviceHandler {
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24; static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24;
/** Dataset for the housekeeping table of the PDU1 */ /** Dataset for the housekeeping table of the PDU1 */
PDU1::PDU1HkTableDataset pdu1HkTableDataset; PDU1::Pdu1CoreHk coreHk;
PDU1::Pdu1AuxHk auxHk;
GOMSPACE::ChannelSwitchHook channelSwitchHook = nullptr; GOMSPACE::ChannelSwitchHook channelSwitchHook = nullptr;
void* hookArgs = nullptr; void* hookArgs = nullptr;

View File

@ -3,12 +3,13 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include "OBSWConfig.h" #include "devices/powerSwitcherList.h"
PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie) PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie)
: GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, : GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE),
pdu2HkTableDataset(this) {} coreHk(this),
auxHk(this) {}
PDU2Handler::~PDU2Handler() {} PDU2Handler::~PDU2Handler() {}
@ -23,29 +24,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
* Hk table will be sent to the commander if hk table request was not triggered by the * Hk table will be sent to the commander if hk table request was not triggered by the
* PDU2Handler itself. * PDU2Handler itself.
*/ */
handleDeviceTM(&pdu2HkTableDataset, id, true); handleDeviceTM(&coreHk, id, true);
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PDU2 == 1
pdu2HkTableDataset.read();
sif::info << "PDU2 Q7S current voltage: " << pdu2HkTableDataset.voltageOutQ7S << " mV"
<< std::endl;
sif::info << "PDU2 VCC: " << pdu2HkTableDataset.vcc << " mV" << std::endl;
float vbat = pdu2HkTableDataset.vbat.value * 0.1;
sif::info << "PDU2 VBAT: " << vbat << std::endl;
float temperatureC = pdu2HkTableDataset.temperature.value * 0.1;
sif::info << "PDU2 Temperature: " << temperatureC << " °C" << std::endl;
printOutputSwitchStates();
sif::info << "PDU2 uptime: " << pdu2HkTableDataset.uptime << " seconds" << std::endl;
sif::info << "PDU2 battery mode: " << unsigned(pdu2HkTableDataset.battMode.value) << std::endl;
sif::info << "PDU2 ground watchdog reboots: " << pdu2HkTableDataset.gndWdtReboots << std::endl;
sif::info << "PDU2 ground watchdog timer seconds left: "
<< pdu2HkTableDataset.groundWatchdogSecondsLeft << " seconds" << std::endl;
sif::info << "PDU2 csp1 watchdog pings before reboot: "
<< unsigned(pdu2HkTableDataset.csp1WatchdogPingsLeft.value) << std::endl;
sif::info << "PDU2 csp2 watchdog pings before reboot: "
<< unsigned(pdu2HkTableDataset.csp2WatchdogPingsLeft.value) << std::endl;
pdu2HkTableDataset.commit();
#endif
} }
void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
@ -54,315 +33,23 @@ void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, vo
} }
LocalPoolDataSetBase *PDU2Handler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase *PDU2Handler::getDataSetHandle(sid_t sid) {
if (sid == pdu2HkTableDataset.getSid()) { if (sid == coreHk.getSid()) {
return &pdu2HkTableDataset; return &coreHk;
} else if (sid == auxHk.getSid()) {
return &auxHk;
} }
return nullptr; return nullptr;
} }
void PDU2Handler::parseHkTableReply(const uint8_t *packet) { void PDU2Handler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0; GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet);
pdu2HkTableDataset.read();
/**
* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address.
*/
dataOffset += 12;
pdu2HkTableDataset.currentOutQ7S = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutPayloadPCDUCh1 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutReactionWheels =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutTCSBoardHeaterIn =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutSUSRedundant =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutDeplMechanism =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutPayloadPCDUCh6 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutACSBoardSideB =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.currentOutPayloadCamera =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutQ7S = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutPayloadPCDUCh1 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutReactionWheels =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutTCSBoardHeaterIn =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutSUSRedundant =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutDeplMechanism =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutPayloadPCDUCh6 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutACSBoardSideB =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.voltageOutPayloadCamera =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.temperature = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.converterEnable1 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.converterEnable2 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.converterEnable3 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledQ7S = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledPlPCDUCh1 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledReactionWheels = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledTCSBoardHeaterIn = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledSUSRedundant = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledDeplMechanism = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledPlPCDUCh6 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledAcsBoardSideB = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.outEnabledPayloadCamera = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.bootcause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.bootcount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.resetcause = *(packet + dataOffset + 1) << 8 | *(packet + dataOffset);
dataOffset += 4;
pdu2HkTableDataset.battMode = *(packet + dataOffset);
/* +10 because here begins the second gomspace csp packet */
dataOffset += 3 + 10;
pdu2HkTableDataset.latchupsQ7S = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsPayloadPcduCh1 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsRw = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsTcsBoardHeaterIn =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsSusRedundant =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsDeplMenchanism =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsPayloadPcduCh6 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsAcsBoardSideB =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.latchupsPayloadCamera =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
pdu2HkTableDataset.device0 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device1 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device2 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device3 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device4 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device5 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device6 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device7 = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device0Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device1Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device2Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device3Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device4Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device5Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device6Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.device7Status = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.gndWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.i2cWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.canWdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.csp1WdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.csp2WdtReboots = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.groundWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.i2cWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.canWatchdogSecondsLeft =
*(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
pdu2HkTableDataset.csp1WatchdogPingsLeft = *(packet + dataOffset);
dataOffset += 3;
pdu2HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset);
pdu2HkTableDataset.commit();
pdu2HkTableDataset.setChanged(true);
} }
ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
using namespace P60System; initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_Q7S, new PoolEntry<int16_t>({0})); poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, false);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, new PoolEntry<int16_t>({0})); poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_RW, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_SUS_REDUNDANT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_Q7S, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_RW, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM,
new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_CONV_EN_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_RW, new PoolEntry<uint8_t>({0}));
#ifdef TE0720_1CFA
localDataPoolMap.emplace(pool::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1}));
#else
localDataPoolMap.emplace(pool::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({0}));
#endif
localDataPoolMap.emplace(pool::PDU2_OUT_EN_SUS_REDUNDANT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_DEPLOYMENT_MECHANISM, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_ACS_BOARD_SIDE_B, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_OUT_EN_PAYLOAD_CAMERA, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_Q7S, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_RW, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_0, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_5, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_7, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_0_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_1_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_2_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_3_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_4_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_5_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_6_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_DEVICE_7_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU2_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
#if OBSW_ENABLE_PERIODIC_HK == 1
poolManager.subscribeForPeriodicPacket(pdu2HkTableDataset.getSid(), false, 0.4, true);
#endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -370,7 +57,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
switch (cmd) { switch (cmd) {
case (GOMSPACE::PRINT_SWITCH_V_I): { case (GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&pdu2HkTableDataset); PoolReadGuard pg(&coreHk);
result = pg.getReadResult(); result = pg.getReadResult();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
break; break;
@ -379,7 +66,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
break; break;
} }
case (GOMSPACE::PRINT_LATCHUPS): { case (GOMSPACE::PRINT_LATCHUPS): {
PoolReadGuard pg(&pdu2HkTableDataset); PoolReadGuard pg(&auxHk);
result = pg.getReadResult(); result = pg.getReadResult();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
break; break;
@ -398,77 +85,45 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
} }
void PDU2Handler::printHkTableSwitchVI() { void PDU2Handler::printHkTableSwitchVI() {
using namespace PDU2;
sif::info << "PDU2 Info:" << std::endl; sif::info << "PDU2 Info:" << std::endl;
sif::info << "Boot Cause: " << pdu2HkTableDataset.bootcause << " | Boot Count: " << std::setw(4) sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right
<< std::right << pdu2HkTableDataset.bootcount << std::endl; << coreHk.bootcount << std::endl;
sif::info << "Reset Cause: " << pdu2HkTableDataset.resetcause sif::info << "Reset Cause: " << auxHk.resetcause
<< " | Battery Mode: " << static_cast<int>(pdu2HkTableDataset.battMode.value) << " | Battery Mode: " << static_cast<int>(coreHk.battMode.value) << std::endl;
<< std::endl;
sif::info << "SwitchState, Currents [mA], Voltages [mV]: " << std::endl; sif::info << "SwitchState, Currents [mA], Voltages [mV]: " << std::endl;
sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " auto printerHelper = [&](std::string channelStr, Channels idx) {
<< unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " << std::setw(4) sif::info << std::setw(30) << std::left << channelStr << std::dec << "| "
<< std::right << pdu2HkTableDataset.currentOutQ7S.value << ", " << std::setw(4) << unsigned(coreHk.outputEnables[idx]) << ", " << std::setw(4) << std::right
<< pdu2HkTableDataset.voltageOutQ7S.value << std::endl; << coreHk.currents[idx] << ", " << std::setw(4) << coreHk.voltages[idx] << std::endl;
sif::info << std::setw(30) << std::left << "Payload PCDU Channel 1" << std::dec << "| " };
<< unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << ", " << std::setw(4) printerHelper("Q7S", Channels::Q7S);
<< std::right << pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << ", " printerHelper("PL PCDU CH1", Channels::PAYLOAD_PCDU_CH1);
<< std::setw(4) << pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; printerHelper("Reaction Wheels", Channels::RW);
sif::info << std::setw(30) << std::left << "Reaction Wheels" << std::dec << "| " printerHelper("TCS Board Heater Input", Channels::TCS_HEATER_IN);
<< unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << ", " << std::setw(4) printerHelper("SUS Redundant", Channels::SUS_REDUNDANT);
<< std::right << pdu2HkTableDataset.currentOutReactionWheels.value << ", " printerHelper("Deployment Mechanism", Channels::DEPY_MECHANISM);
<< std::setw(4) << pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; printerHelper("PL PCDU CH6", Channels::PAYLOAD_PCDU_CH6);
sif::info << std::setw(30) << std::left << "TCS Board Heater Input" << std::dec << "| " printerHelper("ACS Board B Side", Channels::ACS_B_SIDE);
<< unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << ", " << std::setw(4) printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
<< std::right << pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << ", "
<< std::setw(4) << pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl;
sif::info << std::setw(30) << std::left << "SuS Redundant" << std::dec << "| "
<< unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << ", " << std::setw(4)
<< std::right << pdu2HkTableDataset.currentOutSUSRedundant.value << ", " << std::setw(4)
<< pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl;
sif::info << std::setw(30) << std::left << "Deployment mechanism" << std::dec << "| "
<< unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << ", " << std::setw(4)
<< std::right << pdu2HkTableDataset.currentOutDeplMechanism.value << ", "
<< std::setw(4) << pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl;
sif::info << std::setw(30) << std::left << "Payload PCDU Channel 6" << std::dec << "| "
<< unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << ", " << std::setw(4)
<< std::right << pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << ", "
<< std::setw(4) << pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl;
sif::info << std::setw(30) << std::left << "ACS Board Side B" << std::dec << "| "
<< unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << ", " << std::setw(4)
<< std::right << pdu2HkTableDataset.currentOutACSBoardSideB.value << ", "
<< std::setw(4) << pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl;
sif::info << std::setw(30) << std::left << "Payload Camera" << std::dec << "| "
<< unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << ", " << std::setw(4)
<< std::right << pdu2HkTableDataset.currentOutPayloadCamera.value << ", "
<< std::setw(4) << pdu2HkTableDataset.voltageOutPayloadCamera.value << std::right
<< std::endl;
} }
void PDU2Handler::printHkTableLatchups() { void PDU2Handler::printHkTableLatchups() {
using namespace PDU2;
sif::info << "PDU2 Latchup Information" << std::endl; sif::info << "PDU2 Latchup Information" << std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Q7S" << std::dec << "| " auto printerHelper = [&](std::string channelStr, Channels idx) {
<< std::setw(4) << std::right << pdu2HkTableDataset.latchupsQ7S << std::endl; sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "TCS Board" << std::dec << "| "
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Payload PCDU Channel 1" << std::dec << std::setw(4) << std::right << auxHk.latchups[idx] << std::endl;
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsPayloadPcduCh1 };
<< std::endl; printerHelper("Q7S", Channels::Q7S);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Reaction Wheels" << std::dec printerHelper("PL PCDU CH1", Channels::PAYLOAD_PCDU_CH1);
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsRw << std::endl; printerHelper("Reaction Wheels", Channels::RW);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "TCS Board Heater Input" << std::dec printerHelper("TCS Board Heater Input", Channels::TCS_HEATER_IN);
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsTcsBoardHeaterIn printerHelper("SUS Redundant", Channels::SUS_REDUNDANT);
<< std::endl; printerHelper("Deployment Mechanism", Channels::DEPY_MECHANISM);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "SuS Nominal" << std::dec << "| " printerHelper("PL PCDU CH6", Channels::PAYLOAD_PCDU_CH6);
<< std::setw(4) << std::right << pdu2HkTableDataset.latchupsSusRedundant << std::endl; printerHelper("ACS Board B Side", Channels::ACS_B_SIDE);
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Deployment mechanism" << std::dec printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsDeplMenchanism
<< std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Payload PCDU Channel 6" << std::dec
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsPayloadPcduCh6
<< std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "ACS Board Side B" << std::dec
<< "| " << std::setw(4) << std::right << pdu2HkTableDataset.latchupsAcsBoardSideB
<< std::endl;
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Payload Camera" << std::dec << "| "
<< std::setw(4) << std::right << pdu2HkTableDataset.latchupsPayloadCamera << std::endl;
} }
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker,

View File

@ -42,7 +42,8 @@ class PDU2Handler : public GomspaceDeviceHandler {
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24; static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24;
/** Dataset for the housekeeping table of the PDU2 */ /** Dataset for the housekeeping table of the PDU2 */
PDU2::PDU2HkTableDataset pdu2HkTableDataset; PDU2::Pdu2CoreHk coreHk;
PDU2::Pdu2AuxHk auxHk;
GOMSPACE::ChannelSwitchHook channelSwitchHook = nullptr; GOMSPACE::ChannelSwitchHook channelSwitchHook = nullptr;
void* hookArgs = nullptr; void* hookArgs = nullptr;

View File

@ -7,7 +7,7 @@
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler( SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(
object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_, object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_,
object_id_t mainLineSwitcherObjectId_, pcduSwitches::Switches mainLineSwitch_, gpioId_t deplSA1, object_id_t mainLineSwitcherObjectId_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1,
gpioId_t deplSA2, uint32_t burnTimeMs) gpioId_t deplSA2, uint32_t burnTimeMs)
: SystemObject(setObjectId_), : SystemObject(setObjectId_),
gpioDriverId(gpioDriverId_), gpioDriverId(gpioDriverId_),

View File

@ -43,8 +43,8 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
*/ */
SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId, SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId,
CookieIF* gpioCookie, object_id_t mainLineSwitcherObjectId, CookieIF* gpioCookie, object_id_t mainLineSwitcherObjectId,
pcduSwitches::Switches mainLineSwitch, gpioId_t deplSA1, pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2,
gpioId_t deplSA2, uint32_t burnTimeMs); uint32_t burnTimeMs);
virtual ~SolarArrayDeploymentHandler(); virtual ~SolarArrayDeploymentHandler();

View File

@ -4,9 +4,12 @@
#include <fsfw/datapoollocal/LocalPoolVariable.h> #include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/power/definitions.h>
#include <cstdint> #include <cstdint>
#include "devices/powerSwitcherList.h"
namespace GOMSPACE { namespace GOMSPACE {
enum class Pdu { PDU1, PDU2 }; enum class Pdu { PDU1, PDU2 };
@ -45,14 +48,22 @@ namespace P60System {
enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 }; enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 };
enum class SetIds : uint32_t { PDU_1 = 1, PDU_2 = 2, P60_CORE = 3, P60_AUX = 4, ACU = 5 }; enum class SetIds : uint32_t {
PDU_1_CORE = 1,
PDU_1_AUX = 2,
PDU_2_CORE = 3,
PDU_2_AUX = 4,
P60_CORE = 5,
P60_AUX = 6,
ACU = 7
};
namespace pool { namespace pool {
enum Ids : lp_id_t { enum Ids : lp_id_t {
CURRENTS, P60_CURRENTS,
VOLTAGES, P60_VOLTAGES,
OUTPUT_ENABLE, P60_OUTPUT_ENABLE,
P60DOCK_TEMPERATURE_1, P60DOCK_TEMPERATURE_1,
P60DOCK_TEMPERATURE_2, P60DOCK_TEMPERATURE_2,
P60DOCK_BOOT_CAUSE, P60DOCK_BOOT_CAUSE,
@ -90,154 +101,34 @@ enum Ids : lp_id_t {
P60DOCK_ANT6_DEPL, P60DOCK_ANT6_DEPL,
P60DOCK_AR6_DEPL, P60DOCK_AR6_DEPL,
PDU1_CURRENT_OUT_TCS_BOARD_3V3, // IDs for both PDUs
PDU1_CURRENT_OUT_SYRLINKS, PDU_CURRENTS,
PDU1_CURRENT_OUT_STAR_TRACKER, PDU_VOLTAGES,
PDU1_CURRENT_OUT_MGT, PDU_VCC,
PDU1_CURRENT_OUT_SUS_NOMINAL, PDU_VBAT,
PDU1_CURRENT_OUT_SOLAR_CELL_EXP, PDU_TEMPERATURE,
PDU1_CURRENT_OUT_PLOC, PDU_CONV_EN_1,
PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, PDU_CONV_EN_2,
PDU1_CURRENT_OUT_CHANNEL8, PDU_CONV_EN_3,
PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, PDU_OUT_ENABLE,
PDU1_VOLTAGE_OUT_SYRLINKS, PDU_BOOTCAUSE,
PDU1_VOLTAGE_OUT_STAR_TRACKER, PDU_BOOTCNT,
PDU1_VOLTAGE_OUT_MGT, PDU_UPTIME,
PDU1_VOLTAGE_OUT_SUS_NOMINAL, PDU_RESETCAUSE,
PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, PDU_BATT_MODE,
PDU1_VOLTAGE_OUT_PLOC, PDU_LATCHUPS,
PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, PDU_DEVICES,
PDU1_VOLTAGE_OUT_CHANNEL8, PDU_STATUSES,
PDU1_VCC, PDU_WDT_CNT_GND,
PDU1_VBAT, PDU_WDT_CNT_I2C,
PDU1_TEMPERATURE, PDU_WDT_CNT_CAN,
PDU1_CONV_EN_1, PDU_WDT_CNT_CSP1,
PDU1_CONV_EN_2, PDU_WDT_CNT_CSP2,
PDU1_CONV_EN_3, PDU_WDT_GND_LEFT,
PDU1_OUT_EN_TCS_BOARD_3V3, PDU_WDT_I2C_LEFT,
PDU1_OUT_EN_SYRLINKS, PDU_WDT_CAN_LEFT,
PDU1_OUT_EN_STAR_TRACKER, PDU_WDT_CSP_LEFT1,
PDU1_OUT_EN_MGT, PDU_WDT_CSP_LEFT2,
PDU1_OUT_EN_SUS_NOMINAL,
PDU1_OUT_EN_SOLAR_CELL_EXP,
PDU1_OUT_EN_PLOC,
PDU1_OUT_EN_ACS_BOARD_SIDE_A,
PDU1_OUT_EN_CHANNEL8,
PDU1_BOOTCAUSE,
PDU1_BOOTCNT,
PDU1_UPTIME,
PDU1_RESETCAUSE,
PDU1_BATT_MODE,
PDU1_LATCHUP_TCS_BOARD_3V3,
PDU1_LATCHUP_SYRLINKS,
PDU1_LATCHUP_STAR_TRACKER,
PDU1_LATCHUP_MGT,
PDU1_LATCHUP_SUS_NOMINAL,
PDU1_LATCHUP_SOLAR_CELL_EXP,
PDU1_LATCHUP_PLOC,
PDU1_LATCHUP_ACS_BOARD_SIDE_A,
PDU1_LATCHUP_CHANNEL8,
PDU1_DEVICE_0,
PDU1_DEVICE_1,
PDU1_DEVICE_2,
PDU1_DEVICE_3,
PDU1_DEVICE_4,
PDU1_DEVICE_5,
PDU1_DEVICE_6,
PDU1_DEVICE_7,
PDU1_DEVICE_0_STATUS,
PDU1_DEVICE_1_STATUS,
PDU1_DEVICE_2_STATUS,
PDU1_DEVICE_3_STATUS,
PDU1_DEVICE_4_STATUS,
PDU1_DEVICE_5_STATUS,
PDU1_DEVICE_6_STATUS,
PDU1_DEVICE_7_STATUS,
PDU1_WDT_CNT_GND,
PDU1_WDT_CNT_I2C,
PDU1_WDT_CNT_CAN,
PDU1_WDT_CNT_CSP1,
PDU1_WDT_CNT_CSP2,
PDU1_WDT_GND_LEFT,
PDU1_WDT_I2C_LEFT,
PDU1_WDT_CAN_LEFT,
PDU1_WDT_CSP_LEFT1,
PDU1_WDT_CSP_LEFT2,
/** PDU2 Ids */
PDU2_CURRENT_OUT_Q7S,
PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1,
PDU2_CURRENT_OUT_RW,
PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN,
PDU2_CURRENT_OUT_SUS_REDUNDANT,
PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM,
PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6,
PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B,
PDU2_CURRENT_OUT_PAYLOAD_CAMERA,
PDU2_VOLTAGE_OUT_Q7S,
PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1,
PDU2_VOLTAGE_OUT_RW,
PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN,
PDU2_VOLTAGE_OUT_SUS_REDUNDANT,
PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM,
PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6,
PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B,
PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA,
PDU2_VCC,
PDU2_VBAT,
PDU2_TEMPERATURE,
PDU2_CONV_EN_1,
PDU2_CONV_EN_2,
PDU2_CONV_EN_3,
PDU2_OUT_EN_Q7S,
PDU2_OUT_EN_PAYLOAD_PCDU_CH1,
PDU2_OUT_EN_RW,
PDU2_OUT_EN_TCS_BOARD_HEATER_IN,
PDU2_OUT_EN_SUS_REDUNDANT,
PDU2_OUT_EN_DEPLOYMENT_MECHANISM,
PDU2_OUT_EN_PAYLOAD_PCDU_CH6,
PDU2_OUT_EN_ACS_BOARD_SIDE_B,
PDU2_OUT_EN_PAYLOAD_CAMERA,
PDU2_BOOTCAUSE,
PDU2_BOOTCNT,
PDU2_UPTIME,
PDU2_RESETCAUSE,
PDU2_BATT_MODE,
PDU2_LATCHUP_Q7S,
PDU2_LATCHUP_PAYLOAD_PCDU_CH1,
PDU2_LATCHUP_RW,
PDU2_LATCHUP_TCS_BOARD_HEATER_IN,
PDU2_LATCHUP_SUS_REDUNDANT,
PDU2_LATCHUP_DEPLOYMENT_MECHANISM,
PDU2_LATCHUP_PAYLOAD_PCDU_CH6,
PDU2_LATCHUP_ACS_BOARD_SIDE_B,
PDU2_LATCHUP_PAYLOAD_CAMERA,
PDU2_DEVICE_0,
PDU2_DEVICE_1,
PDU2_DEVICE_2,
PDU2_DEVICE_3,
PDU2_DEVICE_4,
PDU2_DEVICE_5,
PDU2_DEVICE_6,
PDU2_DEVICE_7,
PDU2_DEVICE_0_STATUS,
PDU2_DEVICE_1_STATUS,
PDU2_DEVICE_2_STATUS,
PDU2_DEVICE_3_STATUS,
PDU2_DEVICE_4_STATUS,
PDU2_DEVICE_5_STATUS,
PDU2_DEVICE_6_STATUS,
PDU2_DEVICE_7_STATUS,
PDU2_WDT_CNT_GND,
PDU2_WDT_CNT_I2C,
PDU2_WDT_CNT_CAN,
PDU2_WDT_CNT_CSP1,
PDU2_WDT_CNT_CSP2,
PDU2_WDT_GND_LEFT,
PDU2_WDT_I2C_LEFT,
PDU2_WDT_CAN_LEFT,
PDU2_WDT_CSP_LEFT1,
PDU2_WDT_CSP_LEFT2,
/** ACU Ids */ /** ACU Ids */
ACU_CURRENT_IN_CHANNEL0, ACU_CURRENT_IN_CHANNEL0,
@ -302,7 +193,7 @@ enum Ids : lp_id_t {
ACU_DEVICE_6_STATUS, ACU_DEVICE_6_STATUS,
ACU_DEVICE_7_STATUS, ACU_DEVICE_7_STATUS,
ACU_WDT_CNT_GND, ACU_WDT_CNT_GND,
ACU_WDT_GND_LEFT ACU_WDT_GND_LEFT,
}; };
} }
} // namespace P60System } // namespace P60System
@ -373,18 +264,18 @@ class CoreHkSet : public StaticLocalDataSet<16> {
/** Measured output currents */ /** Measured output currents */
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN> currents = lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN> currents =
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::CURRENTS, lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::P60_CURRENTS,
this); this);
/** Measured output voltages */ /** Measured output voltages */
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> voltages = lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> voltages =
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::VOLTAGES, lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::P60_VOLTAGES,
this); this);
/** Output enable states */ /** Output enable states */
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN> outputEnables = lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN> outputEnables =
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::OUTPUT_ENABLE, lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId,
this); P60System::pool::P60_OUTPUT_ENABLE, this);
lp_var_t<uint32_t> bootCount = lp_var_t<uint32_t> bootCount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CNT, this); lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CNT, this);
lp_var_t<uint8_t> battMode = lp_var_t<uint8_t> battMode =
@ -495,11 +386,114 @@ static const uint16_t MAX_HKTABLE_ADDRESS = 141;
/** The size of the csp reply containing the housekeeping table data */ /** The size of the csp reply containing the housekeeping table data */
static const uint16_t HK_TABLE_REPLY_SIZE = 303; static const uint16_t HK_TABLE_REPLY_SIZE = 303;
static const uint8_t HK_TABLE_ENTRIES = 73; static const uint8_t HK_TABLE_ENTRIES = 73;
static constexpr uint8_t CHANNELS_LEN = 9;
static constexpr uint8_t DEVICES_NUM = 8;
class PduCoreHk : public StaticLocalDataSet<9> {
public:
PduCoreHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
PduCoreHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
/** Measured output currents */
lp_vec_t<int16_t, 9> currents =
lp_vec_t<int16_t, 9>(sid.objectId, P60System::pool::PDU_CURRENTS, this);
/** Measured output currents */
lp_vec_t<int16_t, 9> voltages =
lp_vec_t<int16_t, 9>(sid.objectId, P60System::pool::PDU_VOLTAGES, this);
/** Output switch states */
lp_vec_t<uint8_t, 9> outputEnables =
lp_vec_t<uint8_t, 9>(sid.objectId, P60System::pool::PDU_VOLTAGES, this);
/** Number of reboots */
lp_var_t<uint32_t> bootcount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCNT, this);
/** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_BATT_MODE, this);
lp_var_t<int16_t> temperature =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_TEMPERATURE, this);
};
/**
* @brief This class defines a dataset for the hk table of a PDU
*/
class PduAuxHk : public StaticLocalDataSet<36> {
public:
PduAuxHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
PduAuxHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
/** Measured VCC */
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_VBAT, this);
/** Output converter enable status */
lp_var_t<uint8_t> converterEnable1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_CONV_EN_1, this);
lp_var_t<uint8_t> converterEnable2 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_CONV_EN_2, this);
lp_var_t<uint8_t> converterEnable3 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_CONV_EN_3, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCAUSE, this);
/** Uptime in seconds */
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU_RESETCAUSE, this);
/** Number of detected latchups on each output channel */
lp_vec_t<uint16_t, 9> latchups =
lp_vec_t<uint16_t, 9>(sid.objectId, P60System::pool::PDU_LATCHUPS, this);
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
lp_vec_t<uint8_t, 8> deviceTypes =
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::PDU_DEVICES, this);
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
lp_vec_t<uint8_t, 8> devicesStatus =
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::PDU_STATUSES, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_GND, this);
/** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_I2C, this);
/** Number of reboots triggered through the CAN watchdog */
lp_var_t<uint32_t> canWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> csp1WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> csp2WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_GND_LEFT, this);
/** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_I2C_LEFT, this);
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CAN_LEFT, this);
/** CSP watchdogs remaining pings before rebooting. */
lp_var_t<uint8_t> csp2WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp1WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT2, this);
};
} // namespace PDU } // namespace PDU
namespace PDU1 { namespace PDU1 {
enum SwitchChannels : uint8_t { enum Channels : uint8_t {
TCS_BOARD_3V3 = 0, TCS_BOARD_3V3 = 0,
SYRLINKS = 1, SYRLINKS = 1,
STR = 2, STR = 2,
@ -508,7 +502,8 @@ enum SwitchChannels : uint8_t {
SOL_CELL_EXPERIMENT = 5, SOL_CELL_EXPERIMENT = 5,
PLOC = 6, PLOC = 6,
ACS_A_SIDE = 7, ACS_A_SIDE = 7,
UNUSED = 8 UNUSED = 8,
LEN = 9
}; };
/** /**
@ -525,185 +520,29 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_PLOC = 0x4E;
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x4F; static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50; static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50;
/** class Pdu1CoreHk : public ::PDU::PduCoreHk {
* @brief This class defines a dataset for the hk table of the PDU1.
*/
class PDU1HkTableDataset : public StaticLocalDataSet<PDU::HK_TABLE_ENTRIES> {
public: public:
PDU1HkTableDataset(HasLocalDataPoolIF* owner) Pdu1CoreHk(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1)) {} : PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1_CORE)) {}
PDU1HkTableDataset(object_id_t objectId) Pdu1CoreHk(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1))) {} : PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1_CORE)) {}
/** Measured output currents */
lp_var_t<int16_t> currentOutTCSBoard3V3 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_TCS_BOARD_3V3, this);
lp_var_t<int16_t> currentOutSyrlinks =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_SYRLINKS, this);
lp_var_t<int16_t> currentOutStarTracker =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_STAR_TRACKER, this);
lp_var_t<int16_t> currentOutMGT =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_MGT, this);
lp_var_t<int16_t> currentOutSUSNominal =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_SUS_NOMINAL, this);
lp_var_t<int16_t> currentOutSolarCellExp =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_SOLAR_CELL_EXP, this);
lp_var_t<int16_t> currentOutPLOC =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_PLOC, this);
lp_var_t<int16_t> currentOutACSBoardSideA =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, this);
lp_var_t<int16_t> currentOutChannel8 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_CURRENT_OUT_CHANNEL8, this);
/** Measured voltage of output channels */
lp_var_t<int16_t> voltageOutTCSBoard3V3 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, this);
lp_var_t<int16_t> voltageOutSyrlinks =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_SYRLINKS, this);
lp_var_t<int16_t> voltageOutStarTracker =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_STAR_TRACKER, this);
lp_var_t<int16_t> voltageOutMGT =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_MGT, this);
lp_var_t<int16_t> voltageOutSUSNominal =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_SUS_NOMINAL, this);
lp_var_t<int16_t> voltageOutSolarCellExp =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, this);
lp_var_t<int16_t> voltageOutPLOC =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_PLOC, this);
lp_var_t<int16_t> voltageOutACSBoardSideA =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, this);
lp_var_t<int16_t> voltageOutChannel8 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VOLTAGE_OUT_CHANNEL8, this);
/** Measured VCC */
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_VBAT, this);
lp_var_t<int16_t> temperature =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU1_TEMPERATURE, this);
/** Output converter enable status */
lp_var_t<uint8_t> converterEnable1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_CONV_EN_1, this);
lp_var_t<uint8_t> converterEnable2 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_CONV_EN_2, this);
lp_var_t<uint8_t> converterEnable3 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_CONV_EN_3, this);
/** Output channels enable status */
lp_var_t<uint8_t> outEnabledTCSBoard3V3 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_TCS_BOARD_3V3, this);
lp_var_t<uint8_t> outEnabledSyrlinks =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_SYRLINKS, this);
lp_var_t<uint8_t> outEnabledStarTracker =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_STAR_TRACKER, this);
lp_var_t<uint8_t> outEnabledMGT =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_MGT, this);
lp_var_t<uint8_t> outEnabledSUSNominal =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_SUS_NOMINAL, this);
lp_var_t<uint8_t> outEnabledSolarCellExp =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_SOLAR_CELL_EXP, this);
lp_var_t<uint8_t> outEnabledPLOC =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_PLOC, this);
lp_var_t<uint8_t> outEnabledAcsBoardSideA =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_ACS_BOARD_SIDE_A, this);
lp_var_t<uint8_t> outEnabledChannel8 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_OUT_EN_CHANNEL8, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_BOOTCAUSE, this);
/** Number of reboots */
lp_var_t<uint32_t> bootcount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_BOOTCNT, this);
/** Uptime in seconds */
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_RESETCAUSE, this);
/** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_BATT_MODE, this);
/** Number of detected latchups on each output channel */
lp_var_t<uint16_t> latchupsTcsBoard3V3 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_TCS_BOARD_3V3, this);
lp_var_t<uint16_t> latchupsSyrlinks =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_SYRLINKS, this);
lp_var_t<uint16_t> latchupsStarTracker =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_STAR_TRACKER, this);
lp_var_t<uint16_t> latchupsMgt =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_MGT, this);
lp_var_t<uint16_t> latchupsSusNominal =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_SUS_NOMINAL, this);
lp_var_t<uint16_t> latchupsSolarCellExp =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_SOLAR_CELL_EXP, this);
lp_var_t<uint16_t> latchupsPloc =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_PLOC, this);
lp_var_t<uint16_t> latchupsAcsBoardSideA =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_ACS_BOARD_SIDE_A, this);
lp_var_t<uint16_t> latchupsChannel8 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU1_LATCHUP_CHANNEL8, this);
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
lp_var_t<uint8_t> device0 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_0, this);
lp_var_t<uint8_t> device1 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_1, this);
lp_var_t<uint8_t> device2 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_2, this);
lp_var_t<uint8_t> device3 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_3, this);
lp_var_t<uint8_t> device4 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_4, this);
lp_var_t<uint8_t> device5 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_5, this);
lp_var_t<uint8_t> device6 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_6, this);
lp_var_t<uint8_t> device7 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_7, this);
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
lp_var_t<uint8_t> device0Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_0_STATUS, this);
lp_var_t<uint8_t> device1Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_1_STATUS, this);
lp_var_t<uint8_t> device2Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_2_STATUS, this);
lp_var_t<uint8_t> device3Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_3_STATUS, this);
lp_var_t<uint8_t> device4Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_4_STATUS, this);
lp_var_t<uint8_t> device5Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_5_STATUS, this);
lp_var_t<uint8_t> device6Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_6_STATUS, this);
lp_var_t<uint8_t> device7Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_DEVICE_7_STATUS, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CNT_GND, this);
/** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CNT_I2C, this);
/** Number of reboots triggered through the CAN watchdog */
lp_var_t<uint32_t> canWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> csp1WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> csp2WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_GND_LEFT, this);
/** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_I2C_LEFT, this);
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU1_WDT_CAN_LEFT, this);
/** CSP watchdogs remaining pings before rebooting. */
lp_var_t<uint8_t> csp2WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp1WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU1_WDT_CSP_LEFT2, this);
}; };
class Pdu1AuxHk : public ::PDU::PduAuxHk {
public:
Pdu1AuxHk(HasLocalDataPoolIF* owner)
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1_AUX)) {}
Pdu1AuxHk(object_id_t objectId)
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1_AUX)) {}
};
} // namespace PDU1 } // namespace PDU1
namespace PDU2 { namespace PDU2 {
enum SwitchChannels : uint8_t { enum Channels : uint8_t {
Q7S = 0, Q7S = 0,
PAYLOAD_PCDU_CH1 = 1, PAYLOAD_PCDU_CH1 = 1,
RW = 2, RW = 2,
@ -712,7 +551,8 @@ enum SwitchChannels : uint8_t {
DEPY_MECHANISM = 5, DEPY_MECHANISM = 5,
PAYLOAD_PCDU_CH6 = 6, PAYLOAD_PCDU_CH6 = 6,
ACS_B_SIDE = 7, ACS_B_SIDE = 7,
PAYLOAD_CAMERA = 8 PAYLOAD_CAMERA = 8,
LEN = 9
}; };
/** /**
@ -729,180 +569,24 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6 = 0x4E;
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F; static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50; static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50;
/** class Pdu2CoreHk : public ::PDU::PduCoreHk {
* @brief This class defines a dataset for the hk table of the PDU2.
*/
class PDU2HkTableDataset : public StaticLocalDataSet<PDU::HK_TABLE_ENTRIES> {
public: public:
PDU2HkTableDataset(HasLocalDataPoolIF* owner) Pdu2CoreHk(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2)) {} : PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2_CORE)) {}
PDU2HkTableDataset(object_id_t objectId) Pdu2CoreHk(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2))) {} : PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2_CORE)) {}
/** Measured output currents */
lp_var_t<int16_t> currentOutQ7S =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_Q7S, this);
lp_var_t<int16_t> currentOutPayloadPCDUCh1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, this);
lp_var_t<int16_t> currentOutReactionWheels =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_RW, this);
lp_var_t<int16_t> currentOutTCSBoardHeaterIn =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, this);
lp_var_t<int16_t> currentOutSUSRedundant =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_SUS_REDUNDANT, this);
lp_var_t<int16_t> currentOutDeplMechanism =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, this);
lp_var_t<int16_t> currentOutPayloadPCDUCh6 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, this);
lp_var_t<int16_t> currentOutACSBoardSideB =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, this);
lp_var_t<int16_t> currentOutPayloadCamera =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, this);
/** Measured voltage of output channels */
lp_var_t<int16_t> voltageOutQ7S =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_Q7S, this);
lp_var_t<int16_t> voltageOutPayloadPCDUCh1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, this);
lp_var_t<int16_t> voltageOutReactionWheels =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_RW, this);
lp_var_t<int16_t> voltageOutTCSBoardHeaterIn =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, this);
lp_var_t<int16_t> voltageOutSUSRedundant =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, this);
lp_var_t<int16_t> voltageOutDeplMechanism =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, this);
lp_var_t<int16_t> voltageOutPayloadPCDUCh6 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, this);
lp_var_t<int16_t> voltageOutACSBoardSideB =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, this);
lp_var_t<int16_t> voltageOutPayloadCamera =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, this);
/** Measured VCC */
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_VBAT, this);
lp_var_t<int16_t> temperature =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU2_TEMPERATURE, this);
/** Output converter enable status */
lp_var_t<uint8_t> converterEnable1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_CONV_EN_1, this);
lp_var_t<uint8_t> converterEnable2 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_CONV_EN_2, this);
lp_var_t<uint8_t> converterEnable3 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_CONV_EN_3, this);
/** Output channels enable status */
lp_var_t<uint8_t> outEnabledQ7S =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_Q7S, this);
lp_var_t<uint8_t> outEnabledPlPCDUCh1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, this);
lp_var_t<uint8_t> outEnabledReactionWheels =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_RW, this);
lp_var_t<uint8_t> outEnabledTCSBoardHeaterIn =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, this);
lp_var_t<uint8_t> outEnabledSUSRedundant =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_SUS_REDUNDANT, this);
lp_var_t<uint8_t> outEnabledDeplMechanism =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_DEPLOYMENT_MECHANISM, this);
lp_var_t<uint8_t> outEnabledPlPCDUCh6 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, this);
lp_var_t<uint8_t> outEnabledAcsBoardSideB =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_ACS_BOARD_SIDE_B, this);
lp_var_t<uint8_t> outEnabledPayloadCamera =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_OUT_EN_PAYLOAD_CAMERA, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_BOOTCAUSE, this);
/** Number of reboots */
lp_var_t<uint32_t> bootcount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_BOOTCNT, this);
/** Uptime in seconds */
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_RESETCAUSE, this);
/** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_BATT_MODE, this);
/** Number of detected latchups on each output channel */
lp_var_t<uint16_t> latchupsQ7S =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_Q7S, this);
lp_var_t<uint16_t> latchupsPayloadPcduCh1 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, this);
lp_var_t<uint16_t> latchupsRw =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_RW, this);
lp_var_t<uint16_t> latchupsTcsBoardHeaterIn =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, this);
lp_var_t<uint16_t> latchupsSusRedundant =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_SUS_REDUNDANT, this);
lp_var_t<uint16_t> latchupsDeplMenchanism =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, this);
lp_var_t<uint16_t> latchupsPayloadPcduCh6 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, this);
lp_var_t<uint16_t> latchupsAcsBoardSideB =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_ACS_BOARD_SIDE_B, this);
lp_var_t<uint16_t> latchupsPayloadCamera =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU2_LATCHUP_PAYLOAD_CAMERA, this);
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
lp_var_t<uint8_t> device0 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_0, this);
lp_var_t<uint8_t> device1 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_1, this);
lp_var_t<uint8_t> device2 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_2, this);
lp_var_t<uint8_t> device3 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_3, this);
lp_var_t<uint8_t> device4 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_4, this);
lp_var_t<uint8_t> device5 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_5, this);
lp_var_t<uint8_t> device6 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_6, this);
lp_var_t<uint8_t> device7 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_7, this);
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
lp_var_t<uint8_t> device0Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_0_STATUS, this);
lp_var_t<uint8_t> device1Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_1_STATUS, this);
lp_var_t<uint8_t> device2Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_2_STATUS, this);
lp_var_t<uint8_t> device3Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_3_STATUS, this);
lp_var_t<uint8_t> device4Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_4_STATUS, this);
lp_var_t<uint8_t> device5Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_5_STATUS, this);
lp_var_t<uint8_t> device6Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_6_STATUS, this);
lp_var_t<uint8_t> device7Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_DEVICE_7_STATUS, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CNT_GND, this);
/** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CNT_I2C, this);
/** Number of reboots triggered through the CAN watchdog */
lp_var_t<uint32_t> canWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> csp1WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> csp2WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_GND_LEFT, this);
/** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_I2C_LEFT, this);
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU2_WDT_CAN_LEFT, this);
/** CSP watchdog remaining pings before rebooting. */
lp_var_t<uint8_t> csp1WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp2WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU2_WDT_CSP_LEFT2, this);
}; };
class Pdu2AuxHk : public ::PDU::PduAuxHk {
public:
Pdu2AuxHk(HasLocalDataPoolIF* owner)
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2_AUX)) {}
Pdu2AuxHk(object_id_t objectId)
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2_AUX)) {}
};
} // namespace PDU2 } // namespace PDU2
namespace ACU { namespace ACU {
@ -1054,4 +738,65 @@ class HkTableDataset : public StaticLocalDataSet<HK_TABLE_ENTRIES> {
}; };
} // namespace ACU } // namespace ACU
namespace pcdu {
enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES };
/* Switches are uint8_t datatype and go from 0 to 255 */
enum Switches : power::Switch_t {
PDU1_CH0_TCS_BOARD_3V3,
PDU1_CH1_SYRLINKS_12V,
PDU1_CH2_STAR_TRACKER_5V,
PDU1_CH3_MGT_5V,
PDU1_CH4_SUS_NOMINAL_3V3,
PDU1_CH5_SOLAR_CELL_EXP_5V,
PDU1_CH6_PLOC_12V,
PDU1_CH7_ACS_A_SIDE_3V3,
PDU1_CH8_UNOCCUPIED,
PDU2_CH0_Q7S,
PDU2_CH1_PL_PCDU_BATT_0_14V8,
PDU2_CH2_RW_5V,
PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
PDU2_CH4_SUS_REDUNDANT_3V3,
PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
PDU2_CH6_PL_PCDU_BATT_1_14V8,
PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
PDU2_CH8_PAYLOAD_CAMERA
};
static constexpr uint8_t NUMBER_OF_SWITCHES = 18;
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
// Output states after reboot of the PDUs
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU1 = {
// Because the TE0720 is not connected to the PCDU, this switch is always on
#ifdef TE0720_1CFA
ON,
#else
OFF,
#endif
OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF,
};
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU2 = {ON, OFF, OFF, OFF, OFF,
OFF, OFF, OFF, OFF};
static constexpr uint32_t SWITCHER_SET_ID = 0;
class SwitcherStates : public StaticLocalDataSet<NUMBER_OF_SWITCHES> {
public:
SwitcherStates(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SWITCHER_SET_ID) {}
SwitcherStates(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SWITCHER_SET_ID)) {}
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu1Switches =
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);
};
} // namespace pcdu
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ */

View File

@ -4,6 +4,8 @@
#include <fsfw/power/PowerSwitchIF.h> #include <fsfw/power/PowerSwitchIF.h>
#include <fsfw/serviceinterface.h> #include <fsfw/serviceinterface.h>
#include "OBSWConfig.h"
AcsBoardAssembly::AcsBoardAssembly(object_id_t objectId, object_id_t parentId, AcsBoardAssembly::AcsBoardAssembly(object_id_t objectId, object_id_t parentId,
PowerSwitchIF* switcher, AcsBoardHelper helper, GpioIF* gpioIF) PowerSwitchIF* switcher, AcsBoardHelper helper, GpioIF* gpioIF)
: DualLaneAssemblyBase(objectId, parentId, switcher, SWITCH_A, SWITCH_B, : DualLaneAssemblyBase(objectId, parentId, switcher, SWITCH_A, SWITCH_B,

View File

@ -105,10 +105,8 @@ class AcsBoardAssembly : public DualLaneAssemblyBase {
void selectGpsInDualMode(duallane::Submodes side); void selectGpsInDualMode(duallane::Submodes side);
private: private:
static constexpr pcduSwitches::Switches SWITCH_A = static constexpr pcdu::Switches SWITCH_A = pcdu::Switches::PDU1_CH7_ACS_A_SIDE_3V3;
pcduSwitches::Switches::PDU1_CH7_ACS_A_SIDE_3V3; static constexpr pcdu::Switches SWITCH_B = pcdu::Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3;
static constexpr pcduSwitches::Switches SWITCH_B =
pcduSwitches::Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3;
bool tryingOtherSide = false; bool tryingOtherSide = false;
bool dualModeErrorSwitch = true; bool dualModeErrorSwitch = true;

View File

@ -2,10 +2,11 @@
#include <fsfw/ipc/QueueFactory.h> #include <fsfw/ipc/QueueFactory.h>
#include "OBSWConfig.h"
DualLaneAssemblyBase::DualLaneAssemblyBase(object_id_t objectId, object_id_t parentId, DualLaneAssemblyBase::DualLaneAssemblyBase(object_id_t objectId, object_id_t parentId,
PowerSwitchIF* pwrSwitcher, PowerSwitchIF* pwrSwitcher, pcdu::Switches switch1,
pcduSwitches::Switches switch1, pcdu::Switches switch2, Event pwrTimeoutEvent,
pcduSwitches::Switches switch2, Event pwrTimeoutEvent,
Event sideSwitchNotAllowedEvent, Event sideSwitchNotAllowedEvent,
Event transitionOtherSideFailedEvent) Event transitionOtherSideFailedEvent)
: AssemblyBase(objectId, parentId, 20), : AssemblyBase(objectId, parentId, 20),

View File

@ -19,9 +19,8 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
static constexpr UniqueEventId_t SIDE_SWITCH_TRANSITION_NOT_ALLOWED_ID = 3; static constexpr UniqueEventId_t SIDE_SWITCH_TRANSITION_NOT_ALLOWED_ID = 3;
DualLaneAssemblyBase(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher, DualLaneAssemblyBase(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
pcduSwitches::Switches switch1, pcduSwitches::Switches switch2, pcdu::Switches switch1, pcdu::Switches switch2, Event pwrSwitchTimeoutEvent,
Event pwrSwitchTimeoutEvent, Event sideSwitchNotAllowedEvent, Event sideSwitchNotAllowedEvent, Event transitionOtherSideFailedEvent);
Event transitionOtherSideFailedEvent);
protected: protected:
// This helper object complete encapsulates power switching // This helper object complete encapsulates power switching

View File

@ -43,10 +43,8 @@ class SusAssembly : public DualLaneAssemblyBase {
private: private:
enum class States { IDLE, SWITCHING_POWER, MODE_COMMANDING } state = States::IDLE; enum class States { IDLE, SWITCHING_POWER, MODE_COMMANDING } state = States::IDLE;
static constexpr pcduSwitches::Switches SWITCH_NOM = static constexpr pcdu::Switches SWITCH_NOM = pcdu::Switches::PDU1_CH4_SUS_NOMINAL_3V3;
pcduSwitches::Switches::PDU1_CH4_SUS_NOMINAL_3V3; static constexpr pcdu::Switches SWITCH_RED = pcdu::Switches::PDU2_CH4_SUS_REDUNDANT_3V3;
static constexpr pcduSwitches::Switches SWITCH_RED =
pcduSwitches::Switches::PDU2_CH4_SUS_REDUNDANT_3V3;
FixedArrayList<ModeListEntry, NUMBER_SUN_SENSORS> modeTable; FixedArrayList<ModeListEntry, NUMBER_SUN_SENSORS> modeTable;
SusAssHelper helper; SusAssHelper helper;