meier/syrlinks #199

Merged
muellerr merged 11 commits from meier/syrlinks into develop 2022-04-06 12:09:51 +02:00
Showing only changes of commit 40403b81c3 - Show all commits

View File

@ -11,7 +11,7 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
txDataset(this),
temperatureSet(this),
powerSwitch(powerSwitch) {
if (comCookie == NULL) {
if (comCookie == nullptr) {
sif::warning << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
}
}
@ -78,14 +78,14 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
<< "command id" << std::endl;
break;
}
return buildCommandFromCommand(*id, NULL, 0);
return buildCommandFromCommand(*id, nullptr, 0);
}
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
switch (startupState) {
case StartupState::ENABLE_TEMPERATURE_PROTECTION: {
*id = syrlinks::WRITE_LCL_CONFIG;
return HasReturnvaluesIF::RETURN_OK;
return buildCommandFromCommand(*id, nullptr, 0);
}
default:
break;
@ -167,10 +167,12 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
}
case (syrlinks::ENABLE_DEBUG): {
debug = true;
rawPacketLen = 0;
return RETURN_OK;
}
case (syrlinks::DISABLE_DEBUG): {
debug = false;
rawPacketLen = 0;
return RETURN_OK;
}
default:
@ -469,7 +471,7 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
case '0':
return RETURN_OK;
case '1':
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart faming or parity error" << std::endl;
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart framing or parity error" << std::endl;
return UART_FRAMIN_OR_PARITY_ERROR_ACK;
case '2':
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Bad character detected" << std::endl;
@ -555,8 +557,10 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
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;
if (debug) {
sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: "
<< static_cast<unsigned int>(lclConfig) << std::endl;
}
}
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
@ -564,8 +568,10 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_DEBUG_SYRLINKS == 1
if (debug) {
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value
<< std::endl;
}
#endif
}
@ -574,8 +580,10 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_DEBUG_SYRLINKS == 1
if (debug) {
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value
<< std::endl;
}
#endif
}
@ -585,7 +593,9 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
txDataset.txAgcValue = agcValueHighByte << 8 |
convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
if (debug) {
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
}
#endif
}
@ -597,7 +607,7 @@ void SyrlinksHkHandler::parseAgcHighByte(const uint8_t* packet) {
void SyrlinksHkHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
@ -635,7 +645,7 @@ ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
}
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
command.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0);
command.copy(reinterpret_cast<char*>(commandBuffer), command.size(), 0);
rawPacketLen = command.size();
rememberCommandId = commandId;
rawPacket = commandBuffer;