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

Reviewed-on: #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

@ -26,7 +26,7 @@ class QuaternionOperations {
static void slerp(const double q1[4], const double q2[4], const double weight, double q[4]);
static void rotationFromQuaternions(const double qNew[4], const double qOld[4],
const double timeDelta, double rotRate[3]);
const double timeDelta, double rotRate[3]);
/**
* returns angle in ]-Pi;Pi] or [0;Pi] if abs == true

View File

@ -150,7 +150,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleResetCom
template <size_t MAX_NUM_TCS>
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivity(
const uint8_t *data, size_t size) {
if(telecommandMap.full()) {
if (telecommandMap.full()) {
return MAP_IS_FULL;
}
uint32_t timestamp = 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.