some syrlinks tweakd and fixes
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-01-23 15:35:43 +01:00
parent 1926e7f864
commit 0419561ff8
4 changed files with 43 additions and 33 deletions

View File

@ -33,7 +33,10 @@ void SyrlinksHkHandler::doStartUp() {
} }
} }
void SyrlinksHkHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } void SyrlinksHkHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
temperatureSet.setValidity(false, true);
}
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
switch (nextCommand) { switch (nextCommand) {
@ -363,6 +366,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
tempBasebandBoard = calcTempVal(rawTempBasebandBoard); tempBasebandBoard = calcTempVal(rawTempBasebandBoard);
PoolReadGuard rg(&temperatureSet); PoolReadGuard rg(&temperatureSet);
temperatureSet.temperatureBasebandBoard = tempBasebandBoard; temperatureSet.temperatureBasebandBoard = tempBasebandBoard;
temperatureSet.temperatureBasebandBoard.setValid(true);
if (debugMode) { if (debugMode) {
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
<< std::endl; << std::endl;
@ -394,6 +398,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier); tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier);
PoolReadGuard rg(&temperatureSet); PoolReadGuard rg(&temperatureSet);
temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier; temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier;
temperatureSet.temperaturePowerAmplifier.setValid(true);
if (debugMode) { if (debugMode) {
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C" sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
<< std::endl; << std::endl;
@ -443,29 +448,6 @@ uint16_t SyrlinksHkHandler::convertHexStringToUint16(const char* fourChars) {
return value; return value;
} }
uint32_t SyrlinksHkHandler::convertHexStringToUint32(const char* characters,
uint8_t numberOfChars) {
uint32_t value = 0;
switch (numberOfChars) {
case 6:
value = convertHexStringToUint8(characters) << 16 |
convertHexStringToUint8(characters + 2) << 8 |
convertHexStringToUint8(characters + 4);
return value;
case 8:
value = convertHexStringToUint8(characters) << 24 |
convertHexStringToUint8(characters + 2) << 16 |
convertHexStringToUint8(characters + 4) << 8 |
convertHexStringToUint8(characters + 4);
return value;
default:
sif::debug << "SyrlinksHkHandler::convertHexStringToUint32: Invalid number of characters. "
<< "Must be either 6 or 8" << std::endl;
return 0;
}
}
ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
switch (*status) { switch (*status) {
case '0': case '0':
@ -524,22 +506,23 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
offset += 2; offset += 2;
rxDataset.rxSensitivity = rxDataset.rxSensitivity =
convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6); convertHexStringToRaw<uint32_t>(reinterpret_cast<const char*>(packet + offset), 6);
offset += 6; offset += 6;
rxDataset.rxFrequencyShift = rxDataset.rxFrequencyShift =
convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6); convertHexStringToRaw<int32_t>(reinterpret_cast<const char*>(packet + offset), 6);
offset += 6; offset += 6;
rxDataset.rxIqPower = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxIqPower = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset));
offset += 4; offset += 4;
rxDataset.rxAgcValue = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxAgcValue = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset));
offset += 4; offset += 4;
offset += 2; // reserved register offset += 2; // reserved register
rxDataset.rxDemodEb = convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6); rxDataset.rxDemodEb = convertHexStringToRaw<uint32_t>(reinterpret_cast<const char*>(packet + offset), 6);
offset += 6; offset += 6;
rxDataset.rxDemodN0 = convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6); rxDataset.rxDemodN0 = convertHexStringToRaw<uint32_t>(reinterpret_cast<const char*>(packet + offset), 6);
offset += 6; offset += 6;
rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset)); rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
rxDataset.setValidity(true, true);
if (debugMode) { if (debugMode) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value
@ -568,6 +551,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));
txDataset.txStatus.setValid(true);
if (debugMode) { if (debugMode) {
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;
@ -578,6 +562,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));
txDataset.txWaveform.setValid(true);
if (debugMode) { if (debugMode) {
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;
@ -589,6 +574,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));
txDataset.txAgcValue.setValid(true);
if (debugMode) { if (debugMode) {
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl; sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
} }
@ -608,7 +594,7 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_SENSITIVITY, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(syrlinks::RX_SENSITIVITY, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_FREQUENCY_SHIFT, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(syrlinks::RX_FREQUENCY_SHIFT, new PoolEntry<int32_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_IQ_POWER, new PoolEntry<uint16_t>({0})); localDataPoolMap.emplace(syrlinks::RX_IQ_POWER, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_AGC_VALUE, new PoolEntry<uint16_t>({0})); localDataPoolMap.emplace(syrlinks::RX_AGC_VALUE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(syrlinks::RX_DEMOD_EB, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(syrlinks::RX_DEMOD_EB, new PoolEntry<uint32_t>({0}));

View File

@ -154,8 +154,9 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
* *
* @return The uint32_t value. * @return The uint32_t value.
*/ */
uint32_t convertHexStringToUint32(const char* characters, uint8_t numberOfChars); // uint32_t convertHexStringToUint32(const char* characters, uint8_t numberOfChars);
template <typename T>
T convertHexStringToRaw(const char* characters, uint8_t numberOfChars);
/** /**
* @brief This function parses the status reply * @brief This function parses the status reply
* @param status Pointer to the status information. * @param status Pointer to the status information.
@ -214,4 +215,27 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
void prepareCommand(std::string command, DeviceCommandId_t commandId); void prepareCommand(std::string command, DeviceCommandId_t commandId);
}; };
template <typename T>
T SyrlinksHkHandler::convertHexStringToRaw(const char* characters,
uint8_t numberOfChars) {
T value = 0;
switch (numberOfChars) {
case 6:
value = ((convertHexStringToUint8(characters) << 24) |
(convertHexStringToUint8(characters + 2) << 16) |
(convertHexStringToUint8(characters + 4) << 8)) >> 8;
return value;
case 8:
value = convertHexStringToUint8(characters) << 24 |
convertHexStringToUint8(characters + 2) << 16 |
convertHexStringToUint8(characters + 4) << 8 |
convertHexStringToUint8(characters + 4);
return value;
default:
sif::debug << "SyrlinksHkHandler::convertHexStringToUint32: Invalid number of characters. "
<< "Must be either 6 or 8" << std::endl;
return 0;
}
}
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */ #endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */

View File

@ -86,7 +86,7 @@ class RxDataset : public StaticLocalDataSet<RX_DATASET_SIZE> {
lp_var_t<uint8_t> rxStatus = lp_var_t<uint8_t>(sid.objectId, RX_STATUS, this); lp_var_t<uint8_t> rxStatus = lp_var_t<uint8_t>(sid.objectId, RX_STATUS, this);
lp_var_t<uint32_t> rxSensitivity = lp_var_t<uint32_t>(sid.objectId, RX_SENSITIVITY, this); lp_var_t<uint32_t> rxSensitivity = lp_var_t<uint32_t>(sid.objectId, RX_SENSITIVITY, this);
lp_var_t<uint32_t> rxFrequencyShift = lp_var_t<uint32_t>(sid.objectId, RX_FREQUENCY_SHIFT, this); lp_var_t<int32_t> rxFrequencyShift = lp_var_t<int32_t>(sid.objectId, RX_FREQUENCY_SHIFT, this);
lp_var_t<uint16_t> rxIqPower = lp_var_t<uint16_t>(sid.objectId, RX_IQ_POWER, this); lp_var_t<uint16_t> rxIqPower = lp_var_t<uint16_t>(sid.objectId, RX_IQ_POWER, this);
lp_var_t<uint16_t> rxAgcValue = lp_var_t<uint16_t>(sid.objectId, RX_AGC_VALUE, this); lp_var_t<uint16_t> rxAgcValue = lp_var_t<uint16_t>(sid.objectId, RX_AGC_VALUE, this);
lp_var_t<uint32_t> rxDemodEb = lp_var_t<uint32_t>(sid.objectId, RX_DEMOD_EB, this); lp_var_t<uint32_t> rxDemodEb = lp_var_t<uint32_t>(sid.objectId, RX_DEMOD_EB, this);

2
tmtc

@ -1 +1 @@
Subproject commit 033c8927c0d817e3e562d1d199d217f4bdf45ce7 Subproject commit d23201466c279c410fd421b1584c46a439827ad5