diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 05de55fd..b9c27840 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -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 diff --git a/bsp_q7s/boardtest/Q7STestTask.h b/bsp_q7s/boardtest/Q7STestTask.h index 739eeb17..97e68c66 100644 --- a/bsp_q7s/boardtest/Q7STestTask.h +++ b/bsp_q7s/boardtest/Q7STestTask.h @@ -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; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 34586450..202b890d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -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" diff --git a/linux/csp/CMakeLists.txt b/linux/csp/CMakeLists.txt index 71906a69..b58849aa 100644 --- a/linux/csp/CMakeLists.txt +++ b/linux/csp/CMakeLists.txt @@ -1 +1 @@ -target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp) +target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index ee515b9a..93945c0a 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -5,8 +5,12 @@ #include #include #include +#include +#include -#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 diff --git a/mission/CMakeLists.txt b/mission/CMakeLists.txt index 9c3dad78..73b19b69 100644 --- a/mission/CMakeLists.txt +++ b/mission/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory(utility) add_subdirectory(memory) add_subdirectory(tmtc) add_subdirectory(system) +add_subdirectory(csp) diff --git a/mission/csp/CMakeLists.txt b/mission/csp/CMakeLists.txt new file mode 100644 index 00000000..d5b6f3fe --- /dev/null +++ b/mission/csp/CMakeLists.txt @@ -0,0 +1 @@ +target_sources(${LIB_EIVE_MISSION} PRIVATE CspCookie.cpp) diff --git a/linux/csp/CspCookie.cpp b/mission/csp/CspCookie.cpp similarity index 77% rename from linux/csp/CspCookie.cpp rename to mission/csp/CspCookie.cpp index 75d5ba73..a2265f9e 100644 --- a/linux/csp/CspCookie.cpp +++ b/mission/csp/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_; } diff --git a/linux/csp/CspCookie.h b/mission/csp/CspCookie.h similarity index 71% rename from linux/csp/CspCookie.h rename to mission/csp/CspCookie.h index b0f71d2e..71b50e61 100644 --- a/linux/csp/CspCookie.h +++ b/mission/csp/CspCookie.h @@ -2,7 +2,7 @@ #define LINUX_CSP_CSPCOOKIE_H_ #include - +#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" #include #include @@ -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_ */ diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index 35f8e2dd..3c2572df 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -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(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(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(packet + 0x1a); + coreHk.vbat = as(packet + 0x18); for (size_t idx = 0; idx < 3; idx++) { - coreHk.temperatures[idx] = - static_cast((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1; - dataOffset += 4; + coreHk.temperatures[idx] = as(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(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(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(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(packet + 0x50); + coreHk.bootcnt = as(packet + 0x54); + coreHk.uptime = as(packet + 0x58); + auxHk.resetCause = as(packet + 0x5c); + coreHk.mpptTime = as(packet + 0x5e); + coreHk.mpptPeriod = as(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(packet + 0x74); + auxHk.wdtGndLeft = as(packet + 0x78); coreHk.setValidity(true, true); auxHk.setValidity(true, true); return RETURN_OK; diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index c8659f7a..b5705faf 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -3,8 +3,6 @@ #include #include #include -#include -#include #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(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); diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index fbacaf07..9d90f484 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ #define MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ +#include #include #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 diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index f059a1d7..b08b57fa 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -3,12 +3,13 @@ #include #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(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(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(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; - dataOffset += 4; - coreHk.temperature2 = - static_cast(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; - dataOffset += 4; + coreHk.temperature1 = as(packet + 0x44) * 0.1; + coreHk.temperature2 = as(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(packet + 0x48); + coreHk.bootCount = as(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(packet + 0x50); + auxHk.resetcause = as(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(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(packet + 0x74); + auxHk.dockVccCurrent = as(packet + 0x76); + coreHk.batteryCurrent = as(packet + 0x78); + coreHk.batteryVoltage = as(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(packet + 0x7c); + auxHk.batteryTemperature2 = as(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(packet + 0x94); + auxHk.wdtCntI2c = as(packet + 0x98); + auxHk.wdtCntCan = as(packet + 0x9c); + auxHk.wdtCntCsp1 = as(packet + 0xa0); + auxHk.wdtCntCsp2 = as(packet + 0xa0 + 4); + auxHk.wdtGndLeft = as(packet + 0xa8); + auxHk.wdtI2cLeft = as(packet + 0xac); + auxHk.wdtCanLeft = as(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(packet + 0xb6); + auxHk.batteryDischargeCurrent = as(packet + 0xb8); + auxHk.ant6Depl = *(packet + 0xba); + auxHk.ar6Depl = *(packet + 0xbb); if (firstHk) { firstHk = false; } diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index ae1a2e83..c4b0e39a 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -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, diff --git a/thirdparty/gomspace-sw b/thirdparty/gomspace-sw index 0b66e23a..d24a574f 160000 --- a/thirdparty/gomspace-sw +++ b/thirdparty/gomspace-sw @@ -1 +1 @@ -Subproject commit 0b66e23a8900e315f01cfc52088adad10bdabf26 +Subproject commit d24a574ffd32bd4da8aa69e768180ccae76d6c85 diff --git a/tmtc b/tmtc index d61af604..079a0f94 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d61af604fec53b6a0af8d54e7c01792fc9a68790 +Subproject commit 079a0f94727dc3f35578dc412aa01c871ae1ac6a