added gps reset callback
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include "PDU1Handler.h"
|
||||
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
|
||||
#include <OBSWConfig.h>
|
||||
|
||||
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) :
|
||||
GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS,
|
||||
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset), pdu1HkTableDataset(
|
||||
this) {
|
||||
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset),
|
||||
pdu1HkTableDataset(this) {
|
||||
}
|
||||
|
||||
PDU1Handler::~PDU1Handler() {
|
||||
@ -55,25 +56,9 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
|
||||
<< std::endl;
|
||||
sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8
|
||||
<< std::endl;
|
||||
sif::info << "PDU1 TCS Board switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl;
|
||||
sif::info << "PDU1 Syrlinks switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl;
|
||||
sif::info << "PDU1 star tracker switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl;
|
||||
sif::info << "PDU1 MGT switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << std::endl;
|
||||
sif::info << "PDU1 SUS nominal switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl;
|
||||
sif::info << "PDU1 solar cell experiment switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl;
|
||||
sif::info << "PDU1 PLOC switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl;
|
||||
sif::info << "PDU1 ACS Side A switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl;
|
||||
sif::info << "PDU1 channel 8 switch: "
|
||||
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl;
|
||||
sif::info << "PDU1 battery mode: " << static_cast<unsigned int>(pdu1HkTableDataset.battMode.value) << 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;
|
||||
@ -87,9 +72,35 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
|
||||
#endif
|
||||
}
|
||||
|
||||
void PDU1Handler::printOutputSwitchStates() {
|
||||
sif::info << "PDU1 TCS Board switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl;
|
||||
sif::info << "PDU1 Syrlinks switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl;
|
||||
sif::info << "PDU1 star tracker switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl;
|
||||
sif::info << "PDU1 MGT switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << std::endl;
|
||||
sif::info << "PDU1 SUS nominal switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl;
|
||||
sif::info << "PDU1 solar cell experiment switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl;
|
||||
sif::info << "PDU1 PLOC switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl;
|
||||
sif::info << "PDU1 ACS Side A switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl;
|
||||
sif::info << "PDU1 channel 8 switch: " <<
|
||||
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl;
|
||||
}
|
||||
|
||||
void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
|
||||
uint16_t dataOffset = 0;
|
||||
pdu1HkTableDataset.read();
|
||||
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;
|
||||
@ -249,8 +260,10 @@ void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
|
||||
dataOffset += 3;
|
||||
pdu1HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset);
|
||||
|
||||
pdu1HkTableDataset.commit();
|
||||
pdu1HkTableDataset.setChanged(true);
|
||||
if(not pdu1HkTableDataset.isValid()) {
|
||||
pdu1HkTableDataset.setValidity(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PDU1Handler::initializeLocalDataPool(
|
||||
@ -341,3 +354,20 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool(
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
|
||||
switch(cmd) {
|
||||
case(GOMSPACE::PRINT_OUT_ENB_STATUS): {
|
||||
PoolReadGuard pg(&pdu1HkTableDataset);
|
||||
ReturnValue_t readResult = pg.getReadResult();
|
||||
if(readResult != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
printOutputSwitchStates();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
default: {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user