Merge remote-tracking branch 'upstream/development' into merge-upstream
This commit is contained in:
commit
b128ef9da9
@ -38,6 +38,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
inside `fsfw/version.h`
|
inside `fsfw/version.h`
|
||||||
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/559
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/559
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Small bugfix in STM32 HAL for SPI
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/599
|
||||||
|
|
||||||
# [v4.0.0]
|
# [v4.0.0]
|
||||||
|
|
||||||
## Additions
|
## Additions
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "MgmLIS3MDLHandler.h"
|
#include "MgmLIS3MDLHandler.h"
|
||||||
|
|
||||||
#include "fsfw/datapool/PoolReadGuard.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "fsfw/datapool/PoolReadGuard.h"
|
||||||
|
|
||||||
MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCommunication,
|
MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||||
CookieIF *comCookie, uint32_t transitionDelay)
|
CookieIF *comCookie, uint32_t transitionDelay)
|
||||||
: DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
: DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||||
|
@ -21,7 +21,7 @@ using mspCb = void (*)(void);
|
|||||||
namespace spi {
|
namespace spi {
|
||||||
|
|
||||||
struct MspCfgBase {
|
struct MspCfgBase {
|
||||||
MspCfgBase();
|
MspCfgBase() {}
|
||||||
MspCfgBase(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso,
|
MspCfgBase(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso,
|
||||||
mspCb cleanupCb = nullptr, mspCb setupCb = nullptr)
|
mspCb cleanupCb = nullptr, mspCb setupCb = nullptr)
|
||||||
: sck(sck), mosi(mosi), miso(miso), cleanupCb(cleanupCb), setupCb(setupCb) {}
|
: sck(sck), mosi(mosi), miso(miso), cleanupCb(cleanupCb), setupCb(setupCb) {}
|
||||||
|
@ -11,14 +11,13 @@ class HybridIterator : public LinkedElement<T>::Iterator, public ArrayList<T, co
|
|||||||
|
|
||||||
HybridIterator(typename LinkedElement<T>::Iterator *iter)
|
HybridIterator(typename LinkedElement<T>::Iterator *iter)
|
||||||
: LinkedElement<T>::Iterator(*iter), value(iter->value), linked(true) {
|
: LinkedElement<T>::Iterator(*iter), value(iter->value), linked(true) {
|
||||||
if(iter != nullptr) {
|
if (iter != nullptr) {
|
||||||
value = iter->value;
|
value = iter->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HybridIterator(LinkedElement<T> *start)
|
HybridIterator(LinkedElement<T> *start) : LinkedElement<T>::Iterator(start), linked(true) {
|
||||||
: LinkedElement<T>::Iterator(start), linked(true) {
|
if (start != nullptr) {
|
||||||
if(start != nullptr) {
|
|
||||||
value = start->value;
|
value = start->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PoolEntry<T>::PoolEntry(uint8_t len, bool setValid): length(len), valid(setValid) {
|
PoolEntry<T>::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) {
|
||||||
this->address = new T[this->length]();
|
this->address = new T[this->length]();
|
||||||
std::memset(this->address, 0, this->getByteSize());
|
std::memset(this->address, 0, this->getByteSize());
|
||||||
}
|
}
|
||||||
|
@ -787,6 +787,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
|
|||||||
// Serialize set packet into store.
|
// Serialize set packet into store.
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG);
|
result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
ipcStore->deleteData(storeId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
if (expectedSize != size) {
|
if (expectedSize != size) {
|
||||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
|
||||||
HasReturnvaluesIF::RETURN_FAILED,
|
HasReturnvaluesIF::RETURN_FAILED,
|
||||||
@ -801,7 +805,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
|
|||||||
HousekeepingMessage::setHkStuctureReportReply(&reply, sid, storeId);
|
HousekeepingMessage::setHkStuctureReportReply(&reply, sid, storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
hkQueue->reply(&reply);
|
result = hkQueue->reply(&reply);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
ipcStore->deleteData(storeId);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
|
|||||||
virtual ReturnValue_t cleanUpElement(iterator position) { return HasReturnvaluesIF::RETURN_OK; }
|
virtual ReturnValue_t cleanUpElement(iterator position) { return HasReturnvaluesIF::RETURN_OK; }
|
||||||
|
|
||||||
bool matchSubtree(iterator iter, T number) {
|
bool matchSubtree(iterator iter, T number) {
|
||||||
if(iter == nullptr) {
|
if (iter == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isMatch = iter->match(number);
|
bool isMatch = iter->match(number);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "MessageQueueBase.h"
|
#include "MessageQueueBase.h"
|
||||||
|
|
||||||
MessageQueueBase::MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest,
|
MessageQueueBase::MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest, MqArgs* args)
|
||||||
MqArgs* args): id(id) {
|
: id(id) {
|
||||||
this->defaultDest = defaultDest;
|
this->defaultDest = defaultDest;
|
||||||
if(args != nullptr) {
|
if (args != nullptr) {
|
||||||
this->args = *args;
|
this->args = *args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,35 +23,25 @@ ReturnValue_t MessageQueueBase::reply(MessageQueueMessageIF* message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t MessageQueueBase::receiveMessage(MessageQueueMessageIF* message,
|
ReturnValue_t MessageQueueBase::receiveMessage(MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t* receivedFrom) {
|
MessageQueueId_t* receivedFrom) {
|
||||||
ReturnValue_t status = this->receiveMessage(message);
|
ReturnValue_t status = this->receiveMessage(message);
|
||||||
*receivedFrom = this->last;
|
*receivedFrom = this->last;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t MessageQueueBase::getLastPartner() const {
|
MessageQueueId_t MessageQueueBase::getLastPartner() const { return last; }
|
||||||
return last;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageQueueId_t MessageQueueBase::getId() const {
|
MessageQueueId_t MessageQueueBase::getId() const { return id; }
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
MqArgs& MessageQueueBase::getMqArgs() {
|
MqArgs& MessageQueueBase::getMqArgs() { return args; }
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageQueueBase::setDefaultDestination(MessageQueueId_t defaultDestination) {
|
void MessageQueueBase::setDefaultDestination(MessageQueueId_t defaultDestination) {
|
||||||
this->defaultDest = defaultDestination;
|
this->defaultDest = defaultDestination;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t MessageQueueBase::getDefaultDestination() const {
|
MessageQueueId_t MessageQueueBase::getDefaultDestination() const { return defaultDest; }
|
||||||
return defaultDest;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MessageQueueBase::isDefaultDestinationSet() const {
|
bool MessageQueueBase::isDefaultDestinationSet() const { return (defaultDest != NO_QUEUE); }
|
||||||
return (defaultDest != NO_QUEUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t MessageQueueBase::sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
ReturnValue_t MessageQueueBase::sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
bool ignoreFault) {
|
bool ignoreFault) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_
|
#ifndef FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_
|
||||||
#define FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_
|
#define FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_
|
||||||
|
|
||||||
#include <fsfw/ipc/definitions.h>
|
|
||||||
#include <fsfw/ipc/MessageQueueIF.h>
|
#include <fsfw/ipc/MessageQueueIF.h>
|
||||||
|
#include <fsfw/ipc/definitions.h>
|
||||||
|
|
||||||
class MessageQueueBase: public MessageQueueIF {
|
class MessageQueueBase : public MessageQueueIF {
|
||||||
public:
|
public:
|
||||||
MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest, MqArgs* mqArgs);
|
MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest, MqArgs* mqArgs);
|
||||||
virtual ~MessageQueueBase();
|
virtual ~MessageQueueBase();
|
||||||
|
|
||||||
@ -17,25 +17,24 @@ public:
|
|||||||
virtual MessageQueueId_t getDefaultDestination() const override;
|
virtual MessageQueueId_t getDefaultDestination() const override;
|
||||||
virtual bool isDefaultDestinationSet() const override;
|
virtual bool isDefaultDestinationSet() const override;
|
||||||
virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
bool ignoreFault) override;
|
bool ignoreFault) override;
|
||||||
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
|
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
|
||||||
virtual ReturnValue_t reply(MessageQueueMessageIF* message) override;
|
virtual ReturnValue_t reply(MessageQueueMessageIF* message) override;
|
||||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
|
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t* receivedFrom) override;
|
MessageQueueId_t* receivedFrom) override;
|
||||||
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message,
|
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
|
||||||
MessageQueueId_t sentFrom, bool ignoreFault = false) override;
|
bool ignoreFault = false) override;
|
||||||
|
|
||||||
// OSAL specific, forward the abstract function
|
// OSAL specific, forward the abstract function
|
||||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
|
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
|
||||||
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t sentFrom, bool ignoreFault = false) = 0;
|
MessageQueueId_t sentFrom, bool ignoreFault = false) = 0;
|
||||||
protected:
|
|
||||||
|
protected:
|
||||||
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;
|
||||||
MessageQueueId_t last = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t last = MessageQueueIF::NO_QUEUE;
|
||||||
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
|
||||||
MqArgs args = {};
|
MqArgs args = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_ */
|
#endif /* FSFW_SRC_FSFW_IPC_MESSAGEQUEUEBASE_H_ */
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FSFW_IPC_MESSAGEQUEUEIF_H_
|
#define FSFW_IPC_MESSAGEQUEUEIF_H_
|
||||||
|
|
||||||
#include <fsfw/ipc/definitions.h>
|
#include <fsfw/ipc/definitions.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
@ -45,7 +46,8 @@ class MessageQueueIF {
|
|||||||
virtual ReturnValue_t reply(MessageQueueMessageIF* message) = 0;
|
virtual ReturnValue_t reply(MessageQueueMessageIF* message) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function reads available messages from the message queue and returns the sender.
|
* @brief This function reads available messages from the message queue and returns the
|
||||||
|
* sender.
|
||||||
* @details
|
* @details
|
||||||
* It works identically to the other receiveMessage call, but in addition
|
* It works identically to the other receiveMessage call, but in addition
|
||||||
* returns the sender's queue id.
|
* returns the sender's queue id.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FSFW_OSAL_FREERTOS_MESSAGEQUEUE_H_
|
#define FSFW_OSAL_FREERTOS_MESSAGEQUEUE_H_
|
||||||
|
|
||||||
#include <fsfw/ipc/MessageQueueBase.h>
|
#include <fsfw/ipc/MessageQueueBase.h>
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "TaskManagement.h"
|
#include "TaskManagement.h"
|
||||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#ifndef FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_
|
#ifndef FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_
|
||||||
#define FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_
|
#define FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_
|
||||||
|
|
||||||
#include "fsfw/ipc/MessageQueueBase.h"
|
#include <memory>
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueBase.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||||
#include "fsfw/ipc/MutexIF.h"
|
#include "fsfw/ipc/MutexIF.h"
|
||||||
#include "fsfw/ipc/definitions.h"
|
#include "fsfw/ipc/definitions.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class manages sending and receiving of
|
* @brief This class manages sending and receiving of
|
||||||
* message queue messages.
|
* message queue messages.
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
||||||
|
|
||||||
#include <linux/sysinfo.h>
|
#include <linux/sysinfo.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
@ -7,8 +6,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
uint16_t Clock::leapSeconds = 0;
|
uint16_t Clock::leapSeconds = 0;
|
||||||
MutexIF* Clock::timeMutex = NULL;
|
MutexIF* Clock::timeMutex = NULL;
|
||||||
@ -155,12 +156,11 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handleClockError(const char* func) {
|
void handleClockError(const char* func) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "Clock::" << func << ": Failed with code " << errno << ": " << strerror(errno)
|
sif::warning << "Clock::" << func << ": Failed with code " << errno << ": " << strerror(errno)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning("Clock::%s: Failed with code %d: %s\n", func, errno, strerror(errno));
|
sif::printWarning("Clock::%s: Failed with code %d: %s\n", func, errno, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,8 +61,7 @@ class MessageQueue : public MessageQueueBase {
|
|||||||
ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override;
|
ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override;
|
||||||
ReturnValue_t flush(uint32_t* count) override;
|
ReturnValue_t flush(uint32_t* count) override;
|
||||||
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t sentFrom,
|
MessageQueueId_t sentFrom, bool ignoreFault = false) override;
|
||||||
bool ignoreFault = false) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_
|
#define FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_
|
||||||
|
|
||||||
#include <fsfw/ipc/MessageQueueBase.h>
|
#include <fsfw/ipc/MessageQueueBase.h>
|
||||||
|
|
||||||
#include "RtemsBasic.h"
|
#include "RtemsBasic.h"
|
||||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
@ -52,8 +53,8 @@ class MessageQueue : public MessageQueueBase {
|
|||||||
// Implement non-generic MessageQueueIF functions not handled by MessageQueueBase
|
// Implement non-generic MessageQueueIF functions not handled by MessageQueueBase
|
||||||
ReturnValue_t flush(uint32_t* count) override;
|
ReturnValue_t flush(uint32_t* count) override;
|
||||||
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t sentFrom = NO_QUEUE,
|
MessageQueueId_t sentFrom = NO_QUEUE,
|
||||||
bool ignoreFault = false) override;
|
bool ignoreFault = false) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -59,14 +59,13 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t addComponent(object_id_t object) override;
|
ReturnValue_t addComponent(object_id_t object) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an object to the list of objects to be executed.
|
* Adds an object to the list of objects to be executed.
|
||||||
* The objects are executed in the order added.
|
* The objects are executed in the order added.
|
||||||
* @param object pointer to the object to add.
|
* @param object pointer to the object to add.
|
||||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t addComponent(ExecutableObjectIF* object) override;
|
ReturnValue_t addComponent(ExecutableObjectIF *object) override;
|
||||||
|
|
||||||
|
|
||||||
uint32_t getPeriodMs() const override;
|
uint32_t getPeriodMs() const override;
|
||||||
|
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/power/PowerSwitchIF.h>
|
#include <fsfw/power/PowerSwitchIF.h>
|
||||||
|
|
||||||
PowerSwitcherComponent::PowerSwitcherComponent(object_id_t objectId, PowerSwitchIF* pwrSwitcher, power::Switch_t pwrSwitch)
|
PowerSwitcherComponent::PowerSwitcherComponent(object_id_t objectId, PowerSwitchIF *pwrSwitcher,
|
||||||
: SystemObject(objectId), switcher(pwrSwitcher, pwrSwitch), modeHelper(this),
|
power::Switch_t pwrSwitch)
|
||||||
healthHelper(this, objectId) {
|
: SystemObject(objectId),
|
||||||
|
switcher(pwrSwitcher, pwrSwitch),
|
||||||
|
modeHelper(this),
|
||||||
|
healthHelper(this, objectId) {
|
||||||
queue = QueueFactory::instance()->createMessageQueue();
|
queue = QueueFactory::instance()->createMessageQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,12 +28,12 @@ ReturnValue_t PowerSwitcherComponent::performOperation(uint8_t opCode) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(switcher.active()) {
|
if (switcher.active()) {
|
||||||
switcher.doStateMachine();
|
switcher.doStateMachine();
|
||||||
auto currState = switcher.getState();
|
auto currState = switcher.getState();
|
||||||
if (currState == PowerSwitcher::SWITCH_IS_OFF) {
|
if (currState == PowerSwitcher::SWITCH_IS_OFF) {
|
||||||
setMode(MODE_OFF, 0);
|
setMode(MODE_OFF, 0);
|
||||||
} else if(currState == PowerSwitcher::SWITCH_IS_ON) {
|
} else if (currState == PowerSwitcher::SWITCH_IS_ON) {
|
||||||
setMode(MODE_ON, 0);
|
setMode(MODE_ON, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,19 +42,17 @@ ReturnValue_t PowerSwitcherComponent::performOperation(uint8_t opCode) {
|
|||||||
|
|
||||||
ReturnValue_t PowerSwitcherComponent::initialize() {
|
ReturnValue_t PowerSwitcherComponent::initialize() {
|
||||||
ReturnValue_t result = modeHelper.initialize();
|
ReturnValue_t result = modeHelper.initialize();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = healthHelper.initialize();
|
result = healthHelper.initialize();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return SystemObject::initialize();
|
return SystemObject::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PowerSwitcherComponent::getCommandQueue() const {
|
MessageQueueId_t PowerSwitcherComponent::getCommandQueue() const { return queue->getId(); }
|
||||||
return queue->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PowerSwitcherComponent::getMode(Mode_t *mode, Submode_t *submode) {
|
void PowerSwitcherComponent::getMode(Mode_t *mode, Submode_t *submode) {
|
||||||
*mode = this->mode;
|
*mode = this->mode;
|
||||||
@ -64,25 +65,25 @@ ReturnValue_t PowerSwitcherComponent::setHealth(HealthState health) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PowerSwitcherComponent::checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t PowerSwitcherComponent::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode) {
|
uint32_t *msToReachTheMode) {
|
||||||
*msToReachTheMode = 5000;
|
*msToReachTheMode = 5000;
|
||||||
if(mode != MODE_ON and mode != MODE_OFF) {
|
if (mode != MODE_ON and mode != MODE_OFF) {
|
||||||
return TRANS_NOT_ALLOWED;
|
return TRANS_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerSwitcherComponent::startTransition(Mode_t mode, Submode_t submode) {
|
void PowerSwitcherComponent::startTransition(Mode_t mode, Submode_t submode) {
|
||||||
if(mode == MODE_OFF) {
|
if (mode == MODE_OFF) {
|
||||||
switcher.turnOff(true);
|
switcher.turnOff(true);
|
||||||
switcher.doStateMachine();
|
switcher.doStateMachine();
|
||||||
if(switcher.getState() == PowerSwitcher::SWITCH_IS_OFF) {
|
if (switcher.getState() == PowerSwitcher::SWITCH_IS_OFF) {
|
||||||
setMode(MODE_OFF, 0);
|
setMode(MODE_OFF, 0);
|
||||||
}
|
}
|
||||||
} else if (mode == MODE_ON) {
|
} else if (mode == MODE_ON) {
|
||||||
switcher.turnOn(true);
|
switcher.turnOn(true);
|
||||||
switcher.doStateMachine();
|
switcher.doStateMachine();
|
||||||
if(switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
if (switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
||||||
setMode(MODE_ON, 0);
|
setMode(MODE_ON, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +104,4 @@ void PowerSwitcherComponent::setMode(Mode_t newMode, Submode_t newSubmode) {
|
|||||||
announceMode(false);
|
announceMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
HasHealthIF::HealthState PowerSwitcherComponent::getHealth() {
|
HasHealthIF::HealthState PowerSwitcherComponent::getHealth() { return healthHelper.getHealth(); }
|
||||||
return healthHelper.getHealth();
|
|
||||||
}
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include <fsfw/modes/HasModesIF.h>
|
#include <fsfw/modes/HasModesIF.h>
|
||||||
#include <fsfw/modes/ModeHelper.h>
|
#include <fsfw/modes/ModeHelper.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/power/definitions.h>
|
|
||||||
#include <fsfw/power/PowerSwitcher.h>
|
#include <fsfw/power/PowerSwitcher.h>
|
||||||
|
#include <fsfw/power/definitions.h>
|
||||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||||
|
|
||||||
class PowerSwitchIF;
|
class PowerSwitchIF;
|
||||||
@ -22,19 +22,17 @@ class PowerSwitchIF;
|
|||||||
* Commanding this component to MODE_OFF will cause the switcher to turn the switch off while
|
* Commanding this component to MODE_OFF will cause the switcher to turn the switch off while
|
||||||
* commanding in to MODE_ON will cause the switcher to turn the switch on.
|
* commanding in to MODE_ON will cause the switcher to turn the switch on.
|
||||||
*/
|
*/
|
||||||
class PowerSwitcherComponent:
|
class PowerSwitcherComponent : public SystemObject,
|
||||||
public SystemObject,
|
public HasReturnvaluesIF,
|
||||||
public HasReturnvaluesIF,
|
public ExecutableObjectIF,
|
||||||
public ExecutableObjectIF,
|
public HasModesIF,
|
||||||
public HasModesIF,
|
public HasHealthIF {
|
||||||
public HasHealthIF {
|
public:
|
||||||
public:
|
PowerSwitcherComponent(object_id_t objectId, PowerSwitchIF *pwrSwitcher,
|
||||||
PowerSwitcherComponent(object_id_t objectId, PowerSwitchIF* pwrSwitcher,
|
power::Switch_t pwrSwitch);
|
||||||
power::Switch_t pwrSwitch);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
MessageQueueIF *queue = nullptr;
|
||||||
MessageQueueIF* queue = nullptr;
|
|
||||||
PowerSwitcher switcher;
|
PowerSwitcher switcher;
|
||||||
|
|
||||||
Mode_t mode = MODE_OFF;
|
Mode_t mode = MODE_OFF;
|
||||||
@ -52,7 +50,7 @@ private:
|
|||||||
MessageQueueId_t getCommandQueue() const override;
|
MessageQueueId_t getCommandQueue() const override;
|
||||||
void getMode(Mode_t *mode, Submode_t *submode) override;
|
void getMode(Mode_t *mode, Submode_t *submode) override;
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode) override;
|
uint32_t *msToReachTheMode) override;
|
||||||
void startTransition(Mode_t mode, Submode_t submode) override;
|
void startTransition(Mode_t mode, Submode_t submode) override;
|
||||||
void setToExternalControl() override;
|
void setToExternalControl() override;
|
||||||
void announceMode(bool recursive) override;
|
void announceMode(bool recursive) override;
|
||||||
|
@ -30,7 +30,7 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
|
|||||||
return FALLBACK_SEQUENCE_DOES_NOT_EXIST;
|
return FALLBACK_SEQUENCE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter.value ==nullptr) {
|
if (iter.value == nullptr) {
|
||||||
return NO_TARGET_TABLE;
|
return NO_TARGET_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ void Subsystem::performChildOperation() {
|
|||||||
} else {
|
} else {
|
||||||
Mode_t tableId = 0;
|
Mode_t tableId = 0;
|
||||||
auto seq = getSequence(targetMode);
|
auto seq = getSequence(targetMode);
|
||||||
if(seq.value != nullptr) {
|
if (seq.value != nullptr) {
|
||||||
tableId = seq->getTableId();
|
tableId = seq->getTableId();
|
||||||
}
|
}
|
||||||
transitionFailed(TARGET_TABLE_NOT_REACHED, tableId);
|
transitionFailed(TARGET_TABLE_NOT_REACHED, tableId);
|
||||||
return;
|
return;
|
||||||
@ -257,7 +257,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
|
|||||||
result = modeTables.find(table, &entry);
|
result = modeTables.find(table, &entry);
|
||||||
if (result != RETURN_OK or entry == nullptr) {
|
if (result != RETURN_OK or entry == nullptr) {
|
||||||
replyToCommand(result, 0);
|
replyToCommand(result, 0);
|
||||||
if(entry == nullptr) {
|
if (entry == nullptr) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#ifndef FSFW_SUBSYSTEM_SUBSYSTEM_H_
|
#ifndef FSFW_SUBSYSTEM_SUBSYSTEM_H_
|
||||||
#define FSFW_SUBSYSTEM_SUBSYSTEM_H_
|
#define FSFW_SUBSYSTEM_SUBSYSTEM_H_
|
||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
|
|
||||||
#include "../container/FixedArrayList.h"
|
#include "../container/FixedArrayList.h"
|
||||||
#include "../container/FixedMap.h"
|
#include "../container/FixedMap.h"
|
||||||
#include "../container/HybridIterator.h"
|
#include "../container/HybridIterator.h"
|
||||||
#include "../container/SinglyLinkedList.h"
|
#include "../container/SinglyLinkedList.h"
|
||||||
#include "../serialize/SerialArrayListAdapter.h"
|
#include "../serialize/SerialArrayListAdapter.h"
|
||||||
#include "SubsystemBase.h"
|
#include "SubsystemBase.h"
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
#include "modes/ModeDefinitions.h"
|
#include "modes/ModeDefinitions.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "fsfw/ipc/MessageQueueBase.h"
|
|
||||||
#include "fsfw/ipc/CommandMessage.h"
|
#include "fsfw/ipc/CommandMessage.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueBase.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||||
@ -13,7 +13,7 @@
|
|||||||
class MessageQueueMockBase : public MessageQueueBase {
|
class MessageQueueMockBase : public MessageQueueBase {
|
||||||
public:
|
public:
|
||||||
MessageQueueMockBase()
|
MessageQueueMockBase()
|
||||||
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, nullptr) {}
|
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, nullptr) {}
|
||||||
|
|
||||||
uint8_t messageSentCounter = 0;
|
uint8_t messageSentCounter = 0;
|
||||||
bool messageSent = false;
|
bool messageSent = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user