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

@ -19,17 +19,17 @@ SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, Cookie
SyrlinksHandler::~SyrlinksHandler() = default;
void SyrlinksHandler::doStartUp() {
if(internalState != 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) {
if (internalState == InternalState::OFF) {
internalState = InternalState::ENABLE_TEMPERATURE_PROTECTION;
commandExecuted = false;
}
if(internalState == InternalState::ENABLE_TEMPERATURE_PROTECTION) {
if(commandExecuted) {
if (internalState == InternalState::ENABLE_TEMPERATURE_PROTECTION) {
if (commandExecuted) {
// Got to normal mode immediately.
setMode(_MODE_TO_NORMAL);
internalState = InternalState::IDLE;
@ -222,10 +222,10 @@ 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::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false,
true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_0QPSK, 1, nullptr, syrlinks::ACK_SIZE, false,
true, syrlinks::ACK_REPLY);
this->insertInCommandAndReplyMap(syrlinks::SET_WAVEFORM_BPSK, 1, nullptr, syrlinks::ACK_SIZE,
false, true, syrlinks::ACK_REPLY);
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);
this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr,
@ -661,8 +661,8 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
}
break;
}
case(syrlinks::SET_WAVEFORM_BPSK):
case(syrlinks::SET_WAVEFORM_0QPSK):
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): {
@ -700,47 +700,54 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
setMode(tgtMode);
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) {
switch (getSubmode()) {
case (syrlinks::Submode::TX_MODULATION_LOW_DATARATE): {
if (internalState == InternalState::IDLE) {
commandExecuted = false;
internalState = InternalState::SELECT_MODULATION_BPSK;
case (syrlinks::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (datarateCfg == com::Datarate::LOW_RATE_MODULATION_BPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
if (internalState == InternalState::SELECT_MODULATION_BPSK) {
if (commandExecuted) {
internalState = InternalState::SET_TX_MODULATION;
commandExecuted = false;
}
}
if (internalState == InternalState::SET_TX_MODULATION) {
if (commandExecuted) {
commandDone();
} else if (datarateCfg == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
}
break;
}
case (syrlinks::Submode::TX_MODULATION_HIGH_DATARATE): {
if (internalState == InternalState::IDLE) {
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();
case (syrlinks::Submode::RX_AND_TX_LOW_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
}
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) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;
@ -753,7 +760,7 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}
break;
}
case (syrlinks::Submode::TX_CW): {
case (syrlinks::Submode::RX_AND_TX_CW): {
if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;

View File

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

View File

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

2
tmtc

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