Merge pull request 'some syrlinks tweaks and fixes' (#350) from syrlink_fixes_tweaks into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #350 Reviewed-by: Jakob Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
commit
c6366f4906
@ -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.
|
||||
- Basic TCS Subsystem component.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/319
|
||||
|
||||
## Changed
|
||||
|
||||
- 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
|
||||
on shut-down.
|
||||
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
|
||||
max. range based, as previous fix still left an margin of error between ADIS16505 sensors
|
||||
and L3GD20 sensors.
|
||||
|
@ -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) {
|
||||
switch (nextCommand) {
|
||||
@ -363,6 +366,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
tempBasebandBoard = calcTempVal(rawTempBasebandBoard);
|
||||
PoolReadGuard rg(&temperatureSet);
|
||||
temperatureSet.temperatureBasebandBoard = tempBasebandBoard;
|
||||
temperatureSet.temperatureBasebandBoard.setValid(true);
|
||||
if (debugMode) {
|
||||
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
|
||||
<< std::endl;
|
||||
@ -394,6 +398,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier);
|
||||
PoolReadGuard rg(&temperatureSet);
|
||||
temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier;
|
||||
temperatureSet.temperaturePowerAmplifier.setValid(true);
|
||||
if (debugMode) {
|
||||
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
|
||||
<< std::endl;
|
||||
@ -443,29 +448,6 @@ uint16_t SyrlinksHkHandler::convertHexStringToUint16(const char* fourChars) {
|
||||
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) {
|
||||
switch (*status) {
|
||||
case '0':
|
||||
@ -524,22 +506,25 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
|
||||
rxDataset.rxStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||
offset += 2;
|
||||
rxDataset.rxSensitivity =
|
||||
convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
convertHexStringTo32bit<uint32_t>(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
offset += 6;
|
||||
rxDataset.rxFrequencyShift =
|
||||
convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
convertHexStringTo32bit<int32_t>(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
offset += 6;
|
||||
rxDataset.rxIqPower = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset));
|
||||
offset += 4;
|
||||
rxDataset.rxAgcValue = convertHexStringToUint16(reinterpret_cast<const char*>(packet + offset));
|
||||
offset += 4;
|
||||
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;
|
||||
rxDataset.rxDemodN0 = convertHexStringToUint32(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
rxDataset.rxDemodN0 =
|
||||
convertHexStringTo32bit<uint32_t>(reinterpret_cast<const char*>(packet + offset), 6);
|
||||
offset += 6;
|
||||
rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||
|
||||
rxDataset.setValidity(true, true);
|
||||
if (debugMode) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
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);
|
||||
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
||||
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||
txDataset.txStatus.setValid(true);
|
||||
if (debugMode) {
|
||||
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value
|
||||
<< std::endl;
|
||||
@ -578,6 +564,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));
|
||||
txDataset.txWaveform.setValid(true);
|
||||
if (debugMode) {
|
||||
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value
|
||||
<< std::endl;
|
||||
@ -589,6 +576,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));
|
||||
txDataset.txAgcValue.setValid(true);
|
||||
if (debugMode) {
|
||||
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
|
||||
}
|
||||
@ -608,7 +596,7 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(syrlinks::RX_STATUS, new PoolEntry<uint8_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_AGC_VALUE, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(syrlinks::RX_DEMOD_EB, new PoolEntry<uint32_t>({0}));
|
||||
|
@ -147,15 +147,16 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
||||
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 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
|
||||
* @param status Pointer to the status information.
|
||||
@ -214,4 +215,33 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
||||
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_ */
|
||||
|
@ -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<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> 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);
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 033c8927c0d817e3e562d1d199d217f4bdf45ce7
|
||||
Subproject commit d23201466c279c410fd421b1584c46a439827ad5
|
Loading…
x
Reference in New Issue
Block a user