Update FSFW #51

Merged
meierj merged 8 commits from mueller/master into eive/develop 2022-04-01 14:51:32 +02:00
9 changed files with 51 additions and 49 deletions
Showing only changes of commit 3ea9f999b7 - Show all commits

View File

@ -125,13 +125,14 @@ ReturnValue_t DeviceHandlerBase::initialize() {
return result; return result;
} }
if (this->fdirInstance == nullptr) { if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(this->getObjectId(), defaultFdirParentId); this->fdirInstance =
new DeviceHandlerFailureIsolation(this->getObjectId(), defaultFdirParentId);
} }
if(this->parent != objects::NO_OBJECT) { if (this->parent != objects::NO_OBJECT) {
HasModesIF* modeIF = ObjectManager::instance()->get<HasModesIF>(this->parent); HasModesIF* modeIF = ObjectManager::instance()->get<HasModesIF>(this->parent);
HasHealthIF* healthIF = ObjectManager::instance()->get<HasHealthIF>(this->parent); HasHealthIF* healthIF = ObjectManager::instance()->get<HasHealthIF>(this->parent);
if(modeIF != nullptr and healthIF != nullptr) { if (modeIF != nullptr and healthIF != nullptr) {
setParentQueue(modeIF->getCommandQueue()); setParentQueue(modeIF->getCommandQueue());
} }
} }
@ -1505,4 +1506,6 @@ void DeviceHandlerBase::setCustomFdir(FailureIsolationBase* fdir) { this->fdirIn
void DeviceHandlerBase::setParent(object_id_t parent) { this->parent = parent; } void DeviceHandlerBase::setParent(object_id_t parent) { this->parent = parent; }
void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) { this->powerSwitcher = switcher; } void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) {
this->powerSwitcher = switcher;
}

View File

@ -103,9 +103,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF *comCookie, DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF *comCookie,
FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20);
void setCustomFdir(FailureIsolationBase* fdir); void setCustomFdir(FailureIsolationBase *fdir);
void setParent(object_id_t parent); void setParent(object_id_t parent);
void setPowerSwitcher(PowerSwitchIF* switcher); void setPowerSwitcher(PowerSwitchIF *switcher);
void setHkDestination(object_id_t hkDestination); void setHkDestination(object_id_t hkDestination);
/** /**

View File

@ -1,14 +1,14 @@
#ifndef FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ #ifndef FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_
#define FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ #define FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_
#include <cstddef>
#include <vector>
#include "PowerSwitchIF.h" #include "PowerSwitchIF.h"
#include "definitions.h" #include "definitions.h"
#include <vector> class DummyPowerSwitcher : public PowerSwitchIF {
#include <cstddef> public:
class DummyPowerSwitcher: public PowerSwitchIF {
public:
DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs = 5000); DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs = 5000);
void setInitialSwitcherList(std::vector<ReturnValue_t> switcherList); void setInitialSwitcherList(std::vector<ReturnValue_t> switcherList);
@ -20,12 +20,10 @@ public:
virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override;
virtual uint32_t getSwitchDelayMs(void) const override; virtual uint32_t getSwitchDelayMs(void) const override;
private: private:
std::vector<ReturnValue_t> switcherList; std::vector<ReturnValue_t> switcherList;
std::vector<ReturnValue_t> fuseList; std::vector<ReturnValue_t> fuseList;
uint32_t switchDelayMs = 5000; uint32_t switchDelayMs = 5000;
}; };
#endif /* FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ */ #endif /* FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ */

View File

@ -1,9 +1,9 @@
#ifndef FSFW_POWER_POWERSWITCHIF_H_ #ifndef FSFW_POWER_POWERSWITCHIF_H_
#define FSFW_POWER_POWERSWITCHIF_H_ #define FSFW_POWER_POWERSWITCHIF_H_
#include "definitions.h"
#include "../events/Event.h" #include "../events/Event.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "definitions.h"
/** /**
* *
* @brief This interface defines a connection to a device that is capable of * @brief This interface defines a connection to a device that is capable of

View File

@ -1,6 +1,6 @@
#include "definitions.h"
#include "fsfw/power/PowerSwitcher.h" #include "fsfw/power/PowerSwitcher.h"
#include "definitions.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
@ -46,8 +46,8 @@ void PowerSwitcher::commandSwitches(ReturnValue_t onOff) {
} }
void PowerSwitcher::turnOn(bool checkCurrentState) { void PowerSwitcher::turnOn(bool checkCurrentState) {
if(checkCurrentState) { if (checkCurrentState) {
if(getStateOfSwitches() == PowerSwitchIF::SWITCH_ON) { if (getStateOfSwitches() == PowerSwitchIF::SWITCH_ON) {
state = SWITCH_IS_ON; state = SWITCH_IS_ON;
return; return;
} }
@ -57,8 +57,8 @@ void PowerSwitcher::turnOn(bool checkCurrentState) {
} }
void PowerSwitcher::turnOff(bool checkCurrentState) { void PowerSwitcher::turnOff(bool checkCurrentState) {
if(checkCurrentState) { if (checkCurrentState) {
if(getStateOfSwitches() == PowerSwitchIF::SWITCH_OFF) { if (getStateOfSwitches() == PowerSwitchIF::SWITCH_OFF) {
state = SWITCH_IS_OFF; state = SWITCH_IS_OFF;
return; return;
} }
@ -68,7 +68,7 @@ void PowerSwitcher::turnOff(bool checkCurrentState) {
} }
bool PowerSwitcher::active() { bool PowerSwitcher::active() {
if(state == WAIT_OFF or state == WAIT_ON) { if (state == WAIT_OFF or state == WAIT_ON) {
return true; return true;
} }
return false; return false;

View File

@ -8,6 +8,6 @@ namespace power {
using Switch_t = uint8_t; using Switch_t = uint8_t;
static constexpr Switch_t NO_SWITCH = 0xFF; static constexpr Switch_t NO_SWITCH = 0xFF;
} } // namespace power
#endif /* FSFW_SRC_FSFW_POWER_DEFINITIONS_H_ */ #endif /* FSFW_SRC_FSFW_POWER_DEFINITIONS_H_ */

View File

@ -1,8 +1,9 @@
#include "version.h" #include "version.h"
#include "fsfw/FSFWVersion.h"
#include <cstdio> #include <cstdio>
#include "fsfw/FSFWVersion.h"
#ifdef major #ifdef major
#undef major #undef major
#endif #endif

View File

@ -29,7 +29,7 @@ class Version {
} }
friend bool operator>(const Version& v1, const Version& v2) { friend bool operator>(const Version& v1, const Version& v2) {
return not (v1 < v2) and not (v1 == v2); return not(v1 < v2) and not(v1 == v2);
} }
friend bool operator<=(const Version& v1, const Version& v2) { return ((v1 == v2) or (v1 < v2)); } friend bool operator<=(const Version& v1, const Version& v2) { return ((v1 == v2) or (v1 < v2)); }

View File

@ -17,15 +17,15 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") {
fsfw::Version v1 = fsfw::Version(1, 1, 1); fsfw::Version v1 = fsfw::Version(1, 1, 1);
fsfw::Version v2 = fsfw::Version(1, 1, 1); fsfw::Version v2 = fsfw::Version(1, 1, 1);
REQUIRE(v1 == v2); REQUIRE(v1 == v2);
REQUIRE(not (v1 < v2)); REQUIRE(not(v1 < v2));
REQUIRE(not (v1 > v2)); REQUIRE(not(v1 > v2));
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
v1.revision -= 1; v1.revision -= 1;
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 > v2)); REQUIRE(not(v1 > v2));
REQUIRE(not (v1 >= v2)); REQUIRE(not(v1 >= v2));
REQUIRE(v1 < v2); REQUIRE(v1 < v2);
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
v1.revision += 1; v1.revision += 1;
@ -33,60 +33,60 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") {
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(v1 < v2); REQUIRE(v1 < v2);
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 > v2)); REQUIRE(not(v1 > v2));
REQUIRE(not (v1 >= v2)); REQUIRE(not(v1 >= v2));
v1.minor += 1; v1.minor += 1;
v1.major -= 1; v1.major -= 1;
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(v1 < v2); REQUIRE(v1 < v2);
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 > v2)); REQUIRE(not(v1 > v2));
REQUIRE(not (v1 >= v2)); REQUIRE(not(v1 >= v2));
v1.major += 1; v1.major += 1;
REQUIRE(v1 == v2); REQUIRE(v1 == v2);
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
REQUIRE(not (v1 != v2)); REQUIRE(not(v1 != v2));
REQUIRE(not (v1 > v2)); REQUIRE(not(v1 > v2));
REQUIRE(not (v1 < v2)); REQUIRE(not(v1 < v2));
v1.major += 1; v1.major += 1;
v1.minor -= 1; v1.minor -= 1;
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(v1 > v2); REQUIRE(v1 > v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 < v2)); REQUIRE(not(v1 < v2));
REQUIRE(not (v1 <= v2)); REQUIRE(not(v1 <= v2));
v1.major -= 1; v1.major -= 1;
v1.minor += 2; v1.minor += 2;
v1.revision -= 1; v1.revision -= 1;
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(v1 > v2); REQUIRE(v1 > v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 < v2)); REQUIRE(not(v1 < v2));
REQUIRE(not (v1 <= v2)); REQUIRE(not(v1 <= v2));
v1.minor -= 1; v1.minor -= 1;
v1.revision += 2; v1.revision += 2;
REQUIRE(v1 != v2); REQUIRE(v1 != v2);
REQUIRE(v1 > v2); REQUIRE(v1 > v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
REQUIRE(not (v1 == v2)); REQUIRE(not(v1 == v2));
REQUIRE(not (v1 < v2)); REQUIRE(not(v1 < v2));
REQUIRE(not (v1 <= v2)); REQUIRE(not(v1 <= v2));
v1.revision -= 1; v1.revision -= 1;
REQUIRE(v1 == v2); REQUIRE(v1 == v2);
REQUIRE(v1 <= v2); REQUIRE(v1 <= v2);
REQUIRE(v1 >= v2); REQUIRE(v1 >= v2);
REQUIRE(not (v1 != v2)); REQUIRE(not(v1 != v2));
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "v" << fsfw::FSFW_VERSION << std::endl; sif::info << "v" << fsfw::FSFW_VERSION << std::endl;
#endif #endif
char verString[10] = {}; char verString[10] = {};
fsfw::FSFW_VERSION.getVersion(verString, sizeof(verString)); fsfw::FSFW_VERSION.getVersion(verString, sizeof(verString));
#if FSFW_DISABLE_PRINTOUT == 0 #if FSFW_DISABLE_PRINTOUT == 0
printf("v%s\n",verString); printf("v%s\n", verString);
#endif #endif
} }