config table retrieval works
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-08-27 01:02:08 +02:00
parent 8c110460a6
commit e8208a21a4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
19 changed files with 366 additions and 251 deletions

View File

@ -37,6 +37,6 @@ uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
localDataPoolMap.emplace(ACU::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
return returnvalue::OK;
}

View File

@ -40,7 +40,7 @@ uint32_t P60DockDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { re
ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
return returnvalue::OK;
}

View File

@ -37,6 +37,6 @@ uint32_t PduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
ReturnValue_t PduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(PDU::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
return returnvalue::OK;
}

2
fsfw

@ -1 +1 @@
Subproject commit f5866ddacee6cd0f381fb1a69f1d0cf22b5b310a
Subproject commit 2a75440b325b70b7ca90269159440a1f9a4a6e2a

View File

@ -71,7 +71,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
uint16_t maxReplyLength = cspCookie->getMaxReplyLength();
if (cspDeviceMap.find(cspAddress) == cspDeviceMap.end()) {
/* Insert device information in CSP map */
cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength));
cspDeviceMap.emplace(cspAddress, ReplyInfo(maxReplyLength));
}
return returnvalue::OK;
}
@ -104,6 +104,10 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
return returnvalue::FAILED;
}
uint8_t cspAddress = cspCookie->getCspAddress();
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return returnvalue::FAILED;
}
switch (cspPort) {
case (CspPorts::CSP_PING): {
initiatePingRequest(cspAddress, querySize);
@ -117,7 +121,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
case (CspPorts::P60_PORT_RPARAM_ENUM): {
if (cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
param_index_t requestStruct{};
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
requestStruct.physaddr = iter->second.replyBuf.data();
auto req = cspCookie->getRequest();
if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
if (!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
@ -139,8 +143,29 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
requestStruct.size = P60PDU_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
param_list(&requestStruct, 1);
return (result == 0);
if (result != 0) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_CONFIG) {
requestStruct.table = p60acu_config;
requestStruct.mem_id = P60ACU_PARAM;
requestStruct.count = p60acu_config_count;
requestStruct.size = P60ACU_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
if (result != 0) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_CONFIG) {
requestStruct.table = p60dock_config;
requestStruct.mem_id = P60DOCK_PARAM;
requestStruct.count = p60dock_config_count;
requestStruct.size = P60DOCK_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
if (result != 0) {
return returnvalue::FAILED;
}
}
} else {
/* No CSP fixed port was selected. Send data to the specified port and
@ -150,7 +175,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
return returnvalue::FAILED;
}
}
replySize = querySize;
iter->second.replyLen = querySize;
break;
}
default:
@ -176,9 +201,12 @@ ReturnValue_t CspComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
}
uint8_t cspAddress = cspCookie->getCspAddress();
*buffer = cspDeviceMap[cspAddress].data();
*size = replySize;
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return returnvalue::FAILED;
}
*buffer = iter->second.replyBuf.data();
*size = iter->second.replyLen;
return returnvalue::OK;
}
@ -188,13 +216,13 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
uint32_t timeout_ms = 1000;
uint16_t bytesRead = 0;
int32_t expectedSize = static_cast<int32_t>(querySize);
vectorBufferIter iter = cspDeviceMap.find(cspAddress);
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
sif::error << "CSP device with address " << cspAddress << " no found in"
<< " device map" << std::endl;
return returnvalue::FAILED;
}
uint8_t* replyBuffer = iter->second.data();
uint8_t* replyBuffer = iter->second.replyBuf.data();
csp_conn_t* conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0, CSP_O_NONE);
@ -239,7 +267,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
csp_close(conn);
return returnvalue::FAILED;
}
if ((reply->length + bytesRead) > iter->second.size()) {
if ((reply->length + bytesRead) > iter->second.replyBuf.size()) {
sif::error << "CspComIF::cspTransfer: Reply buffer to short" << std::endl;
csp_buffer_free(reply);
csp_close(conn);
@ -286,8 +314,12 @@ void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
uint32_t replyTime = csp_ping(cspAddress, timeout_ms, querySize, CSP_O_NONE);
sif::info << "Ping address: " << cspAddress << ", reply after " << replyTime << " ms"
<< std::endl;
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return;
}
/* Store reply time in reply buffer * */
uint8_t* replyBuffer = cspDeviceMap[cspAddress].data();
uint8_t* replyBuffer = iter->second.replyBuf.data();
memcpy(replyBuffer, &replyTime, sizeof(replyTime));
replySize = sizeof(replyTime);
iter->second.replyLen = sizeof(replyTime);
}

View File

@ -43,15 +43,16 @@ class CspComIF : public DeviceCommunicationIF, public SystemObject {
int cmdLen, uint16_t querySize);
typedef uint8_t node_t;
using vectorBuffer = std::vector<uint8_t>;
using VectorBufferMap = std::unordered_map<node_t, vectorBuffer>;
using vectorBufferIter = VectorBufferMap::iterator;
struct ReplyInfo {
ReplyInfo(size_t maxLen) : replyBuf(maxLen){};
std::vector<uint8_t> replyBuf;
size_t replyLen = 0;
};
using VectorBufferMap = std::unordered_map<node_t, ReplyInfo>;
/* In this map assigns reply buffers to a CSP device */
VectorBufferMap cspDeviceMap;
uint16_t replySize = 0;
/* This is the CSP address of the OBC. */
node_t cspOwnAddress = 1;

View File

@ -699,7 +699,7 @@ void ThermalController::copyDevices() {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_vec_t<float, 3> tempAcu =
lp_vec_t<float, 3>(objects::ACU_HANDLER, P60System::pool::ACU_TEMPERATURES);
lp_vec_t<float, 3>(objects::ACU_HANDLER, ACU::pool::ACU_TEMPERATURES);
result = tempAcu.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl;
@ -715,8 +715,7 @@ void ThermalController::copyDevices() {
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> tempPdu1 =
lp_var_t<float>(objects::PDU1_HANDLER, P60System::pool::PDU_TEMPERATURE);
lp_var_t<float> tempPdu1 = lp_var_t<float>(objects::PDU1_HANDLER, PDU::pool::PDU_TEMPERATURE);
result = tempPdu1.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl;
@ -730,8 +729,7 @@ void ThermalController::copyDevices() {
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> tempPdu2 =
lp_var_t<float>(objects::PDU2_HANDLER, P60System::pool::PDU_TEMPERATURE);
lp_var_t<float> tempPdu2 = lp_var_t<float>(objects::PDU2_HANDLER, PDU::pool::PDU_TEMPERATURE);
result = tempPdu2.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl;
@ -746,7 +744,7 @@ void ThermalController::copyDevices() {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> temp1P60dock =
lp_var_t<float>(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_1);
lp_var_t<float>(objects::P60DOCK_HANDLER, P60Dock::pool::P60DOCK_TEMPERATURE_1);
result = temp1P60dock.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl;
@ -761,7 +759,7 @@ void ThermalController::copyDevices() {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> temp2P60dock =
lp_var_t<float>(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_2);
lp_var_t<float>(objects::P60DOCK_HANDLER, P60Dock::pool::P60DOCK_TEMPERATURE_2);
result = temp2P60dock.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl;

View File

@ -42,6 +42,10 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
}
}
void ACUHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, ACU::CONFIG_TABLE_SIZE, id);
}
LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
if (sid == coreHk.getSid()) {
return &coreHk;
@ -114,7 +118,7 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
using namespace P60System;
using namespace ACU;
localDataPoolMap.emplace(pool::ACU_CURRENT_IN_CHANNELS, new PoolEntry<int16_t>(6));
localDataPoolMap.emplace(pool::ACU_VOLTAGE_IN_CHANNELS, new PoolEntry<uint16_t>(6));

View File

@ -22,8 +22,8 @@ class ACUHandler : public GomspaceDeviceHandler {
LocalDataPoolManager& poolManager) override;
protected:
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t* packet) override;
/**
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/

View File

@ -92,7 +92,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
reqType = SpecialRequestTypes::GET_P60DOCK_HK;
}
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize);
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize,
deviceCommand);
if (result != returnvalue::OK) {
return result;
}
@ -102,11 +103,13 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
reqType = SpecialRequestTypes::GET_PDU_CONFIG;
} else {
reqType = SpecialRequestTypes::DEFAULT_COM_IF;
} else if (getObjectId() == objects::ACU_HANDLER) {
reqType = SpecialRequestTypes::GET_ACU_CONFIG;
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG;
}
result =
generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG, tableCfg.cfgTableSize);
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG,
tableCfg.cfgTableSize, deviceCommand);
if (result != returnvalue::OK) {
return result;
}
@ -124,6 +127,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(GOMSPACE::PARAM_SET, 3);
this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3);
this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3);
this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_CONFIG_TABLE, 3);
this->insertInCommandMap(GOMSPACE::GNDWDT_RESET);
this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I);
this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS);
@ -149,9 +153,16 @@ ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t r
rememberCommandId = GOMSPACE::NONE;
break;
}
case (GOMSPACE::REQUEST_HK_TABLE): {
*foundId = GOMSPACE::REQUEST_HK_TABLE;
*foundLen = rememberRequestedSize + GOMSPACE::GS_HDR_LENGTH;
case (GOMSPACE::REQUEST_HK_TABLE):
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
if (remainingSize < rememberRequestedSize) {
sif::error << "GomspaceDeviceHandler::scanForReply: Table reply, received data smaller "
"than expected "
<< rememberRequestedSize << std::endl;
return returnvalue::FAILED;
}
*foundId = rememberCommandId;
*foundLen = rememberRequestedSize;
rememberCommandId = GOMSPACE::NONE;
break;
}
@ -209,6 +220,10 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
letChildHandleHkReply(id, packet);
break;
}
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
letChildHandleConfigReply(id, packet);
break;
}
default:
break;
}
@ -384,38 +399,39 @@ ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& u
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));
using namespace PDU;
localDataPoolMap.emplace(pool::PDU_CURRENTS, new PoolEntry<int16_t>(9));
localDataPoolMap.emplace(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<float>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_CONV_EN, new PoolEntry<uint8_t>(3));
localDataPoolMap.emplace(pool::PDU_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(pool::PDU_CONV_EN, new PoolEntry<uint8_t>(3));
localDataPoolMap.emplace(P60System::pool::PDU_OUT_ENABLE,
localDataPoolMap.emplace(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(pool::PDU_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::PDU_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::pool::PDU_LATCHUPS, new PoolEntry<uint16_t>(9));
localDataPoolMap.emplace(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(pool::PDU_DEVICES, new PoolEntry<uint8_t>(8));
localDataPoolMap.emplace(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}));
localDataPoolMap.emplace(pool::PDU_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CNT_CSP1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CNT_CSP2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CSP_LEFT1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::PDU_WDT_CSP_LEFT2, new PoolEntry<uint8_t>({0}));
return returnvalue::OK;
}
@ -448,7 +464,8 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
uint8_t tableId,
uint16_t tableReplySize) {
uint16_t tableReplySize,
DeviceCommandId_t id) {
uint16_t querySize = tableReplySize;
if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) {
sif::warning << "Default communication for table requests not implemented anymore" << std::endl;
@ -458,7 +475,7 @@ ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestT
cspCookie->setRequest(reqType, tableReplySize);
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
rememberRequestedSize = querySize;
rememberCommandId = GOMSPACE::REQUEST_HK_TABLE;
rememberCommandId = id;
return returnvalue::OK;
}

View File

@ -83,7 +83,8 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
* specific. Thus the child has to build this command.
*/
virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType,
uint8_t tableId, uint16_t tableSize);
uint8_t tableId, uint16_t tableSize,
DeviceCommandId_t id);
/**
* This command handles printing the HK table to the console. This is useful for debugging
@ -99,7 +100,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
* @param packet Pointer to the reply containing the hk table.
*/
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) = 0;
virtual void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) = 0;
virtual LocalPoolDataSetBase *getDataSetHandle(sid_t sid) = 0;
/**

View File

@ -121,7 +121,7 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
using namespace P60System;
using namespace P60Dock;
localDataPoolMap.emplace(pool::P60_CURRENTS, &hkCurrents);
localDataPoolMap.emplace(pool::P60_VOLTAGES, &hkVoltages);
@ -271,3 +271,7 @@ void P60DockHandler::printHkTableLatchups() {
}
void P60DockHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void P60DockHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, P60Dock::CONFIG_TABLE_SIZE, id);
}

View File

@ -36,8 +36,8 @@ class P60DockHandler : public GomspaceDeviceHandler {
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t* packet) override;
/**
* This command handles printing the HK table to the console. This is useful for debugging
* purposes

View File

@ -80,6 +80,10 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
return returnvalue::OK;
}
void PDU1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id);
}
void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet);
}

View File

@ -35,7 +35,8 @@ class PDU1Handler : public GomspaceDeviceHandler {
* @brief In MODE_NORMAL, a command will be built periodically by this function.
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t* packet) override;
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExectuion) override;

View File

@ -29,6 +29,10 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
handleDeviceTM(&coreHk, id, true);
}
void PDU2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id);
}
void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
this->channelSwitchHook = hook;
this->hookArgs = args;

View File

@ -34,7 +34,8 @@ class PDU2Handler : public GomspaceDeviceHandler {
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
void letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t* packet) override;
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;

View File

@ -101,9 +101,16 @@ enum class SetIds : uint32_t {
P60_CORE = 5,
P60_AUX = 6,
ACU_CORE = 7,
ACU_AUX = 8
ACU_AUX = 8,
PDU_1_CONFIG = 9,
PDU_2_CONFIG = 10
};
} // namespace P60System
namespace P60Dock {
namespace pool {
enum Ids : lp_id_t {
@ -146,60 +153,8 @@ enum Ids : lp_id_t {
P60DOCK_BATT_DISCHARGE_CURRENT,
P60DOCK_ANT6_DEPL,
P60DOCK_AR6_DEPL,
// IDs for both PDUs
PDU_CURRENTS,
PDU_VOLTAGES,
PDU_VCC,
PDU_VBAT,
PDU_TEMPERATURE,
PDU_CONV_EN,
PDU_OUT_ENABLE,
PDU_BOOTCAUSE,
PDU_BOOTCNT,
PDU_UPTIME,
PDU_RESETCAUSE,
PDU_BATT_MODE,
PDU_LATCHUPS,
PDU_DEVICES,
PDU_STATUSES,
PDU_WDT_CNT_GND,
PDU_WDT_CNT_I2C,
PDU_WDT_CNT_CAN,
PDU_WDT_CNT_CSP1,
PDU_WDT_CNT_CSP2,
PDU_WDT_GND_LEFT,
PDU_WDT_I2C_LEFT,
PDU_WDT_CAN_LEFT,
PDU_WDT_CSP_LEFT1,
PDU_WDT_CSP_LEFT2,
/** ACU Ids */
ACU_CURRENT_IN_CHANNELS,
ACU_VOLTAGE_IN_CHANNELS,
ACU_VCC,
ACU_VBAT,
ACU_TEMPERATURES,
ACU_MPPT_MODE,
ACU_VBOOST_IN_CHANNELS,
ACU_POWER_IN_CHANNELS,
ACU_DAC_ENABLES,
ACU_DAC_RAW_CHANNELS,
ACU_BOOTCAUSE,
ACU_BOOTCNT,
ACU_UPTIME,
ACU_RESET_CAUSE,
ACU_MPPT_TIME,
ACU_MPPT_PERIOD,
ACU_DEVICES,
ACU_DEVICES_STATUS,
ACU_WDT_CNT_GND,
ACU_WDT_GND_LEFT,
};
}
} // namespace P60System
namespace P60Dock {
static constexpr uint8_t NUM_DEVS = 8;
@ -260,33 +215,26 @@ class CoreHkSet : public StaticLocalDataSet<16> {
/** Measured output 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::P60_CURRENTS,
this);
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_CURRENTS, this);
/** Measured output 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::P60_VOLTAGES,
this);
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_VOLTAGES, this);
/** Output enable states */
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::P60_OUTPUT_ENABLE, this);
lp_var_t<uint32_t> bootCount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CNT, this);
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_BATT_MODE, this);
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_OUTPUT_ENABLE, this);
lp_var_t<uint32_t> bootCount = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_BOOT_CNT, this);
lp_var_t<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_BATT_MODE, this);
// Difference between charge and discharge current
lp_var_t<int16_t> batteryCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_CURRENT, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_CURRENT, this);
lp_var_t<uint16_t> batteryVoltage =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_VOLTAGE, this);
lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_BATTERY_VOLTAGE, this);
lp_var_t<float> temperature1 =
lp_var_t<float>(sid.objectId, P60System::pool::P60DOCK_TEMPERATURE_1, this);
lp_var_t<float> temperature2 =
lp_var_t<float>(sid.objectId, P60System::pool::P60DOCK_TEMPERATURE_2, this);
lp_var_t<float> temperature1 = lp_var_t<float>(sid.objectId, pool::P60DOCK_TEMPERATURE_1, this);
lp_var_t<float> temperature2 = lp_var_t<float>(sid.objectId, pool::P60DOCK_TEMPERATURE_2, this);
};
/**
* @brief This class defines a dataset for the hk table of the P60 Dock.
@ -304,70 +252,59 @@ class HkTableDataset : public StaticLocalDataSet<32> {
/** Number of detected latchups on each output channel */
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> latchups =
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::LATCHUPS,
this);
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::LATCHUPS, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CAUSE, this);
lp_var_t<uint32_t> uptime =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_RESETCAUSE, this);
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_BOOT_CAUSE, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_UPTIME, this);
lp_var_t<uint16_t> resetcause = lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_RESETCAUSE, this);
/** Battery heater control only possible on BP4 packs */
lp_var_t<uint8_t> heaterOn =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_HEATER_ON, this);
lp_var_t<uint8_t> heaterOn = lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_HEATER_ON, this);
lp_var_t<uint8_t> converter5VStatus =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_CONV_5V_ENABLE_STATUS, this);
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_CONV_5V_ENABLE_STATUS, this);
lp_var_t<uint16_t> dockVbatVoltageValue =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_DOCK_VBAT, this);
lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_DOCK_VBAT, this);
lp_var_t<int16_t> dockVccCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_DOCK_VCC_CURRENT, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_DOCK_VCC_CURRENT, this);
lp_var_t<int16_t> batteryTemperature1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_TEMPERATURE_1, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_TEMPERATURE_1, this);
lp_var_t<int16_t> batteryTemperature2 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_TEMPERATURE_2, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_TEMPERATURE_2, this);
lp_var_t<uint8_t> dearmStatus =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_DEARM_STATUS, this);
lp_var_t<uint8_t> dearmStatus = lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_DEARM_STATUS, this);
/** Number of reboots due to gnd, i2c, csp watchdog timeout */
lp_var_t<uint32_t> wdtCntGnd =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtCntI2c =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_I2C, this);
lp_var_t<uint32_t> wdtCntCan =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CAN, this);
lp_var_t<uint32_t> wdtCntGnd = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtCntI2c = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_I2C, this);
lp_var_t<uint32_t> wdtCntCan = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CAN, this);
lp_var_t<uint32_t> wdtCntCsp1 =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CSP_1, this);
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CSP_1, this);
lp_var_t<uint32_t> wdtCntCsp2 =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CSP_2, this);
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CSP_2, this);
lp_var_t<uint32_t> wdtGndLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_GND_LEFT, this);
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_GND_LEFT, this);
lp_var_t<uint32_t> wdtI2cLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_I2C_LEFT, this);
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_I2C_LEFT, this);
lp_var_t<uint32_t> wdtCanLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CAN_LEFT, this);
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CAN_LEFT, this);
lp_var_t<uint8_t> wdtCspLeft1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CSP_LEFT_1, this);
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_WDT_CSP_LEFT_1, this);
lp_var_t<uint8_t> wdtCspLeft2 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CSP_LEFT_2, this);
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_WDT_CSP_LEFT_2, this);
lp_var_t<int16_t> batteryChargeCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATT_CHARGE_CURRENT, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATT_CHARGE_CURRENT, this);
lp_var_t<int16_t> batteryDischargeCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATT_DISCHARGE_CURRENT, this);
lp_var_t<int8_t> ant6Depl =
lp_var_t<int8_t>(sid.objectId, P60System::pool::P60DOCK_ANT6_DEPL, this);
lp_var_t<int8_t> ar6Depl =
lp_var_t<int8_t>(sid.objectId, P60System::pool::P60DOCK_AR6_DEPL, this);
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATT_DISCHARGE_CURRENT, this);
lp_var_t<int8_t> ant6Depl = lp_var_t<int8_t>(sid.objectId, pool::P60DOCK_ANT6_DEPL, this);
lp_var_t<int8_t> ar6Depl = lp_var_t<int8_t>(sid.objectId, pool::P60DOCK_AR6_DEPL, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesType =
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, P60System::pool::DEVICES_TYPE, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, pool::DEVICES_TYPE, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesStatus =
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, P60System::pool::DEVICES_STATUS, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, pool::DEVICES_STATUS, this);
};
} // namespace P60Dock
@ -376,6 +313,66 @@ class HkTableDataset : public StaticLocalDataSet<32> {
*/
namespace PDU {
namespace pool {
enum Ids {
// IDs for both PDUs
PDU_CURRENTS,
PDU_VOLTAGES,
PDU_VCC,
PDU_VBAT,
PDU_TEMPERATURE,
PDU_CONV_EN,
PDU_OUT_ENABLE,
PDU_BOOTCAUSE,
PDU_BOOTCNT,
PDU_UPTIME,
PDU_RESETCAUSE,
PDU_BATT_MODE,
PDU_LATCHUPS,
PDU_DEVICES,
PDU_STATUSES,
PDU_WDT_CNT_GND,
PDU_WDT_CNT_I2C,
PDU_WDT_CNT_CAN,
PDU_WDT_CNT_CSP1,
PDU_WDT_CNT_CSP2,
PDU_WDT_GND_LEFT,
PDU_WDT_I2C_LEFT,
PDU_WDT_CAN_LEFT,
PDU_WDT_CSP_LEFT1,
PDU_WDT_CSP_LEFT2,
OUT_ON_CNT,
OUT_OFF_CNT,
INIT_OUT_NORM,
INIT_OUT_SAFE,
INIT_ON_DLY,
INIT_OFF_DLY,
SAFE_OFF_DLY,
CUR_LU_LIM,
CUR_LIM,
CUR_EMA,
OUT_LINK,
OUT_CONV,
OUT_VOLTAGE,
CONV_EN,
CUR_EMA_GAIN,
BATT_HWMAX,
BATT_MAX,
BATT_NORM,
BATT_SAFE,
BATT_CRIT,
WDT_I2C_RST,
WDT_CAN_RST,
WDT_I2C,
WDT_CAN,
WDT_CSP,
WDT_CSP_PING,
WDT_CSP_CHAN,
WDT_CSP_ADDR
};
}
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316;
static const uint16_t MAX_HKTABLE_ADDRESS = 141;
/** The size of the csp reply containing the housekeeping table data */
@ -395,22 +392,53 @@ class PduCoreHk : public StaticLocalDataSet<9> {
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);
lp_vec_t<int16_t, 9> currents = lp_vec_t<int16_t, 9>(sid.objectId, 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);
lp_vec_t<int16_t, 9> voltages = lp_vec_t<int16_t, 9>(sid.objectId, 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_OUT_ENABLE, this);
lp_vec_t<uint8_t, 9>(sid.objectId, pool::PDU_OUT_ENABLE, this);
/** Number of reboots */
lp_var_t<uint32_t> bootcount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCNT, this);
lp_var_t<uint32_t> bootcount = lp_var_t<uint32_t>(sid.objectId, 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<float> temperature =
lp_var_t<float>(sid.objectId, P60System::pool::PDU_TEMPERATURE, this);
lp_var_t<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId, pool::PDU_BATT_MODE, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, pool::PDU_TEMPERATURE, this);
};
class PduConfig : public StaticLocalDataSet<32> {
public:
PduConfig(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
lp_vec_t<uint16_t, 9> outOnDelaySecs =
lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_ON_CNT, this);
lp_vec_t<uint16_t, 9> outOffDelaySecs =
lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_OFF_CNT, this);
lp_vec_t<uint8_t, 9> initOutNorm = lp_vec_t<uint8_t, 9>(sid.objectId, pool::INIT_OUT_NORM, this);
lp_vec_t<uint8_t, 9> initOutSafe = lp_vec_t<uint8_t, 9>(sid.objectId, pool::INIT_OUT_SAFE, this);
lp_vec_t<uint16_t, 9> initOnDly = lp_vec_t<uint16_t, 9>(sid.objectId, pool::INIT_ON_DLY, this);
lp_vec_t<uint16_t, 9> initOffDly = lp_vec_t<uint16_t, 9>(sid.objectId, pool::INIT_OFF_DLY, this);
lp_vec_t<uint8_t, 9> safeOffDly = lp_vec_t<uint8_t, 9>(sid.objectId, pool::SAFE_OFF_DLY, this);
lp_vec_t<uint16_t, 9> curLuLim = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_LU_LIM, this);
lp_vec_t<uint16_t, 9> curLim = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_LIM, this);
lp_vec_t<uint16_t, 9> curEma = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_EMA, this);
lp_vec_t<uint8_t, 9> outLink = lp_vec_t<uint8_t, 9>(sid.objectId, pool::OUT_LINK, this);
lp_vec_t<uint8_t, 9> outConv = lp_vec_t<uint8_t, 9>(sid.objectId, pool::OUT_CONV, this);
lp_vec_t<uint16_t, 9> outVoltage = lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_VOLTAGE, this);
lp_vec_t<uint8_t, 9> convEnable = lp_vec_t<uint8_t, 9>(sid.objectId, pool::CONV_EN, this);
lp_var_t<float> curEmaGain = lp_var_t<float>(sid.objectId, pool::CUR_EMA_GAIN, this);
lp_var_t<uint16_t> battHwMax = lp_var_t<uint16_t>(sid.objectId, pool::BATT_HWMAX, this);
lp_var_t<uint16_t> battMax = lp_var_t<uint16_t>(sid.objectId, pool::BATT_MAX, this);
lp_var_t<uint16_t> battNorm = lp_var_t<uint16_t>(sid.objectId, pool::BATT_NORM, this);
lp_var_t<uint16_t> battSafe = lp_var_t<uint16_t>(sid.objectId, pool::BATT_SAFE, this);
lp_var_t<uint16_t> battCrit = lp_var_t<uint16_t>(sid.objectId, pool::BATT_CRIT, this);
lp_var_t<uint16_t> wdtI2cRst = lp_var_t<uint16_t>(sid.objectId, pool::WDT_I2C_RST, this);
lp_var_t<uint16_t> wdtCanRst = lp_var_t<uint16_t>(sid.objectId, pool::WDT_CAN_RST, this);
lp_var_t<uint32_t> wdtI2c = lp_var_t<uint32_t>(sid.objectId, pool::WDT_I2C, this);
lp_var_t<uint32_t> wdtCan = lp_var_t<uint32_t>(sid.objectId, pool::WDT_CAN, this);
lp_vec_t<uint32_t, 2> wdtCsp = lp_vec_t<uint32_t, 2>(sid.objectId, pool::WDT_CSP, this);
lp_vec_t<uint8_t, 2> wdtCspPing = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_PING, this);
lp_vec_t<uint8_t, 2> wdtCspChannel = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_CHAN, this);
lp_vec_t<uint8_t, 2> wdtCspAddr = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_ADDR, this);
};
/**
@ -423,64 +451,56 @@ class PduAuxHk : public StaticLocalDataSet<36> {
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);
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, pool::PDU_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_VBAT, this);
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, pool::PDU_VBAT, this);
/** Output converter enable status */
lp_vec_t<uint8_t, 3> converterEnable =
lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::PDU_CONV_EN, this);
lp_vec_t<uint8_t, 3>(sid.objectId, pool::PDU_CONV_EN, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCAUSE, this);
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::PDU_UPTIME, this);
lp_var_t<uint16_t> resetcause = lp_var_t<uint16_t>(sid.objectId, 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);
lp_vec_t<uint16_t, 9> latchups = lp_vec_t<uint16_t, 9>(sid.objectId, 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);
lp_vec_t<uint8_t, 8> deviceTypes = lp_vec_t<uint8_t, 8>(sid.objectId, 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);
lp_vec_t<uint8_t, 8> devicesStatus = lp_vec_t<uint8_t, 8>(sid.objectId, 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);
lp_var_t<uint32_t> gndWdtReboots = lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t> i2cWdtReboots = lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t> canWdtReboots = lp_var_t<uint32_t>(sid.objectId, 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>(sid.objectId, 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);
lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t>(sid.objectId, 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);
lp_var_t<uint32_t>(sid.objectId, 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>(sid.objectId, 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);
lp_var_t<uint8_t>(sid.objectId, pool::PDU_WDT_CSP_LEFT2, this);
};
} // namespace PDU
@ -531,6 +551,12 @@ class Pdu1AuxHk : public ::PDU::PduAuxHk {
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1_AUX)) {}
};
class Pdu1Config : public ::PDU::PduConfig {
public:
Pdu1Config(HasLocalDataPoolIF* owner)
: PduConfig(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1_CONFIG)) {}
};
} // namespace PDU1
namespace PDU2 {
@ -580,10 +606,42 @@ class Pdu2AuxHk : public ::PDU::PduAuxHk {
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2_AUX)) {}
};
class Pdu2Config : public ::PDU::PduConfig {
public:
Pdu2Config(HasLocalDataPoolIF* owner)
: PduConfig(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2_CONFIG)) {}
};
} // namespace PDU2
namespace ACU {
namespace pool {
enum Ids : lp_id_t {
/** ACU Ids */
ACU_CURRENT_IN_CHANNELS,
ACU_VOLTAGE_IN_CHANNELS,
ACU_VCC,
ACU_VBAT,
ACU_TEMPERATURES,
ACU_MPPT_MODE,
ACU_VBOOST_IN_CHANNELS,
ACU_POWER_IN_CHANNELS,
ACU_DAC_ENABLES,
ACU_DAC_RAW_CHANNELS,
ACU_BOOTCAUSE,
ACU_BOOTCNT,
ACU_UPTIME,
ACU_RESET_CAUSE,
ACU_MPPT_TIME,
ACU_MPPT_PERIOD,
ACU_DEVICES,
ACU_DEVICES_STATUS,
ACU_WDT_CNT_GND,
ACU_WDT_GND_LEFT
};
}
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26;
static const uint16_t MAX_HKTABLE_ADDRESS = 120;
static const uint8_t HK_TABLE_ENTRIES = 64;
@ -599,31 +657,27 @@ class CoreHk : public StaticLocalDataSet<14> {
CoreHk(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_CORE))) {}
lp_var_t<uint8_t> mpptMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_MPPT_MODE, this);
lp_var_t<uint8_t> mpptMode = lp_var_t<uint8_t>(sid.objectId, pool::ACU_MPPT_MODE, this);
lp_vec_t<int16_t, 6> currentInChannels =
lp_vec_t<int16_t, 6>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNELS, this);
lp_vec_t<int16_t, 6>(sid.objectId, pool::ACU_CURRENT_IN_CHANNELS, this);
lp_vec_t<uint16_t, 6> voltageInChannels =
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNELS, this);
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_VOLTAGE_IN_CHANNELS, this);
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VCC, this);
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBAT, this);
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, pool::ACU_VCC, this);
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, pool::ACU_VBAT, this);
lp_vec_t<uint16_t, 6> vboostInChannels =
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_VBOOST_IN_CHANNELS, this);
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_VBOOST_IN_CHANNELS, this);
lp_vec_t<uint16_t, 6> powerInChannels =
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_POWER_IN_CHANNELS, this);
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_POWER_IN_CHANNELS, this);
lp_vec_t<float, 3> temperatures =
lp_vec_t<float, 3>(sid.objectId, P60System::pool::ACU_TEMPERATURES, this);
lp_vec_t<float, 3> temperatures = lp_vec_t<float, 3>(sid.objectId, pool::ACU_TEMPERATURES, this);
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCNT, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_UPTIME, this);
lp_var_t<uint16_t> mpptTime =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_TIME, this);
lp_var_t<uint16_t> mpptPeriod =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_PERIOD, this);
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId, pool::ACU_BOOTCNT, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::ACU_UPTIME, this);
lp_var_t<uint16_t> mpptTime = lp_var_t<uint16_t>(sid.objectId, pool::ACU_MPPT_TIME, this);
lp_var_t<uint16_t> mpptPeriod = lp_var_t<uint16_t>(sid.objectId, pool::ACU_MPPT_PERIOD, this);
};
/**
* @brief This class defines a dataset for the hk table of the ACU.
@ -636,31 +690,25 @@ class AuxHk : public StaticLocalDataSet<12> {
AuxHk(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_AUX))) {}
lp_vec_t<uint8_t, 3> dacEnables =
lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::ACU_DAC_ENABLES, this);
lp_vec_t<uint8_t, 3> dacEnables = lp_vec_t<uint8_t, 3>(sid.objectId, pool::ACU_DAC_ENABLES, this);
lp_vec_t<uint16_t, 6> dacRawChannelVals =
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_DAC_RAW_CHANNELS, this);
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_DAC_RAW_CHANNELS, this);
lp_var_t<uint32_t> bootCause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCAUSE, this);
lp_var_t<uint16_t> resetCause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_RESET_CAUSE, this);
lp_var_t<uint32_t> bootCause = lp_var_t<uint32_t>(sid.objectId, pool::ACU_BOOTCAUSE, this);
lp_var_t<uint16_t> resetCause = lp_var_t<uint16_t>(sid.objectId, pool::ACU_RESET_CAUSE, this);
lp_var_t<uint32_t> wdtCntGnd =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtGndLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_GND_LEFT, this);
lp_var_t<uint32_t> wdtCntGnd = lp_var_t<uint32_t>(sid.objectId, pool::ACU_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtGndLeft = lp_var_t<uint32_t>(sid.objectId, pool::ACU_WDT_GND_LEFT, 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::ACU_DEVICES, this);
lp_vec_t<uint8_t, 8> deviceTypes = lp_vec_t<uint8_t, 8>(sid.objectId, pool::ACU_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::ACU_DEVICES_STATUS, this);
lp_vec_t<uint8_t, 8>(sid.objectId, pool::ACU_DEVICES_STATUS, this);
};
} // namespace ACU

2
tmtc

@ -1 +1 @@
Subproject commit 079a0f94727dc3f35578dc412aa01c871ae1ac6a
Subproject commit efc8e3b4b2078d070a39efe5338ea89ba56cd248