From 744f689556e721e4a81ba8a7466450a2af332503 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 Jan 2023 12:21:49 +0100 Subject: [PATCH] this should be the complete impl for new submodes --- mission/devices/SyrlinksHandler.cpp | 66 +++++++++---------- mission/devices/SyrlinksHandler.h | 4 +- .../devicedefinitions/SyrlinksDefinitions.h | 4 +- tmtc | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/mission/devices/SyrlinksHandler.cpp b/mission/devices/SyrlinksHandler.cpp index f4ea46aa..1d5dbe64 100644 --- a/mission/devices/SyrlinksHandler.cpp +++ b/mission/devices/SyrlinksHandler.cpp @@ -19,18 +19,21 @@ SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, Cookie SyrlinksHandler::~SyrlinksHandler() = default; void SyrlinksHandler::doStartUp() { - switch (internalState) { - case InternalState::OFF: { + if(internalState != InternalState::OFF) { + sif::error << "SyrlinksHandler::doStartUp: Not in internal OFF mode, possible config error" + << std::endl; + internalState = InternalState::OFF; + } + if(internalState == InternalState::OFF) { internalState = InternalState::ENABLE_TEMPERATURE_PROTECTION; - break; - } - case InternalState::IDLE: { - setMode(_MODE_TO_ON); commandExecuted = false; - break; + } + if(internalState == InternalState::ENABLE_TEMPERATURE_PROTECTION) { + if(commandExecuted) { + setMode(_MODE_TO_ON); + internalState = InternalState::IDLE; + commandExecuted = false; } - default: - break; } } @@ -97,6 +100,14 @@ ReturnValue_t SyrlinksHandler::buildTransitionDeviceCommand(DeviceCommandId_t* i *id = syrlinks::SET_TX_MODE_MODULATION; return buildCommandFromCommand(*id, nullptr, 0); } + case InternalState::SELECT_MODULATION_BPSK: { + *id = syrlinks::SET_WAVEFORM_BPSK; + return buildCommandFromCommand(*id, nullptr, 0); + } + case InternalState::SELECT_MODULATION_0QPSK: { + *id = syrlinks::SET_WAVEFORM_0QPSK; + return buildCommandFromCommand(*id, nullptr, 0); + } case InternalState::SET_TX_CW: { *id = syrlinks::SET_TX_MODE_CW; return buildCommandFromCommand(*id, nullptr, 0); @@ -175,11 +186,11 @@ ReturnValue_t SyrlinksHandler::buildCommandFromCommand(DeviceCommandId_t deviceC prepareCommand(tempBasebandBoardLowByte, deviceCommand); return returnvalue::OK; } - case (syrlinks::CONFIG_BPSK): { + case (syrlinks::SET_WAVEFORM_BPSK): { prepareCommand(configBPSK, deviceCommand); return returnvalue::OK; } - case (syrlinks::CONFIG_OQPSK): { + case (syrlinks::SET_WAVEFORM_0QPSK): { prepareCommand(configOQPSK, deviceCommand); return returnvalue::OK; } @@ -210,9 +221,9 @@ void SyrlinksHandler::fillCommandAndReplyMap() { true, syrlinks::ACK_REPLY); this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE, false, true, syrlinks::ACK_REPLY); - this->insertInCommandAndReplyMap(syrlinks::CONFIG_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false, + this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false, true, syrlinks::ACK_REPLY); - this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE, false, + this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_0QPSK, 1, nullptr, syrlinks::ACK_SIZE, false, true, syrlinks::ACK_REPLY); this->insertInCommandMap(syrlinks::ENABLE_DEBUG); this->insertInCommandMap(syrlinks::DISABLE_DEBUG); @@ -645,27 +656,16 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) { if (result != returnvalue::OK) { internalState = InternalState::OFF; } else if (result == returnvalue::OK) { - internalState = InternalState::IDLE; - } - break; - } - case (syrlinks::SET_TX_MODE_STANDBY): { - if (result == returnvalue::OK) { - internalState = InternalState::IDLE; - commandExecuted = true; - } - break; - } - case (syrlinks::SET_TX_MODE_MODULATION): { - if (result == returnvalue::OK) { - internalState = InternalState::IDLE; commandExecuted = true; } break; } + case(syrlinks::SET_WAVEFORM_BPSK): + case(syrlinks::SET_WAVEFORM_0QPSK): + case (syrlinks::SET_TX_MODE_STANDBY): + case (syrlinks::SET_TX_MODE_MODULATION): case (syrlinks::SET_TX_MODE_CW): { - if (result == returnvalue::OK) { - internalState = InternalState::IDLE; + if (result == returnvalue::OK and isTransitionalMode()) { commandExecuted = true; } break; @@ -704,9 +704,9 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { case (syrlinks::Submode::TX_MODULATION_LOW_DATARATE): { if (internalState == InternalState::IDLE) { commandExecuted = false; - internalState = InternalState::SELECT_MODULATION_QPSK; + internalState = InternalState::SELECT_MODULATION_BPSK; } - if (internalState == InternalState::SELECT_MODULATION_QPSK) { + if (internalState == InternalState::SELECT_MODULATION_BPSK) { if (commandExecuted) { internalState = InternalState::SET_TX_MODULATION; commandExecuted = false; @@ -723,9 +723,9 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { case (syrlinks::Submode::TX_MODULATION_HIGH_DATARATE): { if (internalState == InternalState::IDLE) { commandExecuted = false; - internalState = InternalState::SELECT_MODULATION_0BPSK; + internalState = InternalState::SELECT_MODULATION_0QPSK; } - if (internalState == InternalState::SELECT_MODULATION_0BPSK) { + if (internalState == InternalState::SELECT_MODULATION_0QPSK) { if (commandExecuted) { internalState = InternalState::SET_TX_MODULATION; commandExecuted = false; diff --git a/mission/devices/SyrlinksHandler.h b/mission/devices/SyrlinksHandler.h index b6ca35e7..c2405502 100644 --- a/mission/devices/SyrlinksHandler.h +++ b/mission/devices/SyrlinksHandler.h @@ -113,8 +113,8 @@ class SyrlinksHandler : public DeviceHandlerBase { enum class InternalState { OFF, ENABLE_TEMPERATURE_PROTECTION, - SELECT_MODULATION_0BPSK, - SELECT_MODULATION_QPSK, + SELECT_MODULATION_BPSK, + SELECT_MODULATION_0QPSK, SET_TX_MODULATION, SET_TX_CW, SET_TX_STANDBY, diff --git a/mission/devices/devicedefinitions/SyrlinksDefinitions.h b/mission/devices/devicedefinitions/SyrlinksDefinitions.h index 755dc9dc..5b904835 100644 --- a/mission/devices/devicedefinitions/SyrlinksDefinitions.h +++ b/mission/devices/devicedefinitions/SyrlinksDefinitions.h @@ -40,9 +40,9 @@ static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_HIGH_BYTE = 13; static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15; static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16; -static const DeviceCommandId_t CONFIG_OQPSK = 17; +static const DeviceCommandId_t SET_WAVEFORM_0QPSK = 17; // After startup syrlinks always in BSPK configuration -static const DeviceCommandId_t CONFIG_BPSK = 18; +static const DeviceCommandId_t SET_WAVEFORM_BPSK = 18; static const DeviceCommandId_t ENABLE_DEBUG = 20; static const DeviceCommandId_t DISABLE_DEBUG = 21; diff --git a/tmtc b/tmtc index 8a7880bc..c36c7ca5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8a7880bc35d1069577b7e0427c1f45c54ac5241c +Subproject commit c36c7ca5bbe12b74f096414383eedfc16576a9d2