countdown based timeout
This commit is contained in:
parent
42194abb4a
commit
8610e48b19
10
README.md
10
README.md
@ -1197,7 +1197,7 @@ in the same way.
|
||||
|
||||
# <a id="coding-style"></a> Coding Style
|
||||
* the formatting is based on the clang-format tools
|
||||
## Setting up eclipse auto-fromatter with clang-format
|
||||
## Setting auto-fromatter with clang-format in Xilinx SDK
|
||||
1. Help → Install New Software → Add
|
||||
2. In location insert the link http://www.cppstyle.com/luna
|
||||
3. The software package CppStyle should now be available for installation
|
||||
@ -1206,3 +1206,11 @@ in the same way.
|
||||
6. Insert the path to the clang-format executable
|
||||
7. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
||||
8. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
||||
|
||||
## Setting up auto-fromatter with clang-format in eclipse
|
||||
1. Help → Eclipse market place → Search for "Cppstyle" and install
|
||||
2. On windows download the clang-formatting tools from https://llvm.org/builds/. On linux clang-format can be installed with the package manager.
|
||||
3. Navigate to Preferences → C/C++ → CppStyle
|
||||
4. Insert the path to the clang-format executable
|
||||
5. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
||||
6. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
||||
|
@ -173,7 +173,7 @@ void initmission::initTasks() {
|
||||
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
||||
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 1.0, missedDeadlineFunc);
|
||||
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 9f7b9be800402215e97759eb35d4c40a484d1f68
|
||||
Subproject commit 900ef5b9124063b5eec88de19d851006b2e1e601
|
@ -268,7 +268,7 @@ static const uint32_t ADC_REPORT_SET_ID = REQUEST_ADC_REPORT;
|
||||
namespace recv_timeout {
|
||||
// Erase memory can require up to 60 seconds for execution
|
||||
static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 70000;
|
||||
} // namespace recv_timeout
|
||||
|
||||
/**
|
||||
@ -1163,7 +1163,7 @@ class WriteMemory : public SupvTcSpacePacket {
|
||||
SerializeIF::Endianness::BIG);
|
||||
std::memcpy(dataFieldPtr, updateData, length);
|
||||
if (length % 2 != 0) {
|
||||
this->setPacketDataLength(this->getFullSize() + 1);
|
||||
this->setPacketDataLength(length + sizeof(CCSDSPrimaryHeader) + CRC_SIZE - 1);
|
||||
// The data field must be two bytes aligned. Thus, in case the number of bytes to write is odd
|
||||
// a value of zero is added here
|
||||
*(dataFieldPtr + length + 1) = 0;
|
||||
|
@ -402,7 +402,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
|
||||
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
|
||||
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(EXE_REPORT, 50, nullptr, SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionTimeout);
|
||||
this->insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
|
||||
this->insertInReplyMap(BOOT_STATUS_REPORT, 3, &bootStatusReport, SIZE_BOOT_STATUS_REPORT);
|
||||
this->insertInReplyMap(LATCHUP_REPORT, 3, &latchupStatusReport, SIZE_LATCHUP_STATUS_REPORT);
|
||||
@ -546,6 +546,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
|
||||
setExecutionTimeout(command->first);
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
@ -795,6 +797,19 @@ void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
|
||||
using namespace supv;
|
||||
switch(command) {
|
||||
case FIRST_MRAM_DUMP:
|
||||
case CONSECUTIVE_MRAM_DUMP:
|
||||
executionTimeout.setTimeout(MRAM_DUMP_EXECUTION_TIMEOUT);
|
||||
break;
|
||||
default:
|
||||
executionTimeout.setTimeout(EXECUTION_DEFAULT_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
||||
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
||||
@ -1237,7 +1252,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||
|
||||
DeviceReplyIter iter = deviceReplyMap.find(nextReplyId);
|
||||
if (iter != deviceReplyMap.end()) {
|
||||
if (iter->second.delayCycles == 0) {
|
||||
if ((iter->second.delayCycles == 0 && iter->second.countdown == nullptr) ||
|
||||
(not iter->second.active && iter->second.countdown != nullptr)) {
|
||||
/* Reply inactive */
|
||||
return replyLen;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "fsfw_hal/linux/gpio/Gpio.h"
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
|
||||
#include "PlocSupvHelper.h"
|
||||
@ -78,6 +79,10 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||
static const uint8_t EXE_STATUS_OFFSET = 10;
|
||||
static const uint8_t SIZE_NULL_TERMINATOR = 1;
|
||||
// 5 s
|
||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||
// 30 s
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
|
||||
|
||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||
|
||||
@ -128,6 +133,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
// Supervisor helper class currently executing a command
|
||||
bool plocSupvHelperExecuting = false;
|
||||
|
||||
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
||||
|
||||
/**
|
||||
* @brief Adjusts the timeout of the execution report dependent on command
|
||||
*/
|
||||
void setExecutionTimeout(DeviceCommandId_t command);
|
||||
|
||||
/**
|
||||
* @brief Handles event messages received from the supervisor helper
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@ CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t
|
||||
gpioIF(gpioIF),
|
||||
enTxClock(enTxClock),
|
||||
enTxData(enTxData),
|
||||
TRANSMITTER_TIMEOUT(transmitterTimeout) {
|
||||
transmitterTimeout(transmitterTimeout) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||
eventQueue =
|
||||
@ -312,7 +312,7 @@ void CCSDSHandler::enableTransmit() {
|
||||
// Transmitter already enabled
|
||||
return;
|
||||
}
|
||||
transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT);
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
#ifndef TE0720_1CFA
|
||||
gpioIF->pullHigh(enTxClock);
|
||||
gpioIF->pullHigh(enTxData);
|
||||
|
@ -133,9 +133,9 @@ class CCSDSHandler : public SystemObject,
|
||||
gpioId_t enTxClock = gpio::NO_GPIO;
|
||||
gpioId_t enTxData = gpio::NO_GPIO;
|
||||
|
||||
// syrlinks must not be transmitting more than 15 minutes (according to datasheet)
|
||||
// Value can be configured via CTOR argument to allow test setups
|
||||
const uint32_t TRANSMITTER_TIMEOUT = 900000; // 900000 ms = 15 min
|
||||
// Syrlinks must not be transmitting more than 15 minutes (according to datasheet)
|
||||
// Value initialized by constructor argument
|
||||
const uint32_t transmitterTimeout = 0;
|
||||
|
||||
// Countdown to disable transmitter after 15 minutes
|
||||
Countdown transmitterCountdown;
|
||||
|
Loading…
Reference in New Issue
Block a user