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() {
using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl;
#ifdef TE0720_1CFA
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"
<< FSFW_VERSION << "--" << 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"
SyrlinksFaultFlagMonitoring::SyrlinksFaultFlagMonitoring() {
// TODO Auto-generated constructor stub
}
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_
#define MISSION_DEVICES_SYRLINKSFAULTFLAGMONITORING_H_

View File

@ -19,19 +19,18 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
SyrlinksHkHandler::~SyrlinksHkHandler() {}
void SyrlinksHkHandler::doStartUp() {
// switch (startupState) {
// case StartupState::OFF: {
// startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION;
// break;
// }
// case StartupState::DONE: {
// setMode(_MODE_TO_ON);
// break;
// }
// default:
// break;
// }
switch (startupState) {
case StartupState::OFF: {
startupState = StartupState::ENABLE_TEMPERATURE_PROTECTION;
break;
}
case StartupState::DONE: {
setMode(_MODE_TO_ON);
break;
}
default:
break;
}
}
void SyrlinksHkHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
@ -99,130 +98,81 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
size_t commandDataLen) {
switch (deviceCommand) {
case (syrlinks::RESET_UNIT): {
resetCommand.copy(reinterpret_cast<char*>(commandBuffer), resetCommand.size(), 0);
rawPacketLen = resetCommand.size();
rawPacket = commandBuffer;
prepareCommand(resetCommand, deviceCommand);
return RETURN_OK;
}
case (syrlinks::SET_TX_MODE_STANDBY): {
setTxModeStandby.copy(reinterpret_cast<char*>(commandBuffer), setTxModeStandby.size(), 0);
rawPacketLen = setTxModeStandby.size();
rawPacket = commandBuffer;
prepareCommand(setTxModeStandby, deviceCommand);
return RETURN_OK;
}
case (syrlinks::SET_TX_MODE_MODULATION): {
setTxModeModulation.copy(reinterpret_cast<char*>(commandBuffer), setTxModeModulation.size(),
0);
rawPacketLen = setTxModeModulation.size();
rawPacket = commandBuffer;
prepareCommand(setTxModeModulation, deviceCommand);
return RETURN_OK;
}
case (syrlinks::SET_TX_MODE_CW): {
setTxModeCw.copy(reinterpret_cast<char*>(commandBuffer), setTxModeCw.size(), 0);
rawPacketLen = setTxModeCw.size();
rawPacket = commandBuffer;
prepareCommand(setTxModeCw, deviceCommand);
return RETURN_OK;
}
case (syrlinks::WRITE_LCL_CONFIG): {
writeLclConfig.copy(reinterpret_cast<char*>(commandBuffer), writeLclConfig.size(), 0);
rawPacketLen = writeLclConfig.size();
rawPacket = commandBuffer;
rememberCommandId = syrlinks::WRITE_LCL_CONFIG;
prepareCommand(writeLclConfig, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_RX_STATUS_REGISTERS): {
readRxStatusRegCommand.copy(reinterpret_cast<char*>(commandBuffer),
readRxStatusRegCommand.size(), 0);
rawPacketLen = readRxStatusRegCommand.size();
rawPacket = commandBuffer;
prepareCommand(readRxStatusRegCommand, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_LCL_CONFIG): {
readLclConfig.copy(reinterpret_cast<char*>(commandBuffer), readLclConfig.size(), 0);
rawPacketLen = readLclConfig.size();
rawPacket = commandBuffer;
rememberCommandId = syrlinks::READ_LCL_CONFIG;
prepareCommand(readLclConfig, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_TX_STATUS): {
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
rawPacketLen = readTxStatus.size();
rememberCommandId = syrlinks::READ_TX_STATUS;
rawPacket = commandBuffer;
prepareCommand(readTxStatus, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_TX_WAVEFORM): {
readTxWaveform.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0);
rawPacketLen = readTxWaveform.size();
rememberCommandId = syrlinks::READ_TX_WAVEFORM;
rawPacket = commandBuffer;
prepareCommand(readTxWaveform, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_TX_AGC_VALUE_HIGH_BYTE): {
readTxAgcValueHighByte.copy(reinterpret_cast<char*>(commandBuffer),
readTxAgcValueHighByte.size(), 0);
rawPacketLen = readTxAgcValueHighByte.size();
rememberCommandId = syrlinks::READ_TX_AGC_VALUE_HIGH_BYTE;
rawPacket = commandBuffer;
prepareCommand(readTxAgcValueHighByte, deviceCommand);
return RETURN_OK;
}
case (syrlinks::READ_TX_AGC_VALUE_LOW_BYTE): {
readTxAgcValueLowByte.copy(reinterpret_cast<char*>(commandBuffer),
readTxAgcValueLowByte.size(), 0);
rawPacketLen = readTxAgcValueLowByte.size();
rememberCommandId = syrlinks::READ_TX_AGC_VALUE_LOW_BYTE;
rawPacket = commandBuffer;
prepareCommand(readTxAgcValueLowByte, deviceCommand);
return RETURN_OK;
}
case (syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
tempPowerAmpBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer),
tempPowerAmpBoardHighByte.size(), 0);
rawPacketLen = tempPowerAmpBoardHighByte.size();
rememberCommandId = syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
rawPacket = commandBuffer;
case (syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE): {
prepareCommand(tempPowerAmpBoardHighByte, deviceCommand);
return RETURN_OK;
case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE):
tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer),
tempPowerAmpBoardLowByte.size(), 0);
rawPacketLen = tempPowerAmpBoardLowByte.size();
rememberCommandId = syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE;
rawPacket = commandBuffer;
}
case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE): {
prepareCommand(tempPowerAmpBoardLowByte, deviceCommand);
return RETURN_OK;
case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE):
tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer),
tempBasebandBoardHighByte.size(), 0);
rawPacketLen = tempBasebandBoardHighByte.size();
rememberCommandId = syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE;
rawPacket = commandBuffer;
}
case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE): {
prepareCommand(tempBasebandBoardHighByte, deviceCommand);
return RETURN_OK;
case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE):
tempBasebandBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer),
tempBasebandBoardLowByte.size(), 0);
rawPacketLen = tempBasebandBoardLowByte.size();
rememberCommandId = syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE;
rawPacket = commandBuffer;
}
case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE): {
prepareCommand(tempBasebandBoardLowByte, deviceCommand);
return RETURN_OK;
case (syrlinks::SET_WAVEFORM_OQPSK):
setWaveformOQPSK.copy(reinterpret_cast<char*>(commandBuffer),
setWaveformOQPSK.size(), 0);
rawPacketLen = setWaveformOQPSK.size();
rememberCommandId = syrlinks::SET_WAVEFORM_OQPSK;
rawPacket = commandBuffer;
}
case (syrlinks::CONFIG_BPSK): {
prepareCommand(configBPSK, deviceCommand);
return RETURN_OK;
case (syrlinks::SET_WAVEFORM_BPSK):
setWaveformBPSK.copy(reinterpret_cast<char*>(commandBuffer),
setWaveformBPSK.size(), 0);
rawPacketLen = setWaveformBPSK.size();
rememberCommandId = syrlinks::SET_WAVEFORM_BPSK;
rawPacket = commandBuffer;
}
case (syrlinks::CONFIG_OQPSK): {
prepareCommand(configOQPSK, deviceCommand);
return RETURN_OK;
case (syrlinks::SET_SECOND_CONFIG):
setSecondConfiguration.copy(reinterpret_cast<char*>(commandBuffer),
setSecondConfiguration.size(), 0);
rawPacketLen = setSecondConfiguration.size();
rememberCommandId = syrlinks::SET_SECOND_CONFIG;
rawPacket = commandBuffer;
}
case (syrlinks::ENABLE_DEBUG): {
debug = true;
return RETURN_OK;
}
case (syrlinks::DISABLE_DEBUG): {
debug = false;
return RETURN_OK;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -240,12 +190,12 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
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);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_SECOND_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY);
this->insertInCommandMap(syrlinks::ENABLE_DEBUG);
this->insertInCommandMap(syrlinks::DISABLE_DEBUG);
this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr,
syrlinks::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(syrlinks::READ_TX_STATUS, 1, &txDataset,
@ -443,8 +393,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
PoolReadGuard rg(&temperatureSet);
temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier;
if (debug) {
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier
<< " °C" << std::endl;
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
<< std::endl;
}
break;
}
@ -470,10 +420,6 @@ LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) {
}
}
void SyrlinksHkHandler::performOperationHook() {
}
std::string SyrlinksHkHandler::convertUint16ToHexString(uint16_t intValue) {
std::stringstream stream;
stream << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << intValue;
@ -592,6 +538,7 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
if (debug) {
sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value
<< std::endl;
sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl;
@ -601,6 +548,7 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
sif::info << "Syrlinks RX Demod Eb: " << rxDataset.rxDemodEb << 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
}
@ -615,7 +563,7 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
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
<< std::endl;
#endif
@ -625,7 +573,7 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
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
<< std::endl;
#endif
@ -636,7 +584,7 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txAgcValue = agcValueHighByte << 8 |
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;
#endif
}
@ -685,3 +633,10 @@ ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
}
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,
LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
void performOperationHook();
private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
@ -67,8 +66,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
std::string setTxModeStandby = "<W04:4000:7E58>";
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
std::string setTxModeModulation = "<W04:4001:4D69>";
// std::string setSecondConfiguration = "<W04:4007:E7CF>";
std::string setSecondConfiguration = "<W04:400B:1063>";
std::string configBPSK = "<W04:4007:E7CF>";
std::string configOQPSK = "<W04:400B:1063>";
std::string setTxModeCw = "<W04:4010:4968>";
std::string writeLclConfig = "<W04:0707:3FE4>";
std::string setWaveformOQPSK = "<W04:4403:E1FA>";
@ -111,7 +110,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
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
@ -212,6 +211,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
float calcTempVal(uint16_t);
ReturnValue_t handleAckReply(const uint8_t* packet);
void prepareCommand(std::string command, DeviceCommandId_t commandId);
};
#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_BASEBAND_BOARD_HIGH_BYTE = 15;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16;
static const DeviceCommandId_t SET_WAVEFORM_OQPSK = 17;
static const DeviceCommandId_t SET_WAVEFORM_BPSK = 18;
static const DeviceCommandId_t SET_SECOND_CONFIG = 19;
static const DeviceCommandId_t CONFIG_OQPSK = 17;
// After startup syrlinks always in BSPK configuration
static const DeviceCommandId_t CONFIG_BPSK = 18;
static const DeviceCommandId_t ENABLE_DEBUG = 20;
static const DeviceCommandId_t DISABLE_DEBUG = 21;
/** Size of a simple transmission success response */
static const uint8_t ACK_SIZE = 12;