apply auto-formatter
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-04 13:40:45 +02:00
parent 50db2fedef
commit ec880d4232
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
10 changed files with 133 additions and 140 deletions

View File

@ -662,9 +662,9 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
auto supvGpioCookie = new GpioCookie; auto supvGpioCookie = new GpioCookie;
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
gpioComIF->addGpios(supvGpioCookie); gpioComIF->addGpios(supvGpioCookie);
auto supervisorCookie = new UartCookie( auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20); uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20);
supervisorCookie->setNoFixedSizeReply(); supervisorCookie->setNoFixedSizeReply();
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),

View File

@ -1541,6 +1541,6 @@ class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
lp_var_t<uint32_t> isSet = lp_var_t<uint32_t> isSet =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this); lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this);
}; };
} // namespace PLOC_SPV } // namespace supv
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */

View File

@ -1,9 +1,9 @@
#include "PlocMPSoCHandler.h" #include "PlocMPSoCHandler.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
@ -87,8 +87,8 @@ void PlocMPSoCHandler::performOperationHook() {
} }
} }
CommandMessage message; CommandMessage message;
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK; for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
result = commandActionHelperQueue->receiveMessage(&message)) { result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
result = commandActionHelper.handleReply(&message); result = commandActionHelper.handleReply(&message);
if (result == RETURN_OK) { if (result == RETURN_OK) {
continue; continue;
@ -133,31 +133,31 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
void PlocMPSoCHandler::doStartUp() { void PlocMPSoCHandler::doStartUp() {
switch(powerState) { switch (powerState) {
case PowerState::OFF: case PowerState::OFF:
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
powerState = PowerState::BOOTING; powerState = PowerState::BOOTING;
break; break;
case PowerState::ON: case PowerState::ON:
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh(); uartIsolatorSwitch.pullHigh();
break; break;
default: default:
break; break;
} }
} }
void PlocMPSoCHandler::doShutDown() { void PlocMPSoCHandler::doShutDown() {
switch(powerState) { switch (powerState) {
case PowerState::ON: case PowerState::ON:
uartIsolatorSwitch.pullLow(); uartIsolatorSwitch.pullLow();
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC); commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
powerState = PowerState::SHUTDOWN; powerState = PowerState::SHUTDOWN;
break; break;
case PowerState::OFF: case PowerState::OFF:
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
break; break;
default: default:
break; break;
} }
} }
@ -703,64 +703,57 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
return replyLen; return replyLen;
} }
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
return commandActionHelperQueue;
}
void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; }
return;
}
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step, void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) { ReturnValue_t returnCode) {
switch (actionId) { switch (actionId) {
case supv::START_MPSOC: case supv::START_MPSOC:
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl;
<< std::endl; powerState = PowerState::OFF;
powerState = PowerState::OFF; break;
break; case supv::SHUTDOWN_MPSOC:
case supv::SHUTDOWN_MPSOC: triggerEvent(MPSOC_SHUTDOWN_FAILED);
triggerEvent(MPSOC_SHUTDOWN_FAILED); sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" // TODO: Setting state to on or off here?
<< std::endl; powerState = PowerState::ON;
// TODO: Setting state to on or off here? break;
powerState = PowerState::ON; default:
break; sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
default: << std::endl;
sif::debug break;
<< "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply" }
<< std::endl;
break;
}
} }
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
return; return;
} }
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) { void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
if (actionId != supv::EXE_REPORT) { if (actionId != supv::EXE_REPORT) {
sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action " sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
<< "ID" << std::endl; << "ID" << std::endl;
return; return;
} }
switch(powerState) { switch (powerState) {
case PowerState::BOOTING: { case PowerState::BOOTING: {
powerState = PowerState::ON; powerState = PowerState::ON;
break; break;
} }
case PowerState::SHUTDOWN: { case PowerState::SHUTDOWN: {
powerState = PowerState::OFF; powerState = PowerState::OFF;
break; break;
} }
default: { default: {
break; break;
} }
} }
} }
void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
handleActionCommandFailure(actionId); handleActionCommandFailure(actionId);
} }
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
@ -862,27 +855,27 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
switch (actionId) { switch (actionId) {
case supv::ACK_REPORT: case supv::ACK_REPORT:
case supv::EXE_REPORT: case supv::EXE_REPORT:
break; break;
default: default:
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID " sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
<< std::endl; << std::endl;
return; return;
} }
switch(powerState) { switch (powerState) {
case PowerState::BOOTING: { case PowerState::BOOTING: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC" sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
<< std::endl; << std::endl;
powerState = PowerState::OFF; powerState = PowerState::OFF;
break; break;
} }
case PowerState::SHUTDOWN: { case PowerState::SHUTDOWN: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
<< std::endl; << std::endl;
powerState = PowerState::ON; powerState = PowerState::ON;
break; break;
} }
default: default:
break; break;
} }
return; return;
} }

View File

@ -384,7 +384,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches, ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches,
uint8_t* numberOfSwitches) { uint8_t* numberOfSwitches) {
if (powerSwitch == power::NO_SWITCH) { if (powerSwitch == power::NO_SWITCH) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;
} }
*numberOfSwitches = 1; *numberOfSwitches = 1;
*switches = &powerSwitch; *switches = &powerSwitch;
@ -489,8 +489,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
switch (command->first) { switch (command->first) {
case supv::GET_HK_REPORT: { case supv::GET_HK_REPORT: {
enabledReplies = 3; enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, result =
supv::HK_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::HK_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< supv::HK_REPORT << " not in replyMap" << std::endl; << supv::HK_REPORT << " not in replyMap" << std::endl;
@ -589,15 +589,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
result = result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::ACK_REPORT
<< supv::ACK_REPORT << " not in replyMap" << std::endl; << " not in replyMap" << std::endl;
} }
result = result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::EXE_REPORT
<< supv::EXE_REPORT << " not in replyMap" << std::endl; << " not in replyMap" << std::endl;
} }
return RETURN_OK; return RETURN_OK;
@ -1013,7 +1013,7 @@ void PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) { void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2), supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2),
*(commandData + 3)); *(commandData + 3));
packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
} }
@ -1459,9 +1459,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
return MRAM_FILE_NOT_EXISTS; return MRAM_FILE_NOT_EXISTS;
} }
std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out); std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out);
file.write( file.write(reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH),
reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), packetLen - 1);
packetLen - 1);
file.close(); file.close();
return RETURN_OK; return RETURN_OK;
} }

View File

@ -262,12 +262,11 @@ void PlocUpdater::commandUpdateAvailable() {
calcImageCrc(); calcImageCrc();
supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image), supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, result =
supv::UPDATE_AVAILABLE, packet.getWholeData(), commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_AVAILABLE,
packet.getFullSize()); packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
<< " packet to supervisor handler" << std::endl; << " packet to supervisor handler" << std::endl;
@ -311,9 +310,9 @@ void PlocUpdater::commandUpdatePacket() {
} }
packet.makeCrc(); packet.makeCrc();
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, result =
supv::UPDATE_IMAGE_DATA, packet.getWholeData(), commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_IMAGE_DATA,
packet.getFullSize()); packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
@ -335,12 +334,10 @@ void PlocUpdater::commandUpdateVerify() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image), supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
numOfUpdatePackets);
result = result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY,
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
<< " packet to supervisor handler" << std::endl; << " packet to supervisor handler" << std::endl;

View File

@ -7,12 +7,12 @@
#include "ArcsecJsonParamBase.h" #include "ArcsecJsonParamBase.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "StrHelper.h" #include "StrHelper.h"
#include "devices/powerSwitcherList.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/src/fsfw/serialize/SerializeAdapter.h" #include "fsfw/src/fsfw/serialize/SerializeAdapter.h"
#include "fsfw/timemanager/Countdown.h" #include "fsfw/timemanager/Countdown.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "thirdparty/arcsec_star_tracker/common/SLIP.h" #include "thirdparty/arcsec_star_tracker/common/SLIP.h"
#include "devices/powerSwitcherList.h"
/** /**
* @brief This is the device handler for the star tracker from arcsec. * @brief This is the device handler for the star tracker from arcsec.

View File

@ -92,15 +92,15 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
return RETURN_OK; return RETURN_OK;
} }
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: { case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: {
printPeriodicData = true; printPeriodicData = true;
rawPacketLen = 0; rawPacketLen = 0;
return RETURN_OK; return RETURN_OK;
} }
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: { case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: {
rawPacketLen = 0; rawPacketLen = 0;
printPeriodicData = false; printPeriodicData = false;
return RETURN_OK; return RETURN_OK;
} }
default: default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
} }
@ -123,7 +123,7 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
switch (*foundId) { switch (*foundId) {
case RAD_SENSOR::START_CONVERSION: case RAD_SENSOR::START_CONVERSION:
case RAD_SENSOR::WRITE_SETUP: case RAD_SENSOR::WRITE_SETUP:
*foundLen = remainingSize; *foundLen = remainingSize;
return IGNORE_REPLY_DATA; return IGNORE_REPLY_DATA;
case RAD_SENSOR::READ_CONVERSIONS: { case RAD_SENSOR::READ_CONVERSIONS: {
ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET); ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET);
@ -138,8 +138,8 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
} }
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: case RAD_SENSOR::ENABLE_DEBUG_OUTPUT:
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: case RAD_SENSOR::DISABLE_DEBUG_OUTPUT:
sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl; sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl;
break; break;
default: default:
break; break;
} }

View File

@ -139,42 +139,45 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
return RETURN_OK; return RETURN_OK;
} }
case (SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE): { case (SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE): {
readTxAgcValueHighByte.copy(reinterpret_cast<char*>(commandBuffer), readTxAgcValueHighByte.size(), 0); readTxAgcValueHighByte.copy(reinterpret_cast<char*>(commandBuffer),
readTxAgcValueHighByte.size(), 0);
rawPacketLen = readTxAgcValueHighByte.size(); rawPacketLen = readTxAgcValueHighByte.size();
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE; rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): { case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): {
readTxAgcValueLowByte.copy(reinterpret_cast<char*>(commandBuffer), readTxAgcValueLowByte.size(), 0); readTxAgcValueLowByte.copy(reinterpret_cast<char*>(commandBuffer),
readTxAgcValueLowByte.size(), 0);
rawPacketLen = readTxAgcValueLowByte.size(); rawPacketLen = readTxAgcValueLowByte.size();
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE; rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
tempPowerAmpBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), tempPowerAmpBoardHighByte.size(), tempPowerAmpBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer),
0); tempPowerAmpBoardHighByte.size(), 0);
rawPacketLen = tempPowerAmpBoardHighByte.size(); rawPacketLen = tempPowerAmpBoardHighByte.size();
rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE; rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), tempPowerAmpBoardLowByte.size(), tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer),
0); tempPowerAmpBoardLowByte.size(), 0);
rawPacketLen = tempPowerAmpBoardLowByte.size(); rawPacketLen = tempPowerAmpBoardLowByte.size();
rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE; rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE): case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE):
tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), tempBasebandBoardHighByte.size(), tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer),
0); tempBasebandBoardHighByte.size(), 0);
rawPacketLen = tempBasebandBoardHighByte.size(); rawPacketLen = tempBasebandBoardHighByte.size();
rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE; rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE): case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE):
tempBasebandBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), tempBasebandBoardLowByte.size(), 0); tempBasebandBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer),
tempBasebandBoardLowByte.size(), 0);
rawPacketLen = tempBasebandBoardLowByte.size(); rawPacketLen = tempBasebandBoardLowByte.size();
rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE; rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
@ -352,8 +355,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
rawTempBasebandBoard |= convertHexStringToUint8( rawTempBasebandBoard |= convertHexStringToUint8(
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
tempBasebandBoard = calcTempVal(rawTempBasebandBoard); tempBasebandBoard = calcTempVal(rawTempBasebandBoard);
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
<< std::endl; << std::endl;
break; break;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
@ -364,8 +367,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
} }
rawTempPowerAmplifier = 0; rawTempPowerAmplifier = 0;
rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast<const char*>( rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast<const char*>(
packet + SYRLINKS::MESSAGE_HEADER_SIZE)) packet + SYRLINKS::MESSAGE_HEADER_SIZE))
<< 8; << 8;
break; break;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
@ -378,7 +381,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier); tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier);
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C" sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
<< std::endl; << std::endl;
break; break;
default: { default: {
sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl; sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl;

View File

@ -1,10 +1,11 @@
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
#include <string.h>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include <string.h>
/** /**
* @brief This is the device handler for the syrlinks transceiver. It handles the command * @brief This is the device handler for the syrlinks transceiver. It handles the command

View File

@ -143,13 +143,13 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A);
if (gpsUsable) { if (gpsUsable) {
gpioHandler(gpioIds::GNSS_0_NRESET, true, gpioHandler(gpioIds::GNSS_0_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 0 high (used GNSS)"); "of GNSS 0 high (used GNSS)");
gpioHandler(gpioIds::GNSS_1_NRESET, false, gpioHandler(gpioIds::GNSS_1_NRESET, false,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 1 low (unused GNSS)"); "of GNSS 1 low (unused GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, false, gpioHandler(gpioIds::GNSS_SELECT, false,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low"); "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low");
} }
break; break;
} }
@ -168,13 +168,13 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B);
if (gpsUsable) { if (gpsUsable) {
gpioHandler(gpioIds::GNSS_0_NRESET, false, gpioHandler(gpioIds::GNSS_0_NRESET, false,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 0 low (unused GNSS)"); "of GNSS 0 low (unused GNSS)");
gpioHandler(gpioIds::GNSS_1_NRESET, true, gpioHandler(gpioIds::GNSS_1_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 1 high (used GNSS)"); "of GNSS 1 high (used GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, true, gpioHandler(gpioIds::GNSS_SELECT, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high"); "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high");
} }
break; break;
} }
@ -191,11 +191,11 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
ReturnValue_t status = RETURN_OK; ReturnValue_t status = RETURN_OK;
if (gpsUsable) { if (gpsUsable) {
gpioHandler(gpioIds::GNSS_0_NRESET, true, gpioHandler(gpioIds::GNSS_0_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 0 high (used GNSS)"); "of GNSS 0 high (used GNSS)");
gpioHandler(gpioIds::GNSS_1_NRESET, true, gpioHandler(gpioIds::GNSS_1_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 1 high (used GNSS)"); "of GNSS 1 high (used GNSS)");
if (defaultSubmode == Submodes::A_SIDE) { if (defaultSubmode == Submodes::A_SIDE) {
status = gpioIF->pullLow(gpioIds::GNSS_SELECT); status = gpioIF->pullLow(gpioIds::GNSS_SELECT);
} else { } else {
@ -245,7 +245,7 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) {
void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) { void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
if(high) { if (high) {
result = gpioIF->pullHigh(gpio); result = gpioIF->pullHigh(gpio);
} else { } else {
result = gpioIF->pullLow(gpio); result = gpioIF->pullLow(gpio);