Increase configurability of PusServiceBase

This commit is contained in:
Robin Müller 2024-02-13 15:57:43 +01:00
parent b5e7179af1
commit cd2cd61ba5
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. - Assert that `FixedArrayList` is larger than 0 at compile time.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740 https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740
- Health functions are virtual now. - 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 # [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], void QuaternionOperations::rotationFromQuaternions(const double qNew[4], const double qOld[4],
const double timeDelta, const double timeDelta, double rotRate[3]) {
double rotRate[3]) {
double qOldInv[4] = {0, 0, 0, 0}; double qOldInv[4] = {0, 0, 0, 0};
double qDelta[4] = {0, 0, 0, 0}; double qDelta[4] = {0, 0, 0, 0};

View File

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

View File

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

View File

@ -20,6 +20,14 @@ class StorageManagerIF;
* Configuration parameters for the PUS Service Base * Configuration parameters for the PUS Service Base
*/ */
struct PsbParams { 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() = default;
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {} PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver) PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver)
@ -32,6 +40,9 @@ struct PsbParams {
object_id_t objectId = objects::NO_OBJECT; object_id_t objectId = objects::NO_OBJECT;
uint16_t apid = 0; uint16_t apid = 0;
uint8_t serviceId = 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 * 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 * 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(); friend void Factory::setStaticFrameworkObjectIds();
public: 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 * @brief The passed values are set, but inter-object initialization is
* done in the initialize method. * done in the initialize method.