some syrlinks tweaks and fixes #350

Merged
meierj merged 3 commits from syrlink_fixes_tweaks into develop 2023-01-23 19:06:52 +01:00
5 changed files with 57 additions and 35 deletions

View File

@ -18,6 +18,7 @@ list yields a list of all related PRs for each release.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/340. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/340.
- Basic TCS Subsystem component. - Basic TCS Subsystem component.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/319 PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/319
## Changed ## Changed
- Moved some PDEC/PTME configuration to `common/config/eive/definitions.h` - Moved some PDEC/PTME configuration to `common/config/eive/definitions.h`
@ -42,6 +43,9 @@ list yields a list of all related PRs for each release.
previous range setting was wrong. Also fixed a small error properly set internal state previous range setting was wrong. Also fixed a small error properly set internal state
on shut-down. on shut-down.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/342 PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/342
- Syrlinks Handler: Read RX frequency shift as 24 bit signed number now. Also include
validity handling for datasets.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/350
- `GyroADIS1650XHandler`: Changed calculation of angular rate to be sensitivity based instead of - `GyroADIS1650XHandler`: Changed calculation of angular rate to be sensitivity based instead of
max. range based, as previous fix still left an margin of error between ADIS16505 sensors max. range based, as previous fix still left an margin of error between ADIS16505 sensors
and L3GD20 sensors. and L3GD20 sensors.

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,25 @@ 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); convertHexStringTo32bit<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); convertHexStringTo32bit<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 =
convertHexStringTo32bit<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 =
convertHexStringTo32bit<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 +553,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 +564,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 +576,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 +596,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

@ -147,15 +147,16 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
uint16_t convertHexStringToUint16(const char* fourChars); uint16_t convertHexStringToUint16(const char* fourChars);
/** /**
* @brief Function converts a hex number represented by 6 or 8 characters to an uint32_t. * @brief Function converts a hex number represented by 6 or 8 characters to an uint32_t or
* int32_t, depending on the template parameter.
* *
* @param characters Pointer to the hex characters array. * @param characters Pointer to the hex characters array.
* @param numberOfChars Number of characters representing the hex value. Must be 6 or 8. * @param numberOfChars Number of characters representing the hex value. Must be 6 or 8.
* *
* @return The uint32_t value. * @return The value.
*/ */
uint32_t convertHexStringToUint32(const char* characters, uint8_t numberOfChars); template <typename T>
T convertHexStringTo32bit(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,33 @@ 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::convertHexStringTo32bit(const char* characters, uint8_t numberOfChars) {
if (sizeof(T) < 4) {
sif::error << "SyrlinksHkHandler::convertHexStringToRaw: Only works for 32-bit conversion"
<< std::endl;
}
T value = 0;
switch (numberOfChars) {
case 6:
// The bitshift trickery required is necessary when creating an int32_t from a
// 24 bit signed value.
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