some dumb bug
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-01-27 20:23:55 +01:00
parent 7bbf40a5ab
commit 8f7ff3da7c
4 changed files with 80 additions and 11 deletions

View File

@ -622,7 +622,7 @@ void SyrlinksHandler::parseAgcHighByte(const uint8_t* packet) {
void SyrlinksHandler::setNormalDatapoolEntriesInvalid() {} void SyrlinksHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2000; } uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2500; }
ReturnValue_t SyrlinksHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t SyrlinksHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {

View File

@ -44,11 +44,21 @@ auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = std::make_pair(
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair( auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>()); (::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE =
std::make_pair(::com::Submode::RX_AND_TX_DEFAULT_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
namespace { namespace {
void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh); void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh); void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh); void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxDefaultRateSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace } // namespace
@ -57,6 +67,7 @@ void satsystem::com::init() {
buildRxOnlySequence(SUBSYSTEM, entry); buildRxOnlySequence(SUBSYSTEM, entry);
buildTxAndRxLowRateSequence(SUBSYSTEM, entry); buildTxAndRxLowRateSequence(SUBSYSTEM, entry);
buildTxAndRxHighRateSequence(SUBSYSTEM, entry); buildTxAndRxHighRateSequence(SUBSYSTEM, entry);
buildTxAndRxDefaultRateSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY); SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY);
} }
@ -99,7 +110,7 @@ void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh) {
// Build TX OFF sequence // Build TX OFF sequence
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TGT.first, 0, true); ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_0.first, 0, true); ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_0.first, 0, false);
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_1.first, 0, false); ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_ONLY.first, &COM_SEQUENCE_RX_ONLY.second, check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_ONLY.first, &COM_SEQUENCE_RX_ONLY.second,
COM_SEQUENCE_RX_ONLY.first)), COM_SEQUENCE_RX_ONLY.first)),
@ -151,7 +162,7 @@ void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh) {
// Build TX and RX low datarate sequence // Build TX and RX low datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first, 0, true); ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first, 0, true); ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first, 0, false); ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first, 0, true);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_LOW_RATE.first, check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_LOW_RATE.first,
&COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, &COM_SEQUENCE_RX_AND_TX_LOW_RATE.second,
COM_SEQUENCE_RX_ONLY.first)), COM_SEQUENCE_RX_ONLY.first)),
@ -177,7 +188,7 @@ void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh) {
check(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build RX and TX low datarate table. // Build RX and TX high datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE, iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second); COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second);
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH), iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
@ -186,14 +197,14 @@ void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh) {
&COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second)), &COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second)),
ctxc); ctxc);
// Build TX and RX low datarate transition 0, switch CCSDS handler first // Build TX and RX high datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH), iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second); COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first, check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second)), &COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second)),
ctxc); ctxc);
// Build TX and RX low transition 1 // Build TX and RX high transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE, iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second); COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first, check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first,
@ -212,4 +223,59 @@ void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh) {
ctxc); ctxc);
} }
void buildTxAndRxDefaultRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxAndRxDefaultRateSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX and TX default datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_DEFAULT_DATARATE,
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second);
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_DEFAULT),
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second)),
ctxc);
// Build TX and RX low datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_DEFAULT),
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.second)),
ctxc);
// Build TX and RX default transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_DEFAULT_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX default datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.first, 0,
true);
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.first, 0,
true);
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.first, 0,
false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first,
&COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
} // namespace } // namespace

View File

@ -368,7 +368,8 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
uint32_t* msToReachTheMode) { uint32_t* msToReachTheMode) {
if (mode == HasModesIF::MODE_ON) { if (mode == HasModesIF::MODE_ON) {
if (submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH) and if (submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH) and
submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) { submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW) and
submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) {
return HasModesIF::INVALID_SUBMODE; return HasModesIF::INVALID_SUBMODE;
} }
} else if (mode != HasModesIF::MODE_OFF) { } else if (mode != HasModesIF::MODE_OFF) {
@ -382,13 +383,13 @@ void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
auto rateHigh = [&]() { auto rateHigh = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS); ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON; this->mode = HasModesIF::MODE_ON;
} }
}; };
auto rateLow = [&]() { auto rateLow = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS); ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON; this->mode = HasModesIF::MODE_ON;
} }
}; };
if (mode == HasModesIF::MODE_ON) { if (mode == HasModesIF::MODE_ON) {
@ -405,10 +406,12 @@ void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
} else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) { } else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) {
rateLow(); rateLow();
} }
} else if (mode == HasModesIF::MODE_OFF) { } else if (mode == HasModesIF::MODE_OFF) {
disableTransmit(); disableTransmit();
mode = HasModesIF::MODE_OFF; this->mode = HasModesIF::MODE_OFF;
} }
this->submode = submode;
modeHelper.modeChanged(mode, submode); modeHelper.modeChanged(mode, submode);
announceMode(false); announceMode(false);
} }

2
tmtc

@ -1 +1 @@
Subproject commit f4702eb70185e34b2812e568a068ef70ac55a115 Subproject commit 39a94974940a7b77da1f3ed572cf93e5e21574f6