Merge pull request 'Increase configurability of PusServiceBase' (#169) from psb-update into develop

Reviewed-on: eive/fsfw#169
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2024-02-26 13:56:46 +01:00
commit 0d4a862c1a
6 changed files with 18 additions and 14 deletions

View File

@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Assert that `FixedArrayList` is larger than 0 at compile time.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740
- Health functions are virtual now.
- PUS Service Base request queue depth and maximum number of handled packets per cycle is now
configurable.
# [v6.0.0] 2023-02-10

View File

@ -155,8 +155,7 @@ double QuaternionOperations::getAngle(const double* quaternion, bool abs) {
}
void QuaternionOperations::rotationFromQuaternions(const double qNew[4], const double qOld[4],
const double timeDelta,
double rotRate[3]) {
const double timeDelta, double rotRate[3]) {
double qOldInv[4] = {0, 0, 0, 0};
double qDelta[4] = {0, 0, 0, 0};

View File

@ -40,7 +40,7 @@ void PusServiceBase::setTaskIF(PeriodicTaskIF* taskHandle_) { this->taskHandle =
void PusServiceBase::handleRequestQueue() {
TmTcMessage message;
ReturnValue_t result;
for (uint8_t count = 0; count < PUS_SERVICE_MAX_RECEPTION; count++) {
for (uint8_t count = 0; count < psbParams.maxPacketsPerCycle; count++) {
ReturnValue_t status = psbParams.reqQueue->receiveMessage(&message);
if (status == MessageQueueIF::EMPTY) {
break;
@ -98,7 +98,7 @@ ReturnValue_t PusServiceBase::initialize() {
}
if (psbParams.reqQueue == nullptr) {
ownedQueue = true;
psbParams.reqQueue = QueueFactory::instance()->createMessageQueue(PSB_DEFAULT_QUEUE_DEPTH);
psbParams.reqQueue = QueueFactory::instance()->createMessageQueue(psbParams.requestQueueDepth);
} else {
ownedQueue = false;
}

View File

@ -20,6 +20,14 @@ class StorageManagerIF;
* Configuration parameters for the PUS Service Base
*/
struct PsbParams {
static constexpr uint8_t PSB_DEFAULT_QUEUE_DEPTH = 10;
/**
* This constant sets the maximum number of packets accepted per call.
* Remember that one packet must be completely handled in one
* #handleRequest call.
*/
static constexpr uint8_t MAX_PACKETS_PER_CYCLE = 10;
PsbParams() = default;
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver)
@ -32,6 +40,9 @@ struct PsbParams {
object_id_t objectId = objects::NO_OBJECT;
uint16_t apid = 0;
uint8_t serviceId = 0;
uint32_t requestQueueDepth = PSB_DEFAULT_QUEUE_DEPTH;
uint32_t maxPacketsPerCycle = MAX_PACKETS_PER_CYCLE;
/**
* The default destination ID for generated telemetry. If this is not set, @initialize of PSB
* will attempt to find a suitable object with the object ID @PusServiceBase::packetDestination
@ -100,14 +111,6 @@ class PusServiceBase : public ExecutableObjectIF,
friend void Factory::setStaticFrameworkObjectIds();
public:
/**
* This constant sets the maximum number of packets accepted per call.
* Remember that one packet must be completely handled in one
* #handleRequest call.
*/
static constexpr uint8_t PUS_SERVICE_MAX_RECEPTION = 10;
static constexpr uint8_t PSB_DEFAULT_QUEUE_DEPTH = 10;
/**
* @brief The passed values are set, but inter-object initialization is
* done in the initialize method.