write lcl config register

This commit is contained in:
Robin Müller 2022-03-30 16:29:58 +02:00
parent 61a7f71e80
commit 53aca633b8
4 changed files with 35 additions and 3 deletions

View File

@ -326,6 +326,7 @@ void PdecHandler::handleNewTc() {
printTC(tcLength);
#endif /* OBSW_DEBUG_PDEC_HANDLER */
#if OBSW_TC_FROM_PDEC == 1
store_address_t storeId;
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
if (result != RETURN_OK) {
@ -343,6 +344,7 @@ void PdecHandler::handleNewTc() {
tcStore->deleteData(storeId);
return;
}
#endif /* OBSW_TC_FROM_PDEC == 1 */
return;
}

View File

@ -101,6 +101,14 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
rawPacket = commandBuffer;
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;
return RETURN_OK;
}
case (SYRLINKS::READ_TX_STATUS): {
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
rawPacketLen = readTxStatus.size();
@ -144,8 +152,10 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
false, true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::SET_TX_MODE_CW, 1, nullptr, SYRLINKS::ACK_SIZE, false,
true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::WRITE_LCL_CONFIG, 2, nullptr, SYRLINKS::ACK_SIZE, false,
this->insertInCommandAndReplyMap(SYRLINKS::WRITE_LCL_CONFIG, 1, nullptr, SYRLINKS::ACK_SIZE, false,
true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::READ_LCL_CONFIG, 1, nullptr,
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_STATUS, 1, &txDataset,
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_WAVEFORM, 1, &txDataset,
@ -241,6 +251,15 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
}
parseRxStatusRegistersReply(packet);
break;
case (SYRLINKS::READ_LCL_CONFIG):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) {
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply "
<< "has invalid crc" << std::endl;
return CRC_FAILURE;
}
parseLclConfigReply(packet);
break;
case (SYRLINKS::READ_TX_STATUS):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) {
@ -427,6 +446,13 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
#endif
}
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: "
<< static_cast<unsigned int>(lclConfig) << std::endl;
}
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;

View File

@ -68,11 +68,12 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
std::string setTxModeModulation = "<W04:4001:4D69>";
std::string setTxModeCw = "<W04:4010:4968>";
std::string writeLclConfig = "<W04:0703:F320>";
std::string writeLclConfig = "<W04:0707:3FE4>";
std::string readTxStatus = "<R02:40:7555>";
std::string readTxWaveform = "<R02:44:B991>";
std::string readTxAgcValueHighByte = "<R02:46:DFF3>";
std::string readTxAgcValueLowByte = "<R02:47:ECC2>";
std::string readLclConfig = "<R02:07:3002>";
/**
* In some cases it is not possible to extract from the received reply the information about
@ -162,6 +163,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
*/
void parseRxStatusRegistersReply(const uint8_t* packet);
void parseLclConfigReply(const uint8_t* packet);
/**
* @brief This function writes the read tx status register to the txStatusDataset.
* @param packet Pointer to the received packet.

View File

@ -18,7 +18,8 @@ static const DeviceCommandId_t READ_TX_STATUS = 0x07;
static const DeviceCommandId_t READ_TX_WAVEFORM = 0x08;
static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 0x09;
static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 0x0A;
static const DeviceCommandId_t WRITE_LCL_CONFIG = 0x0B;
static const DeviceCommandId_t WRITE_LCL_CONFIG = 11;
static const DeviceCommandId_t READ_LCL_CONFIG = 12;
/** Size of a simple transmission success response */
static const uint8_t ACK_SIZE = 12;