rename syrlinks handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-01-24 19:11:17 +01:00
parent b74db7b087
commit 1f08d85319
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 43 additions and 44 deletions

View File

@ -88,7 +88,7 @@
#include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h"
#include "mission/devices/SolarArrayDeploymentHandler.h"
#include "mission/devices/SyrlinksHkHandler.h"
#include <mission/devices/SyrlinksHandler.h>
#include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
@ -586,7 +586,7 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
auto syrlinksHandler =
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
new SyrlinksHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
#if OBSW_DEBUG_SYRLINKS == 1

View File

@ -8,7 +8,7 @@ target_sources(
PDU1Handler.cpp
PDU2Handler.cpp
ACUHandler.cpp
SyrlinksHkHandler.cpp
SyrlinksHandler.cpp
Max31865PT1000Handler.cpp
Max31865EiveHandler.cpp
ImtqHandler.cpp

View File

@ -1,10 +1,9 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/globalfunctions/CRC.h>
#include <mission/devices/SyrlinksHkHandler.h>
#include <mission/devices/SyrlinksHandler.h>
#include "OBSWConfig.h"
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir)
: DeviceHandlerBase(objectId, comIF, comCookie, customFdir),
rxDataset(this),
@ -16,9 +15,9 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
}
}
SyrlinksHkHandler::~SyrlinksHkHandler() {}
SyrlinksHandler::~SyrlinksHandler() {}
void SyrlinksHkHandler::doStartUp() {
void SyrlinksHandler::doStartUp() {
switch (startupState) {
case StartupState::OFF: {
startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION;
@ -33,12 +32,12 @@ void SyrlinksHkHandler::doStartUp() {
}
}
void SyrlinksHkHandler::doShutDown() {
void SyrlinksHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
temperatureSet.setValidity(false, true);
}
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
ReturnValue_t SyrlinksHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
switch (nextCommand) {
case (syrlinks::READ_RX_STATUS_REGISTERS):
*id = syrlinks::READ_RX_STATUS_REGISTERS;
@ -84,7 +83,7 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
return buildCommandFromCommand(*id, nullptr, 0);
}
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
ReturnValue_t SyrlinksHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
switch (startupState) {
case StartupState::ENABLE_TEMPERATURE_PROTECTION: {
*id = syrlinks::WRITE_LCL_CONFIG;
@ -96,7 +95,7 @@ ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t*
return NOTHING_TO_SEND;
}
ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
ReturnValue_t SyrlinksHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t* commandData,
size_t commandDataLen) {
switch (deviceCommand) {
@ -184,7 +183,7 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
return returnvalue::FAILED;
}
void SyrlinksHkHandler::fillCommandAndReplyMap() {
void SyrlinksHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(syrlinks::RESET_UNIT, 1, nullptr, syrlinks::ACK_SIZE, false,
true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_TX_MODE_STANDBY, 1, nullptr, syrlinks::ACK_SIZE,
@ -223,7 +222,7 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE);
}
ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remainingSize,
ReturnValue_t SyrlinksHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK;
@ -254,7 +253,7 @@ ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remai
return result;
}
ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
ReturnValue_t SyrlinksHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
if (powerSwitch == power::NO_SWITCH) {
return DeviceHandlerBase::NO_SWITCH;
}
@ -263,7 +262,7 @@ ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t*
return returnvalue::OK;
}
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t SyrlinksHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t result;
switch (id) {
@ -414,7 +413,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
return returnvalue::OK;
}
LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) {
LocalPoolDataSetBase* SyrlinksHandler::getDataSetHandle(sid_t sid) {
if (sid == rxDataset.getSid()) {
return &rxDataset;
} else if (sid == txDataset.getSid()) {
@ -427,13 +426,13 @@ LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) {
}
}
std::string SyrlinksHkHandler::convertUint16ToHexString(uint16_t intValue) {
std::string SyrlinksHandler::convertUint16ToHexString(uint16_t intValue) {
std::stringstream stream;
stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue;
return stream.str();
}
uint8_t SyrlinksHkHandler::convertHexStringToUint8(const char* twoChars) {
uint8_t SyrlinksHandler::convertHexStringToUint8(const char* twoChars) {
uint32_t value;
std::string hexString(twoChars, 2);
std::stringstream stream;
@ -442,13 +441,13 @@ uint8_t SyrlinksHkHandler::convertHexStringToUint8(const char* twoChars) {
return static_cast<uint8_t>(value);
}
uint16_t SyrlinksHkHandler::convertHexStringToUint16(const char* fourChars) {
uint16_t SyrlinksHandler::convertHexStringToUint16(const char* fourChars) {
uint16_t value = 0;
value = convertHexStringToUint8(fourChars) << 8 | convertHexStringToUint8(fourChars + 2);
return value;
}
ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
ReturnValue_t SyrlinksHandler::parseReplyStatus(const char* status) {
switch (*status) {
case '0':
return returnvalue::OK;
@ -480,7 +479,7 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
}
}
ReturnValue_t SyrlinksHkHandler::verifyReply(const uint8_t* packet, uint8_t size) {
ReturnValue_t SyrlinksHandler::verifyReply(const uint8_t* packet, uint8_t size) {
int result = 0;
/* Calculate crc from received packet */
uint16_t crc =
@ -500,7 +499,7 @@ ReturnValue_t SyrlinksHkHandler::verifyReply(const uint8_t* packet, uint8_t size
return returnvalue::OK;
}
void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
void SyrlinksHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
PoolReadGuard readHelper(&rxDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -540,7 +539,7 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
}
}
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
void SyrlinksHandler::parseLclConfigReply(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
if (debugMode) {
@ -549,7 +548,7 @@ void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
}
}
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
void SyrlinksHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -560,7 +559,7 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
}
}
void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
void SyrlinksHandler::parseTxWaveformReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
@ -571,7 +570,7 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
}
}
void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
void SyrlinksHandler::parseAgcLowByte(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txAgcValue = agcValueHighByte << 8 |
@ -582,17 +581,17 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
}
}
void SyrlinksHkHandler::parseAgcHighByte(const uint8_t* packet) {
void SyrlinksHandler::parseAgcHighByte(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
agcValueHighByte = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
}
void SyrlinksHkHandler::setNormalDatapoolEntriesInvalid() {}
void SyrlinksHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
ReturnValue_t SyrlinksHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_SENSITIVITY, new PoolEntry<uint32_t>({0}));
@ -618,11 +617,11 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
return returnvalue::OK;
}
void SyrlinksHkHandler::setModeNormal() { setMode(MODE_NORMAL); }
void SyrlinksHandler::setModeNormal() { setMode(MODE_NORMAL); }
float SyrlinksHkHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67.87; }
float SyrlinksHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67.87; }
ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
ReturnValue_t result =
parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE));
if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result != returnvalue::OK) {
@ -633,11 +632,11 @@ ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
return result;
}
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
void SyrlinksHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
command.copy(reinterpret_cast<char*>(commandBuffer), command.size(), 0);
rawPacketLen = command.size();
rememberCommandId = commandId;
rawPacket = commandBuffer;
}
void SyrlinksHkHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void SyrlinksHandler::setDebugMode(bool enable) { this->debugMode = enable; }

View File

@ -1,5 +1,5 @@
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
#ifndef MISSION_DEVICES_SYRLINKSHANDLER_H_
#define MISSION_DEVICES_SYRLINKSHANDLER_H_
#include <string.h>
@ -18,11 +18,11 @@
*
* @author J. Meier
*/
class SyrlinksHkHandler : public DeviceHandlerBase {
class SyrlinksHandler : public DeviceHandlerBase {
public:
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir);
virtual ~SyrlinksHkHandler();
virtual ~SyrlinksHandler();
/**
* @brief Sets mode to MODE_NORMAL. Can be used for debugging.
@ -216,7 +216,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
};
template <typename T>
T SyrlinksHkHandler::convertHexStringTo32bit(const char* characters, uint8_t numberOfChars) {
T SyrlinksHandler::convertHexStringTo32bit(const char* characters, uint8_t numberOfChars) {
if (sizeof(T) < 4) {
sif::error << "SyrlinksHkHandler::convertHexStringToRaw: Only works for 32-bit conversion"
<< std::endl;
@ -244,4 +244,4 @@ T SyrlinksHkHandler::convertHexStringTo32bit(const char* characters, uint8_t num
return 0;
}
}
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */
#endif /* MISSION_DEVICES_SYRLINKSHANDLER_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 49f27c9923cfa13a3bafce46c37dd2631550f4af
Subproject commit 49ccb4be8d42d6916be00ff9d8462a1f65481a6c