add new submode for default datarate handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-01-26 14:00:39 +01:00
parent 9410902454
commit 4dca9f21d4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 69 additions and 49 deletions

10
mission/comDefs.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef MISSION_COMDEFS_H_
#define MISSION_COMDEFS_H_
namespace com {
enum class Datarate { LOW_RATE_MODULATION_BPSK, HIGH_RATE_MODULATION_0QPSK };
}
#endif /* MISSION_COMDEFS_H_ */

View File

@ -222,10 +222,10 @@ void SyrlinksHandler::fillCommandAndReplyMap() {
true, syrlinks::ACK_REPLY); true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE, this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false, this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE,
true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_0QPSK, 1, nullptr, syrlinks::ACK_SIZE, false, this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_0QPSK, 1, nullptr, syrlinks::ACK_SIZE,
true, syrlinks::ACK_REPLY); false, true, syrlinks::ACK_REPLY);
this->insertInCommandMap(syrlinks::ENABLE_DEBUG); this->insertInCommandMap(syrlinks::ENABLE_DEBUG);
this->insertInCommandMap(syrlinks::DISABLE_DEBUG); this->insertInCommandMap(syrlinks::DISABLE_DEBUG);
this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr, this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr,
@ -700,47 +700,54 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
setMode(tgtMode); setMode(tgtMode);
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
}; };
auto txOnHandler = [&](InternalState selMod) {
if (internalState == InternalState::IDLE) {
commandExecuted = false;
internalState = selMod;
}
// Select modulation first (BPSK or 0QPSK).
if (internalState == selMod) {
if (commandExecuted) {
internalState = InternalState::SET_TX_MODULATION;
commandExecuted = false;
}
}
// Now go into modulation mode.
if (internalState == InternalState::SET_TX_MODULATION) {
if (commandExecuted) {
commandDone();
return true;
}
}
return false;
};
if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) { if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) {
switch (getSubmode()) { switch (getSubmode()) {
case (syrlinks::Submode::TX_MODULATION_LOW_DATARATE): { case (syrlinks::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (internalState == InternalState::IDLE) { if (datarateCfg == com::Datarate::LOW_RATE_MODULATION_BPSK) {
commandExecuted = false; if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
internalState = InternalState::SELECT_MODULATION_BPSK; return;
} }
if (internalState == InternalState::SELECT_MODULATION_BPSK) { } else if (datarateCfg == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
if (commandExecuted) { if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
internalState = InternalState::SET_TX_MODULATION;
commandExecuted = false;
}
}
if (internalState == InternalState::SET_TX_MODULATION) {
if (commandExecuted) {
commandDone();
return; return;
} }
} }
break; break;
} }
case (syrlinks::Submode::TX_MODULATION_HIGH_DATARATE): { case (syrlinks::Submode::RX_AND_TX_LOW_DATARATE): {
if (internalState == InternalState::IDLE) { if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
commandExecuted = false;
internalState = InternalState::SELECT_MODULATION_0QPSK;
}
if (internalState == InternalState::SELECT_MODULATION_0QPSK) {
if (commandExecuted) {
internalState = InternalState::SET_TX_MODULATION;
commandExecuted = false;
}
}
if (internalState == InternalState::SET_TX_MODULATION) {
if (commandExecuted) {
commandDone();
return; return;
} }
}
break; break;
} }
case (syrlinks::Submode::TX_STANDBY): { case (syrlinks::Submode::RX_AND_TX_HIGH_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
break;
}
case (syrlinks::Submode::RX_ONLY): {
if (internalState == InternalState::IDLE) { if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY; internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false; commandExecuted = false;
@ -753,7 +760,7 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
} }
break; break;
} }
case (syrlinks::Submode::TX_CW): { case (syrlinks::Submode::RX_AND_TX_CW): {
if (internalState == InternalState::IDLE) { if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY; internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false; commandExecuted = false;

View File

@ -7,6 +7,7 @@
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/timemanager/Countdown.h" #include "fsfw/timemanager/Countdown.h"
#include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/gpio/Gpio.h"
#include "mission/comDefs.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
@ -99,6 +100,7 @@ class SyrlinksHandler : public DeviceHandlerBase {
syrlinks::TemperatureSet temperatureSet; syrlinks::TemperatureSet temperatureSet;
const power::Switch_t powerSwitch = power::NO_SWITCH; const power::Switch_t powerSwitch = power::NO_SWITCH;
com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false; bool debugMode = false;
uint8_t agcValueHighByte = 0; uint8_t agcValueHighByte = 0;

View File

@ -8,10 +8,11 @@ namespace syrlinks {
enum Submode { enum Submode {
DEFAULT, DEFAULT,
TX_STANDBY, RX_ONLY,
TX_MODULATION_LOW_DATARATE, RX_AND_TX_DEFAULT_DATARATE,
TX_MODULATION_HIGH_DATARATE, RX_AND_TX_LOW_DATARATE,
TX_CW, RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES NUM_SUBMODES
}; };

2
tmtc

@ -1 +1 @@
Subproject commit c36c7ca5bbe12b74f096414383eedfc16576a9d2 Subproject commit 99d5ed014bc3264b621c066ba0fb035b1037a637