some minor tweaks

This commit is contained in:
Robin Müller 2023-03-29 17:38:38 +02:00
parent f695115102
commit 770fee0097
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
7 changed files with 23 additions and 16 deletions

View File

@ -21,9 +21,9 @@
#include <mission/acs/str/strHelpers.h> #include <mission/acs/str/strHelpers.h>
#include <mission/power/CspCookie.h> #include <mission/power/CspCookie.h>
#include <mission/system/acs/ImtqAssembly.h> #include <mission/system/acs/ImtqAssembly.h>
#include <mission/system/acs/StrAssembly.h>
#include <mission/system/fdir/StrFdir.h> #include <mission/system/fdir/StrFdir.h>
#include <mission/system/objects/CamSwitcher.h> #include <mission/system/objects/CamSwitcher.h>
#include <mission/system/acs/StrAssembly.h>
#include <mission/system/objects/SyrlinksAssembly.h> #include <mission/system/objects/SyrlinksAssembly.h>
#include <mission/tmtc/LiveTmTask.h> #include <mission/tmtc/LiveTmTask.h>
#include <mission/tmtc/PersistentLogTmStoreTask.h> #include <mission/tmtc/PersistentLogTmStoreTask.h>

View File

@ -65,7 +65,7 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
gpio::Levels papbBusyState = gpio::Levels::LOW; gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result; ReturnValue_t result;
uint32_t busyIdx = 0; uint32_t busyIdx = 0;
nextDelay.tv_nsec = 0; nextDelay.tv_nsec = FIRST_DELAY_PAPB_POLLING_NS;
while (true) { while (true) {
/** Check if PAPB interface is ready to receive data */ /** Check if PAPB interface is ready to receive data */
@ -87,9 +87,7 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
// Ignore signal handling here for now. // Ignore signal handling here for now.
nanosleep(&nextDelay, &remDelay); nanosleep(&nextDelay, &remDelay);
// Adaptive delay. // Adaptive delay.
if (nextDelay.tv_nsec == 0) { if (nextDelay.tv_nsec * 2 <= MAX_DELAY_PAPB_POLLING_NS) {
nextDelay.tv_nsec = FIRST_NON_NULL_DELAY_NS;
} else if (nextDelay.tv_nsec * 2 <= MAX_DELAY_PAPB_POLLING_NS) {
nextDelay.tv_nsec *= 2; nextDelay.tv_nsec *= 2;
} }
} }

View File

@ -76,7 +76,7 @@ class PapbVcInterface : public VirtualChannelIF {
*/ */
static const int DATA_REG_OFFSET = 256; static const int DATA_REG_OFFSET = 256;
static constexpr long int FIRST_NON_NULL_DELAY_NS = 10; static constexpr long int FIRST_DELAY_PAPB_POLLING_NS = 10;
static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40; static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40;
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
@ -89,7 +89,7 @@ class PapbVcInterface : public VirtualChannelIF {
std::string uioFile; std::string uioFile;
int mapNum = 0; int mapNum = 0;
mutable struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 0}; mutable struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 0};
const struct timespec BETWEEN_POLL_DELAY = {.tv_sec = 0, .tv_nsec = 5}; const struct timespec BETWEEN_POLL_DELAY = {.tv_sec = 0, .tv_nsec = 2};
mutable struct timespec remDelay; mutable struct timespec remDelay;
volatile uint32_t* vcBaseReg = nullptr; volatile uint32_t* vcBaseReg = nullptr;

View File

@ -165,9 +165,11 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
break; break;
} }
case EN_TRANSMITTER: { case EN_TRANSMITTER: {
enableTransmit();
if (mode == HasModesIF::MODE_OFF) { if (mode == HasModesIF::MODE_OFF) {
enableTransmit(true);
mode = HasModesIF::MODE_ON; mode = HasModesIF::MODE_ON;
} else {
enableTransmit(false);
} }
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
@ -205,9 +207,11 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
void CcsdsIpCoreHandler::updateLinkState() { linkState = LINK_UP; } void CcsdsIpCoreHandler::updateLinkState() { linkState = LINK_UP; }
void CcsdsIpCoreHandler::enableTransmit() { void CcsdsIpCoreHandler::enableTransmit(bool resetPtmeUpdateParams) {
// Reset PTME on each transmit enable. if (resetPtmeUpdateParams) {
updateBatPriorityFromParam(); // Reset PTME on each transmit enable.
updateBatPriorityFromParam();
}
#ifndef TE0720_1CFA #ifndef TE0720_1CFA
gpioIF->pullHigh(ptmeGpios.enableTxClock); gpioIF->pullHigh(ptmeGpios.enableTxClock);
gpioIF->pullHigh(ptmeGpios.enableTxData); gpioIF->pullHigh(ptmeGpios.enableTxData);
@ -243,7 +247,11 @@ void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
} }
}; };
if (mode == HasModesIF::MODE_ON) { if (mode == HasModesIF::MODE_ON) {
enableTransmit(); if (this->mode != HasModesIF::MODE_ON) {
enableTransmit(true);
} else {
enableTransmit(false);
}
if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) { if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) {
com::Datarate currentDatarate = com::getCurrentDatarate(); com::Datarate currentDatarate = com::getCurrentDatarate();
if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) { if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) {

View File

@ -172,7 +172,7 @@ class CcsdsIpCoreHandler : public SystemObject,
/** /**
* @brief Starts transmit timer and enables transmitter. * @brief Starts transmit timer and enables transmitter.
*/ */
void enableTransmit(); void enableTransmit(bool resetPtmeUpdateParams);
/** /**
* @brief Disables the transmitter by pulling the enable tx clock and tx data pin of the * @brief Disables the transmitter by pulling the enable tx clock and tx data pin of the

View File

@ -20,8 +20,9 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
if (not busy) { if (not busy) {
TaskFactory::delayTask(100); TaskFactory::delayTask(100);
} else if (dumpContext.vcBusyDuringDump) { } else if (dumpContext.vcBusyDuringDump) {
sif::debug << "VC busy, delaying" << std::endl;
// TODO: Might not be necessary // TODO: Might not be necessary
TaskFactory::delayTask(10); TaskFactory::delayTask(2);
} }
} }
} }

View File

@ -115,10 +115,10 @@ ReturnValue_t TmStoreTaskBase::handleOneDump(PersistentTmStoreWithTmQueue& store
} else { } else {
// The PTME might be at full load, so it might sense to delay for a bit to let it do // The PTME might be at full load, so it might sense to delay for a bit to let it do
// its work until some more bandwidth is available. Set a flag here so the upper layer can // its work until some more bandwidth is available. Set a flag here so the upper layer can
// do ths. // do this.
dumpContext.vcBusyDuringDump = true; dumpContext.vcBusyDuringDump = true;
dumpContext.ptmeBusyCounter++; dumpContext.ptmeBusyCounter++;
if (dumpContext.ptmeBusyCounter == 100) { if (dumpContext.ptmeBusyCounter == 200) {
// If this happens, something is probably wrong. // If this happens, something is probably wrong.
sif::warning << "PTME busy for longer period. Cancelling dump" << std::endl; sif::warning << "PTME busy for longer period. Cancelling dump" << std::endl;
cancelDump(dumpContext, store, channel.isTxOn()); cancelDump(dumpContext, store, channel.isTxOn());