meier/syrlinks #199

Merged
muellerr merged 11 commits from meier/syrlinks into develop 2022-04-06 12:09:51 +02:00
10 changed files with 185 additions and 162 deletions
Showing only changes of commit d2f54f033f - Show all commits

View File

@ -0,0 +1,7 @@
#include "GpsDummy.h"
GpsDummy::GpsDummy() {
}
GpsDummy::~GpsDummy() {
}

View File

@ -0,0 +1,13 @@
#ifndef BSP_HOSTED_ACSDUMMIES_GPSDUMMY_H_
#define BSP_HOSTED_ACSDUMMIES_GPSDUMMY_H_
/**
* @brief Dummy class to simulate sending of GPS data to ACS controller.
*/
class GpsDummy : public ExtendedControllerBase {
public:
GpsDummy();
virtual ~GpsDummy();
};
#endif /* BSP_HOSTED_ACSDUMMIES_GPSDUMMY_H_ */

View File

@ -15,11 +15,7 @@ static int OBSW_ALREADY_RUNNING = -2;
int obsw::obsw() { int obsw::obsw() {
using namespace fsfw; using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
#ifdef TE0720_1CFA
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl; std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
#else
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
#endif
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v" std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
<< FSFW_VERSION << "--" << std::endl; << FSFW_VERSION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;

View File

@ -0,0 +1,48 @@
#include "AcsController.h"
AcsController::AcsController() {
}
AcsController::~AcsController() {
}
ReturnValue_t AcsController::initialize() {
ControllerBase::initialize();
}
ReturnValue_t AcsController::handleCommandMessage(CommandMessage * message) {
ReturnValue_t result = actionHelper.handleActionMessage(message);
if (result == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
return result;
}
void AcsController::performControlOperation() {
if (mode != MODE_OFF) {
monitoring.monitor(&acsParameters);
switch (submode) {
case SUBMODE_SAFE:
performSafe(SAFE_CONTROLLER);
break;
case SUBMODE_IDLE:
performPointing(IDLE_CONTROLLER);
break;
case SUBMODE_NADIR:
performPointing(NADIR_CONTROLLER);
break;
case SUBMODE_TARGET:
performPointing(TARGET_CONTROLLER);
break;
case SUBMODE_INERTIAL:
performPointing(INERTIAL_CONTROLLER);
break;
case SUBMODE_ROTATION:
performPointing(ROTATION_CONTROLLER);
break;
default:
break;
}
}
}

View File

@ -0,0 +1,18 @@
#ifndef MISSION_CONTROLLER_ACSCONTROLLER_H_
#define MISSION_CONTROLLER_ACSCONTROLLER_H_
#include "fsfw/controller/ControllerBase.h"
class AcsController : public ControllerBase {
public:
AcsController();
virtual ~AcsController();
ReturnValue_t initialize() override;
protected:
ReturnValue_t handleCommandMessage(CommandMessage *message);
void performControlOperation();
};
#endif /* MISSION_CONTROLLER_ACSCONTROLLER_H_ */

View File

@ -1,16 +1,7 @@
/*
* SyrlinksFaultFlagMonitoring.cpp
*
* Created on: 01.04.2022
* Author: jakob
*/
#include "SyrlinksFaultFlagMonitoring.h" #include "SyrlinksFaultFlagMonitoring.h"
SyrlinksFaultFlagMonitoring::SyrlinksFaultFlagMonitoring() { SyrlinksFaultFlagMonitoring::SyrlinksFaultFlagMonitoring() {
// TODO Auto-generated constructor stub
} }
SyrlinksFaultFlagMonitoring::~SyrlinksFaultFlagMonitoring() { SyrlinksFaultFlagMonitoring::~SyrlinksFaultFlagMonitoring() {
// TODO Auto-generated destructor stub
} }

View File

@ -1,10 +1,3 @@
/*
* SyrlinksFaultFlagMonitoring.h
*
* Created on: 01.04.2022
* Author: jakob
*/
#ifndef MISSION_DEVICES_SYRLINKSFAULTFLAGMONITORING_H_ #ifndef MISSION_DEVICES_SYRLINKSFAULTFLAGMONITORING_H_
#define MISSION_DEVICES_SYRLINKSFAULTFLAGMONITORING_H_ #define MISSION_DEVICES_SYRLINKSFAULTFLAGMONITORING_H_

View File

@ -19,19 +19,18 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
SyrlinksHkHandler::~SyrlinksHkHandler() {} SyrlinksHkHandler::~SyrlinksHkHandler() {}
void SyrlinksHkHandler::doStartUp() { void SyrlinksHkHandler::doStartUp() {
// switch (startupState) { switch (startupState) {
// case StartupState::OFF: { case StartupState::OFF: {
// startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION; startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION;
// break; break;
// } }
// case StartupState::DONE: { case StartupState::DONE: {
// setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
// break; break;
// } }
// default: default:
// break; break;
// } }
setMode(_MODE_TO_ON);
} }
void SyrlinksHkHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } void SyrlinksHkHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
@ -99,130 +98,81 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
size_t commandDataLen) { size_t commandDataLen) {
switch (deviceCommand) { switch (deviceCommand) {
case (syrlinks::RESET_UNIT): { case (syrlinks::RESET_UNIT): {
resetCommand.copy(reinterpret_cast<char*>(commandBuffer), resetCommand.size(), 0); prepareCommand(resetCommand, deviceCommand);
rawPacketLen = resetCommand.size();
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::SET_TX_MODE_STANDBY): { case (syrlinks::SET_TX_MODE_STANDBY): {
setTxModeStandby.copy(reinterpret_cast<char*>(commandBuffer), setTxModeStandby.size(), 0); prepareCommand(setTxModeStandby, deviceCommand);
rawPacketLen = setTxModeStandby.size();
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::SET_TX_MODE_MODULATION): { case (syrlinks::SET_TX_MODE_MODULATION): {
setTxModeModulation.copy(reinterpret_cast<char*>(commandBuffer), setTxModeModulation.size(), prepareCommand(setTxModeModulation, deviceCommand);
0);
rawPacketLen = setTxModeModulation.size();
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::SET_TX_MODE_CW): { case (syrlinks::SET_TX_MODE_CW): {
setTxModeCw.copy(reinterpret_cast<char*>(commandBuffer), setTxModeCw.size(), 0); prepareCommand(setTxModeCw, deviceCommand);
rawPacketLen = setTxModeCw.size();
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::WRITE_LCL_CONFIG): { case (syrlinks::WRITE_LCL_CONFIG): {
writeLclConfig.copy(reinterpret_cast<char*>(commandBuffer), writeLclConfig.size(), 0); prepareCommand(writeLclConfig, deviceCommand);
rawPacketLen = writeLclConfig.size();
rawPacket = commandBuffer;
rememberCommandId = syrlinks::WRITE_LCL_CONFIG;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::READ_RX_STATUS_REGISTERS): { case (syrlinks::READ_RX_STATUS_REGISTERS): {
readRxStatusRegCommand.copy(reinterpret_cast<char*>(commandBuffer), prepareCommand(readRxStatusRegCommand, deviceCommand);
readRxStatusRegCommand.size(), 0);
rawPacketLen = readRxStatusRegCommand.size();
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::READ_LCL_CONFIG): { case (syrlinks::READ_LCL_CONFIG): {
readLclConfig.copy(reinterpret_cast<char*>(commandBuffer), readLclConfig.size(), 0); prepareCommand(readLclConfig, deviceCommand);
rawPacketLen = readLclConfig.size();
rawPacket = commandBuffer;
rememberCommandId = syrlinks::READ_LCL_CONFIG;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::READ_TX_STATUS): { case (syrlinks::READ_TX_STATUS): {
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0); prepareCommand(readTxStatus, deviceCommand);
rawPacketLen = readTxStatus.size();
rememberCommandId = syrlinks::READ_TX_STATUS;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (syrlinks::READ_TX_WAVEFORM): { case (syrlinks::READ_TX_WAVEFORM): {
readTxWaveform.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0); prepareCommand(readTxWaveform, deviceCommand);
rawPacketLen = readTxWaveform.size();
rememberCommandId = syrlinks::READ_TX_WAVEFORM;
rawPacket = commandBuffer;
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), prepareCommand(readTxAgcValueHighByte, deviceCommand);
readTxAgcValueHighByte.size(), 0);
rawPacketLen = readTxAgcValueHighByte.size();
rememberCommandId = syrlinks::READ_TX_AGC_VALUE_HIGH_BYTE;
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), prepareCommand(readTxAgcValueLowByte, deviceCommand);
readTxAgcValueLowByte.size(), 0);
rawPacketLen = readTxAgcValueLowByte.size();
rememberCommandId = syrlinks::READ_TX_AGC_VALUE_LOW_BYTE;
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), prepareCommand(tempPowerAmpBoardHighByte, deviceCommand);
tempPowerAmpBoardHighByte.size(), 0);
rawPacketLen = tempPowerAmpBoardHighByte.size();
rememberCommandId = syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE): }
tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE): {
tempPowerAmpBoardLowByte.size(), 0); prepareCommand(tempPowerAmpBoardLowByte, deviceCommand);
rawPacketLen = tempPowerAmpBoardLowByte.size();
rememberCommandId = syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE): }
tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE): {
tempBasebandBoardHighByte.size(), 0); prepareCommand(tempBasebandBoardHighByte, deviceCommand);
rawPacketLen = tempBasebandBoardHighByte.size();
rememberCommandId = syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE): }
tempBasebandBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE): {
tempBasebandBoardLowByte.size(), 0); prepareCommand(tempBasebandBoardLowByte, deviceCommand);
rawPacketLen = tempBasebandBoardLowByte.size();
rememberCommandId = syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::SET_WAVEFORM_OQPSK): }
setWaveformOQPSK.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::CONFIG_BPSK): {
setWaveformOQPSK.size(), 0); prepareCommand(configBPSK, deviceCommand);
rawPacketLen = setWaveformOQPSK.size();
rememberCommandId = syrlinks::SET_WAVEFORM_OQPSK;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::SET_WAVEFORM_BPSK): }
setWaveformBPSK.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::CONFIG_OQPSK): {
setWaveformBPSK.size(), 0); prepareCommand(configOQPSK, deviceCommand);
rawPacketLen = setWaveformBPSK.size();
rememberCommandId = syrlinks::SET_WAVEFORM_BPSK;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (syrlinks::SET_SECOND_CONFIG): }
setSecondConfiguration.copy(reinterpret_cast<char*>(commandBuffer), case (syrlinks::ENABLE_DEBUG): {
setSecondConfiguration.size(), 0); debug = true;
rawPacketLen = setSecondConfiguration.size();
rememberCommandId = syrlinks::SET_SECOND_CONFIG;
rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
}
case (syrlinks::DISABLE_DEBUG): {
debug = false;
return RETURN_OK;
}
default: default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
} }
@ -240,12 +190,12 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
true, syrlinks::ACK_REPLY); true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_OQPSK, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::CONFIG_BPSK, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_SECOND_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandMap(syrlinks::ENABLE_DEBUG);
this->insertInCommandMap(syrlinks::DISABLE_DEBUG);
this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr, this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr,
syrlinks::READ_ONE_REGISTER_REPLY_SIE); syrlinks::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(syrlinks::READ_TX_STATUS, 1, &txDataset, this->insertInCommandAndReplyMap(syrlinks::READ_TX_STATUS, 1, &txDataset,
@ -316,8 +266,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::ACK_SIZE); result = verifyReply(packet, syrlinks::ACK_SIZE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgment reply has " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgment reply has "
"invalid crc" "invalid crc"
<< std::endl; << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
result = handleAckReply(packet); result = handleAckReply(packet);
@ -330,7 +280,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE); result = verifyReply(packet, syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read rx status registers reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read rx status registers reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseRxStatusRegistersReply(packet); parseRxStatusRegistersReply(packet);
@ -340,7 +290,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseLclConfigReply(packet); parseLclConfigReply(packet);
@ -350,7 +300,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx status reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx status reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseTxStatusReply(packet); parseTxStatusReply(packet);
@ -360,7 +310,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx waveform reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx waveform reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseTxWaveformReply(packet); parseTxWaveformReply(packet);
@ -370,7 +320,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC high byte reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC high byte reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseAgcHighByte(packet); parseAgcHighByte(packet);
@ -380,7 +330,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC low byte reply " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC low byte reply "
<< "has invalid crc" << std::endl; << "has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
parseAgcLowByte(packet); parseAgcLowByte(packet);
@ -390,7 +340,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board "
<< "high byte reply has invalid crc" << std::endl; << "high byte reply has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempBasebandBoard = convertHexStringToUint8(reinterpret_cast<const char*>( rawTempBasebandBoard = convertHexStringToUint8(reinterpret_cast<const char*>(
@ -402,8 +352,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board" sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board"
" low byte reply has invalid crc" " low byte reply has invalid crc"
<< std::endl; << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempBasebandBoard |= convertHexStringToUint8( rawTempBasebandBoard |= convertHexStringToUint8(
@ -412,8 +362,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
temperatureSet.temperatureBasebandBoard = tempBasebandBoard; temperatureSet.temperatureBasebandBoard = tempBasebandBoard;
PoolReadGuard rg(&temperatureSet); PoolReadGuard rg(&temperatureSet);
if (debug) { if (debug) {
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
<< std::endl; << std::endl;
} }
break; break;
} }
@ -421,7 +371,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier " sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier "
<< "board high byte reply has invalid crc" << std::endl; << "board high byte reply has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempPowerAmplifier = 0; rawTempPowerAmplifier = 0;
@ -434,7 +384,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier" sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier"
<< " board low byte reply has invalid crc" << std::endl; << " board low byte reply has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempPowerAmplifier |= convertHexStringToUint8( rawTempPowerAmplifier |= convertHexStringToUint8(
@ -443,8 +393,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
PoolReadGuard rg(&temperatureSet); PoolReadGuard rg(&temperatureSet);
temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier; temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier;
if (debug) { if (debug) {
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
<< " °C" << std::endl; << std::endl;
} }
break; break;
} }
@ -470,10 +420,6 @@ LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) {
} }
} }
void SyrlinksHkHandler::performOperationHook() {
}
std::string SyrlinksHkHandler::convertUint16ToHexString(uint16_t intValue) { std::string SyrlinksHkHandler::convertUint16ToHexString(uint16_t intValue) {
std::stringstream stream; std::stringstream stream;
stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue; stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue;
@ -592,15 +538,17 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value if (debug) {
<< std::endl; sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value
sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl; << std::endl;
sif::info << "Syrlinks RX Frequency Shift: " << rxDataset.rxFrequencyShift << std::endl; sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl;
sif::info << "Syrlinks RX IQ Power: " << rxDataset.rxIqPower << std::endl; sif::info << "Syrlinks RX Frequency Shift: " << rxDataset.rxFrequencyShift << std::endl;
sif::info << "Syrlinks RX AGC Value: " << rxDataset.rxAgcValue << std::endl; sif::info << "Syrlinks RX IQ Power: " << rxDataset.rxIqPower << std::endl;
sif::info << "Syrlinks RX Demod Eb: " << rxDataset.rxDemodEb << std::endl; sif::info << "Syrlinks RX AGC Value: " << rxDataset.rxAgcValue << std::endl;
sif::info << "Syrlinks RX Demod N0: " << rxDataset.rxDemodN0 << std::endl; sif::info << "Syrlinks RX Demod Eb: " << rxDataset.rxDemodEb << std::endl;
sif::info << "Syrlinks RX Datarate: " << (unsigned int)rxDataset.rxDataRate.value << std::endl; sif::info << "Syrlinks RX Demod N0: " << rxDataset.rxDemodN0 << std::endl;
sif::info << "Syrlinks RX Datarate: " << (unsigned int)rxDataset.rxDataRate.value << std::endl;
}
#endif #endif
} }
@ -615,7 +563,7 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1 #if OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value
<< std::endl; << std::endl;
#endif #endif
@ -625,7 +573,7 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1 #if OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value
<< std::endl; << std::endl;
#endif #endif
@ -636,7 +584,7 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txAgcValue = agcValueHighByte << 8 | txDataset.txAgcValue = agcValueHighByte << 8 |
convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1 #if OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl; sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
#endif #endif
} }
@ -685,3 +633,10 @@ ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
} }
return result; return result;
} }
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
command.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0);
rawPacketLen = command.size();
rememberCommandId = commandId;
rawPacket = commandBuffer;
}

View File

@ -44,7 +44,6 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
void performOperationHook();
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
@ -67,8 +66,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
std::string setTxModeStandby = "<W04:4000:7E58>"; std::string setTxModeStandby = "<W04:4000:7E58>";
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */ /** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
std::string setTxModeModulation = "<W04:4001:4D69>"; std::string setTxModeModulation = "<W04:4001:4D69>";
// std::string setSecondConfiguration = "<W04:4007:E7CF>"; std::string configBPSK = "<W04:4007:E7CF>";
std::string setSecondConfiguration = "<W04:400B:1063>"; std::string configOQPSK = "<W04:400B:1063>";
std::string setTxModeCw = "<W04:4010:4968>"; std::string setTxModeCw = "<W04:4010:4968>";
std::string writeLclConfig = "<W04:0707:3FE4>"; std::string writeLclConfig = "<W04:0707:3FE4>";
std::string setWaveformOQPSK = "<W04:4403:E1FA>"; std::string setWaveformOQPSK = "<W04:4403:E1FA>";
@ -111,7 +110,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
StartupState startupState = StartupState::OFF; StartupState startupState = StartupState::OFF;
bool debug = true; bool debug = false;
/** /**
* This object is used to store the id of the next command to execute. This controls the * This object is used to store the id of the next command to execute. This controls the
@ -212,6 +211,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
float calcTempVal(uint16_t); float calcTempVal(uint16_t);
ReturnValue_t handleAckReply(const uint8_t* packet); ReturnValue_t handleAckReply(const uint8_t* packet);
void prepareCommand(std::string command, DeviceCommandId_t commandId);
}; };
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */ #endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */

View File

@ -24,10 +24,11 @@ static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_HIGH_BYTE = 13;
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14; static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16;
static const DeviceCommandId_t SET_WAVEFORM_OQPSK = 17; static const DeviceCommandId_t CONFIG_OQPSK = 17;
static const DeviceCommandId_t SET_WAVEFORM_BPSK = 18; // After startup syrlinks always in BSPK configuration
static const DeviceCommandId_t SET_SECOND_CONFIG = 19; static const DeviceCommandId_t CONFIG_BPSK = 18;
static const DeviceCommandId_t ENABLE_DEBUG = 20; static const DeviceCommandId_t ENABLE_DEBUG = 20;
static const DeviceCommandId_t DISABLE_DEBUG = 21;
/** Size of a simple transmission success response */ /** Size of a simple transmission success response */
static const uint8_t ACK_SIZE = 12; static const uint8_t ACK_SIZE = 12;