Syrlinks Update #353

Merged
muellerr merged 24 commits from refactor_syrlinks into develop 2023-01-26 19:18:33 +01:00
4 changed files with 27 additions and 20 deletions
Showing only changes of commit 4ad6584782 - Show all commits

View File

@ -3,7 +3,11 @@
namespace com {
enum class Datarate: uint8_t { LOW_RATE_MODULATION_BPSK, HIGH_RATE_MODULATION_0QPSK, NUM_DATARATES };
enum class Datarate : uint8_t {
LOW_RATE_MODULATION_BPSK,
HIGH_RATE_MODULATION_0QPSK,
NUM_DATARATES
};
}

View File

@ -649,10 +649,12 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE));
switch (rememberCommandId) {
case (syrlinks::WRITE_LCL_CONFIG): {
if (result != returnvalue::OK) {
internalState = InternalState::OFF;
} else if (result == returnvalue::OK) {
commandExecuted = true;
if (isTransitionalMode()) {
if (result != returnvalue::OK) {
internalState = InternalState::OFF;
} else if (result == returnvalue::OK) {
commandExecuted = true;
}
}
break;
}
@ -681,22 +683,25 @@ ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t sub
}
ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues, uint16_t startAtIndex) {
if((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
if(newValues->getSerializedSize() != 1) {
ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues,
uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
if (newValues->getSerializedSize() != 1) {
return HasParametersIF::INVALID_VALUE;
}
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if(result != returnvalue::OK) {
if (result != returnvalue::OK) {
return result;
}
if(newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(&datarateCfgRaw);
}
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues, startAtIndex);
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex);
}
void SyrlinksHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
@ -742,7 +747,8 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
} else if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
} else if (datarateCfgRaw ==
static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}

View File

@ -53,10 +53,9 @@ class SyrlinksHandler : public DeviceHandlerBase {
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
// Parameter IF
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
@ -107,7 +106,7 @@ class SyrlinksHandler : public DeviceHandlerBase {
const power::Switch_t powerSwitch = power::NO_SWITCH;
// Use uint8_t for compatibility with parameter interface
uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
//com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
// com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false;
uint8_t agcValueHighByte = 0;

View File

@ -6,9 +6,7 @@
namespace syrlinks {
enum class ParameterId: uint8_t {
DATARATE = 0
};
enum class ParameterId : uint8_t { DATARATE = 0 };
enum Submode {
DEFAULT,