Update Power Modules #287
@ -58,8 +58,8 @@
|
||||
|
||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||
#define OBSW_SYRLINKS_SIMULATED 1
|
||||
#define OBSW_ADD_TEST_CODE 1
|
||||
#define OBSW_ADD_TEST_TASK 1
|
||||
#define OBSW_ADD_TEST_CODE 0
|
||||
#define OBSW_ADD_TEST_TASK 0
|
||||
#define OBSW_ADD_TEST_PST 0
|
||||
// If this is enabled, all other SPI code should be disabled
|
||||
#define OBSW_ADD_SPI_TEST_CODE 0
|
||||
|
@ -16,7 +16,7 @@ class Q7STestTask : public TestTask {
|
||||
private:
|
||||
bool doTestSdCard = false;
|
||||
bool doTestScratchApi = false;
|
||||
static constexpr bool DO_TEST_GOMSPACE_API = true;
|
||||
static constexpr bool DO_TEST_GOMSPACE_API = false;
|
||||
bool doTestGpsShm = false;
|
||||
bool doTestGpsSocket = false;
|
||||
bool doTestProtHandler = false;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
#include "linux/callbacks/gpioCallbacks.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "mission/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
|
@ -1 +1 @@
|
||||
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp)
|
||||
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp)
|
||||
|
@ -5,8 +5,12 @@
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||
#include <p60pdu.h>
|
||||
#include <p60acu.h>
|
||||
#include <p60dock.h>
|
||||
|
||||
#include "CspCookie.h"
|
||||
#include "mission/csp/CspCookie.h"
|
||||
|
||||
using namespace GOMSPACE;
|
||||
|
||||
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
|
||||
|
||||
@ -82,7 +86,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
||||
|
||||
uint8_t cspPort;
|
||||
uint16_t querySize = 0;
|
||||
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||
/* Extract csp port and bytes to query from command buffer */
|
||||
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -94,21 +98,32 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
||||
}
|
||||
uint8_t cspAddress = cspCookie->getCspAddress();
|
||||
switch (cspPort) {
|
||||
case (GOMSPACE::CspPorts::CSP_PING): {
|
||||
case (CspPorts::CSP_PING): {
|
||||
initiatePingRequest(cspAddress, querySize);
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::CspPorts::CSP_REBOOT): {
|
||||
case (CspPorts::CSP_REBOOT): {
|
||||
csp_reboot(cspAddress);
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
|
||||
case (GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM): {
|
||||
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::GET_PDU_HK) {
|
||||
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
|
||||
case (CspPorts::P60_PORT_RPARAM_ENUM): {
|
||||
if(cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||
param_index_t requestStruct{};
|
||||
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
|
||||
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
|
||||
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
|
||||
if(!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
|
||||
if(!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No CSP fixed port was selected. Send data to the specified port and
|
||||
|
@ -5,3 +5,4 @@ add_subdirectory(utility)
|
||||
add_subdirectory(memory)
|
||||
add_subdirectory(tmtc)
|
||||
add_subdirectory(system)
|
||||
add_subdirectory(csp)
|
||||
|
1
mission/csp/CMakeLists.txt
Normal file
1
mission/csp/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
target_sources(${LIB_EIVE_MISSION} PRIVATE CspCookie.cpp)
|
@ -2,7 +2,7 @@
|
||||
|
||||
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
|
||||
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs),
|
||||
reqType(DEFAULT_COM_IF) {}
|
||||
reqType(GOMSPACE::DEFAULT_COM_IF) {}
|
||||
|
||||
CspCookie::~CspCookie() {}
|
||||
|
||||
@ -12,11 +12,11 @@ uint8_t CspCookie::getCspAddress() {
|
||||
return cspAddress;
|
||||
}
|
||||
|
||||
CspCookie::SpecialRequestTypes CspCookie::getRequest() const {
|
||||
GOMSPACE::SpecialRequestTypes CspCookie::getRequest() const {
|
||||
return reqType;
|
||||
}
|
||||
|
||||
void CspCookie::setRequest(SpecialRequestTypes request, size_t replyLen_) {
|
||||
void CspCookie::setRequest(GOMSPACE::SpecialRequestTypes request, size_t replyLen_) {
|
||||
reqType = request;
|
||||
replyLen = replyLen_;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#define LINUX_CSP_CSPCOOKIE_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
|
||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
@ -13,15 +13,6 @@
|
||||
*/
|
||||
class CspCookie : public CookieIF {
|
||||
public:
|
||||
enum SpecialRequestTypes {
|
||||
DEFAULT_COM_IF,
|
||||
GET_PDU_HK,
|
||||
GET_PDU_CONFIG,
|
||||
GET_ACU_HK,
|
||||
GET_ACU_CONFIG,
|
||||
GET_P60DOCK_HK,
|
||||
GET_P60DOCK_CONFIG
|
||||
};
|
||||
|
||||
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs);
|
||||
virtual ~CspCookie();
|
||||
@ -29,8 +20,8 @@ class CspCookie : public CookieIF {
|
||||
void setCspPort(uint8_t port);
|
||||
uint8_t getCspPort() const;
|
||||
uint16_t getMaxReplyLength();
|
||||
SpecialRequestTypes getRequest() const;
|
||||
void setRequest(SpecialRequestTypes request, size_t replyLen);
|
||||
GOMSPACE::SpecialRequestTypes getRequest() const;
|
||||
void setRequest(GOMSPACE::SpecialRequestTypes request, size_t replyLen);
|
||||
size_t getReplyLen() const;
|
||||
uint8_t getCspAddress();
|
||||
uint32_t getTimeout() const;
|
||||
@ -41,7 +32,7 @@ class CspCookie : public CookieIF {
|
||||
uint8_t cspAddress;
|
||||
size_t replyLen = 0;
|
||||
uint32_t timeoutMs;
|
||||
SpecialRequestTypes reqType;
|
||||
GOMSPACE::SpecialRequestTypes reqType;
|
||||
};
|
||||
|
||||
#endif /* LINUX_CSP_CSPCOOKIE_H_ */
|
@ -1,11 +1,12 @@
|
||||
#include "ACUHandler.h"
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include "p60acu_hk.h"
|
||||
|
||||
ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
||||
FailureIsolationBase *customFdir)
|
||||
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
|
||||
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
|
||||
ACU::MAX_HKTABLE_ADDRESS, P60ACU_HK_SIZE),
|
||||
coreHk(this),
|
||||
auxHk(this) {}
|
||||
|
||||
@ -13,7 +14,7 @@ ACUHandler::~ACUHandler() {}
|
||||
|
||||
ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
*id = GOMSPACE::REQUEST_HK_TABLE;
|
||||
return buildCommandFromCommand(*id, NULL, 0);
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
|
||||
void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
|
||||
@ -48,7 +49,6 @@ LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
|
||||
}
|
||||
|
||||
ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
uint16_t dataOffset = 0;
|
||||
PoolReadGuard pg0(&coreHk);
|
||||
PoolReadGuard pg1(&auxHk);
|
||||
auto res0 = pg0.getReadResult();
|
||||
@ -59,80 +59,51 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
if (res1 != RETURN_OK) {
|
||||
return res1;
|
||||
}
|
||||
dataOffset += 12;
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.currentInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.currentInChannels[idx] = as<int16_t>(packet + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.voltageInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.voltageInChannels[idx] = as<uint16_t>(packet + 0xc + (idx*2));
|
||||
}
|
||||
|
||||
coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.vcc = as<uint16_t>(packet + 0x1a);
|
||||
coreHk.vbat = as<uint16_t>(packet + 0x18);
|
||||
|
||||
for (size_t idx = 0; idx < 3; idx++) {
|
||||
coreHk.temperatures[idx] =
|
||||
static_cast<int16_t>((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1;
|
||||
dataOffset += 4;
|
||||
coreHk.temperatures[idx] = as<int16_t>(packet + 0x1c + (idx*2)) * 0.1;
|
||||
}
|
||||
|
||||
coreHk.mpptMode = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
coreHk.mpptMode = packet[0x22];
|
||||
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.vboostInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.vboostInChannels[idx] = as<uint16_t>(packet + 0x24 + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.powerInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.powerInChannels[idx] = as<uint16_t>(packet + 0x30 + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 3; idx++) {
|
||||
auxHk.dacEnables[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.dacEnables[idx] = *(packet + 0x3c + idx);
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
auxHk.dacRawChannelVals[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
auxHk.dacRawChannelVals[idx] = as<uint16_t>(packet + 0x40 + (idx*2));
|
||||
}
|
||||
|
||||
auxHk.bootCause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
coreHk.bootcnt = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
coreHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.resetCause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.mpptTime = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
/* +12 because here starts the second csp packet */
|
||||
dataOffset += 2 + 12;
|
||||
|
||||
coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.bootCause = as<uint32_t>(packet + 0x50);
|
||||
coreHk.bootcnt = as<uint32_t>(packet + 0x54);
|
||||
coreHk.uptime = as<uint32_t>(packet + 0x58);
|
||||
auxHk.resetCause = as<uint16_t>(packet + 0x5c);
|
||||
coreHk.mpptTime = as<uint16_t>(packet + 0x5e);
|
||||
coreHk.mpptPeriod = as<uint16_t>(packet + 0x60);
|
||||
|
||||
for (size_t idx = 0; idx < 8; idx++) {
|
||||
auxHk.deviceTypes[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.deviceTypes[idx] = *(packet + 0x64 + idx);
|
||||
}
|
||||
for (size_t idx = 0; idx < 8; idx++) {
|
||||
auxHk.devicesStatus[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.devicesStatus[idx] = *(packet + 0x6c + idx);
|
||||
}
|
||||
|
||||
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntGnd = as<uint32_t>(packet + 0x74);
|
||||
auxHk.wdtGndLeft = as<uint32_t>(packet + 0x78);
|
||||
coreHk.setValidity(true, true);
|
||||
auxHk.setValidity(true, true);
|
||||
return RETURN_OK;
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include <common/config/commonObjects.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <linux/csp/CspComIF.h>
|
||||
#include <linux/csp/CspCookie.h>
|
||||
|
||||
#include "devicedefinitions/GomSpacePackets.h"
|
||||
#include "devicedefinitions/powerDefinitions.h"
|
||||
@ -82,14 +80,24 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::REQUEST_HK_TABLE): {
|
||||
result = generateRequestFullTableCmd(GOMSPACE::TableIds::HK, hkTableReplySize);
|
||||
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
|
||||
if(getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_PDU_HK;
|
||||
} else if(getObjectId() == objects::ACU_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_ACU_HK;
|
||||
} else if(getObjectId() == objects::P60DOCK_HANDLER) {
|
||||
reqType = SpecialRequestTypes::GET_P60DOCK_HK;
|
||||
}
|
||||
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, hkTableReplySize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
||||
result = generateRequestFullTableCmd(GOMSPACE::TableIds::CONFIG, configTableReplySize);
|
||||
|
||||
result = generateRequestFullTableCmd(SpecialRequestTypes::DEFAULT_COM_IF,
|
||||
GOMSPACE::TableIds::CONFIG, configTableReplySize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -429,13 +437,14 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId,
|
||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
|
||||
uint8_t tableId,
|
||||
uint16_t tableReplySize) {
|
||||
uint16_t querySize = tableReplySize;
|
||||
if(getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||
if(reqType != SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
|
||||
cspCookie->setRequest(CspCookie::SpecialRequestTypes::GET_PDU_HK, tableReplySize);
|
||||
cspCookie->setCspPort(GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM);
|
||||
cspCookie->setRequest(reqType, tableReplySize);
|
||||
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||
} else {
|
||||
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
||||
#define MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
||||
|
||||
#include <mission/csp/CspCookie.h>
|
||||
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
|
||||
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
@ -82,7 +83,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
||||
* @brief The command to generate a request to receive the full housekeeping table is device
|
||||
* specific. Thus the child has to build this command.
|
||||
*/
|
||||
virtual ReturnValue_t generateRequestFullTableCmd(uint8_t tableId, uint16_t tableSize);
|
||||
virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, uint8_t tableId, uint16_t tableSize);
|
||||
|
||||
/**
|
||||
* This command handles printing the HK table to the console. This is useful for debugging
|
||||
|
@ -3,12 +3,13 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "p60dock_hk.h"
|
||||
|
||||
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
||||
FailureIsolationBase *customFdir)
|
||||
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir,
|
||||
P60Dock::MAX_CONFIGTABLE_ADDRESS, P60Dock::MAX_HKTABLE_ADDRESS,
|
||||
P60Dock::HK_TABLE_REPLY_SIZE),
|
||||
P60DOCK_HK_SIZE),
|
||||
coreHk(this),
|
||||
auxHk(this) {}
|
||||
|
||||
@ -30,7 +31,6 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *
|
||||
|
||||
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
using namespace P60Dock;
|
||||
uint16_t dataOffset = 0;
|
||||
PoolReadGuard pg0(&coreHk);
|
||||
PoolReadGuard pg1(&auxHk);
|
||||
if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or
|
||||
@ -43,45 +43,27 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
* 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 < hk::CHNLS_LEN; idx++) {
|
||||
coreHk.currents[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.currents[idx] = as<int16_t>(packet + (idx*2));
|
||||
}
|
||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||
coreHk.voltages[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.voltages[idx] = as<uint16_t>(packet + 0x1a + (idx*2));
|
||||
}
|
||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||
coreHk.outputEnables[idx] = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
coreHk.outputEnables[idx] = *(packet + 0x34 + idx);
|
||||
}
|
||||
|
||||
coreHk.temperature1 =
|
||||
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
||||
dataOffset += 4;
|
||||
coreHk.temperature2 =
|
||||
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
||||
dataOffset += 4;
|
||||
coreHk.temperature1 = as<int16_t>(packet + 0x44) * 0.1;
|
||||
coreHk.temperature2 = as<int16_t>(packet + 0x44 + 2) * 0.1;
|
||||
|
||||
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);
|
||||
auxHk.bootcause = as<uint32_t>(packet + 0x48);
|
||||
coreHk.bootCount = as<uint32_t>(packet + 0x4c);
|
||||
if (firstHk) {
|
||||
triggerEvent(P60_BOOT_COUNT, coreHk.bootCount.value);
|
||||
}
|
||||
dataOffset += 6;
|
||||
auxHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
|
||||
dataOffset += 4;
|
||||
uint8_t newBattMode = packet[dataOffset];
|
||||
auxHk.uptime = as<uint32_t>(packet + 0x50);
|
||||
auxHk.resetcause = as<uint16_t>(packet + 0x54);
|
||||
uint8_t newBattMode = packet[0x56];
|
||||
if (firstHk) {
|
||||
triggerEvent(BATT_MODE, newBattMode);
|
||||
} else if (newBattMode != coreHk.battMode.value) {
|
||||
@ -89,83 +71,46 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
}
|
||||
coreHk.battMode = newBattMode;
|
||||
|
||||
dataOffset += 3;
|
||||
auxHk.heaterOn = *(packet + dataOffset);
|
||||
/* + 13 because here begins a new gomspace csp data field */
|
||||
dataOffset += 13;
|
||||
auxHk.converter5VStatus = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.heaterOn = *(packet + 0x57);
|
||||
auxHk.converter5VStatus = *(packet + 0x58);
|
||||
|
||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||
auxHk.latchups[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.latchups[idx] = as<uint16_t>(packet + 0x5a + (idx*2));
|
||||
}
|
||||
|
||||
auxHk.dockVbatVoltageValue = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.dockVccCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.batteryCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.batteryVoltage = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.dockVbatVoltageValue = as<uint16_t>(packet + 0x74);
|
||||
auxHk.dockVccCurrent = as<int16_t>(packet + 0x76);
|
||||
coreHk.batteryCurrent = as<int16_t>(packet + 0x78);
|
||||
coreHk.batteryVoltage = as<uint16_t>(packet + 0x7a);
|
||||
|
||||
auxHk.batteryTemperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.batteryTemperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.batteryTemperature1 = as<int16_t>(packet + 0x7c);
|
||||
auxHk.batteryTemperature2 = as<int16_t>(packet + 0x7c + 2);
|
||||
|
||||
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
||||
auxHk.devicesType[idx] = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.devicesType[idx] = *(packet + 0x80 + idx);
|
||||
}
|
||||
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
||||
auxHk.devicesStatus[idx] = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.devicesStatus[idx] = *(packet + 0x88 + idx);
|
||||
}
|
||||
|
||||
auxHk.dearmStatus = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.dearmStatus = *(packet + 0x90);
|
||||
|
||||
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntI2c = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntCan = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntCsp1 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntCsp2 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntGnd = as<uint32_t>(packet + 0x94);
|
||||
auxHk.wdtCntI2c = as<uint32_t>(packet + 0x98);
|
||||
auxHk.wdtCntCan = as<uint32_t>(packet + 0x9c);
|
||||
auxHk.wdtCntCsp1 = as<uint32_t>(packet + 0xa0);
|
||||
auxHk.wdtCntCsp2 = as<uint32_t>(packet + 0xa0 + 4);
|
||||
auxHk.wdtGndLeft = as<uint32_t>(packet + 0xa8);
|
||||
auxHk.wdtI2cLeft = as<uint32_t>(packet + 0xac);
|
||||
auxHk.wdtCanLeft = as<uint32_t>(packet + 0xb0);
|
||||
|
||||
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtI2cLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCanLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
/* +16 because here begins a new gomspace csp packet */
|
||||
dataOffset += 16;
|
||||
auxHk.wdtCspLeft1 = *(packet + 0xb4);
|
||||
auxHk.wdtCspLeft2 = *(packet + 0xb4 + 1);
|
||||
|
||||
auxHk.wdtCspLeft1 = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.wdtCspLeft2 = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
|
||||
auxHk.batteryChargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.batteryDischargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.ant6Depl = *(packet + dataOffset);
|
||||
dataOffset += 3;
|
||||
auxHk.ar6Depl = *(packet + dataOffset);
|
||||
auxHk.batteryChargeCurrent = as<int16_t>(packet + 0xb6);
|
||||
auxHk.batteryDischargeCurrent = as<int16_t>(packet + 0xb8);
|
||||
auxHk.ant6Depl = *(packet + 0xba);
|
||||
auxHk.ar6Depl = *(packet + 0xbb);
|
||||
if (firstHk) {
|
||||
firstHk = false;
|
||||
}
|
||||
|
@ -12,6 +12,16 @@
|
||||
|
||||
namespace GOMSPACE {
|
||||
|
||||
enum SpecialRequestTypes {
|
||||
DEFAULT_COM_IF,
|
||||
GET_PDU_HK,
|
||||
GET_PDU_CONFIG,
|
||||
GET_ACU_HK,
|
||||
GET_ACU_CONFIG,
|
||||
GET_P60DOCK_HK,
|
||||
GET_P60DOCK_CONFIG
|
||||
};
|
||||
|
||||
enum CspPorts: uint8_t {
|
||||
CSP_PING = 1,
|
||||
CSP_REBOOT = 4,
|
||||
|
2
thirdparty/gomspace-sw
vendored
2
thirdparty/gomspace-sw
vendored
@ -1 +1 @@
|
||||
Subproject commit 0b66e23a8900e315f01cfc52088adad10bdabf26
|
||||
Subproject commit d24a574ffd32bd4da8aa69e768180ccae76d6c85
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit d61af604fec53b6a0af8d54e7c01792fc9a68790
|
||||
Subproject commit 079a0f94727dc3f35578dc412aa01c871ae1ac6a
|
Loading…
Reference in New Issue
Block a user