From b32d1da4211c62b024cba4310fbecfaf1af01478 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 12:57:11 +0200 Subject: [PATCH] this should compile --- src/fsfw/power/DummyPowerSwitcher.cpp | 16 ++++----- src/fsfw/power/DummyPowerSwitcher.h | 14 ++++---- src/fsfw/power/PowerSensor.cpp | 5 ++- src/fsfw/power/PowerSwitchIF.h | 2 +- src/fsfw/power/PowerSwitcher.cpp | 12 +++---- src/fsfw/power/definitions.h | 2 +- src/fsfw/version.cpp | 3 +- src/fsfw/version.h | 2 +- tests/src/fsfw_tests/unit/version.cpp | 50 +++++++++++++-------------- 9 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/fsfw/power/DummyPowerSwitcher.cpp b/src/fsfw/power/DummyPowerSwitcher.cpp index fe900e724..92d9cfbd0 100644 --- a/src/fsfw/power/DummyPowerSwitcher.cpp +++ b/src/fsfw/power/DummyPowerSwitcher.cpp @@ -1,8 +1,8 @@ #include "DummyPowerSwitcher.h" -DummyPowerSwitcher::DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs) -: switcherList(numberOfSwitches), fuseList(numberOfFuses), switchDelayMs(switchDelayMs) { -} +DummyPowerSwitcher::DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, + uint32_t switchDelayMs) + : switcherList(numberOfSwitches), fuseList(numberOfFuses), switchDelayMs(switchDelayMs) {} void DummyPowerSwitcher::setInitialSwitcherList(std::vector switcherList) { this->switcherList = switcherList; @@ -20,7 +20,7 @@ ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, Re } ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) { - if(fuseNr < fuseList.capacity()) { + if (fuseNr < fuseList.capacity()) { fuseList[fuseNr] = FUSE_ON; } return RETURN_FAILED; @@ -33,10 +33,6 @@ ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const return HasReturnvaluesIF::RETURN_FAILED; } -ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { - return RETURN_OK; -} +ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { return RETURN_OK; } -uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { - return 5000; -} +uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { return 5000; } diff --git a/src/fsfw/power/DummyPowerSwitcher.h b/src/fsfw/power/DummyPowerSwitcher.h index 39de608d2..3582f8d76 100644 --- a/src/fsfw/power/DummyPowerSwitcher.h +++ b/src/fsfw/power/DummyPowerSwitcher.h @@ -1,14 +1,14 @@ #ifndef FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ #define FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ +#include +#include + #include "PowerSwitchIF.h" #include "definitions.h" -#include -#include - -class DummyPowerSwitcher: public PowerSwitchIF { -public: +class DummyPowerSwitcher : public PowerSwitchIF { + public: DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs = 5000); void setInitialSwitcherList(std::vector switcherList); @@ -20,12 +20,10 @@ public: virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; virtual uint32_t getSwitchDelayMs(void) const override; -private: + private: std::vector switcherList; std::vector fuseList; uint32_t switchDelayMs = 5000; }; - - #endif /* FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ */ diff --git a/src/fsfw/power/PowerSensor.cpp b/src/fsfw/power/PowerSensor.cpp index 1936e8eec..e73b12d07 100644 --- a/src/fsfw/power/PowerSensor.cpp +++ b/src/fsfw/power/PowerSensor.cpp @@ -15,9 +15,8 @@ PowerSensor::PowerSensor(object_id_t objectId, sid_t setId, VariableIds ids, Def limits.currentMin, limits.currentMax, events.currentLow, events.currentHigh), voltageLimit(objectId, MODULE_ID_VOLTAGE, ids.pidVoltage, confirmationCount, limits.voltageMin, limits.voltageMax, events.voltageLow, events.voltageHigh) { - auto mqArgs = MqArgs(objectId, static_cast(this)); - commandQueue = QueueFactory::instance()->createMessageQueue( - 3, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); + commandQueue = + QueueFactory::instance()->createMessageQueue(3, MessageQueueMessage::MAX_MESSAGE_SIZE); } PowerSensor::~PowerSensor() { QueueFactory::instance()->deleteMessageQueue(commandQueue); } diff --git a/src/fsfw/power/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h index 71c5523d0..bc883fbc6 100644 --- a/src/fsfw/power/PowerSwitchIF.h +++ b/src/fsfw/power/PowerSwitchIF.h @@ -1,9 +1,9 @@ #ifndef FSFW_POWER_POWERSWITCHIF_H_ #define FSFW_POWER_POWERSWITCHIF_H_ -#include "definitions.h" #include "../events/Event.h" #include "../returnvalues/HasReturnvaluesIF.h" +#include "definitions.h" /** * * @brief This interface defines a connection to a device that is capable of diff --git a/src/fsfw/power/PowerSwitcher.cpp b/src/fsfw/power/PowerSwitcher.cpp index 83679772d..7608c6e75 100644 --- a/src/fsfw/power/PowerSwitcher.cpp +++ b/src/fsfw/power/PowerSwitcher.cpp @@ -1,6 +1,6 @@ -#include "definitions.h" #include "fsfw/power/PowerSwitcher.h" +#include "definitions.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" @@ -46,8 +46,8 @@ void PowerSwitcher::commandSwitches(ReturnValue_t onOff) { } void PowerSwitcher::turnOn(bool checkCurrentState) { - if(checkCurrentState) { - if(getStateOfSwitches() == PowerSwitchIF::SWITCH_ON) { + if (checkCurrentState) { + if (getStateOfSwitches() == PowerSwitchIF::SWITCH_ON) { state = SWITCH_IS_ON; return; } @@ -57,8 +57,8 @@ void PowerSwitcher::turnOn(bool checkCurrentState) { } void PowerSwitcher::turnOff(bool checkCurrentState) { - if(checkCurrentState) { - if(getStateOfSwitches() == PowerSwitchIF::SWITCH_OFF) { + if (checkCurrentState) { + if (getStateOfSwitches() == PowerSwitchIF::SWITCH_OFF) { state = SWITCH_IS_OFF; return; } @@ -68,7 +68,7 @@ void PowerSwitcher::turnOff(bool checkCurrentState) { } bool PowerSwitcher::active() { - if(state == WAIT_OFF or state == WAIT_ON) { + if (state == WAIT_OFF or state == WAIT_ON) { return true; } return false; diff --git a/src/fsfw/power/definitions.h b/src/fsfw/power/definitions.h index 1e4fe2963..ed2a0037d 100644 --- a/src/fsfw/power/definitions.h +++ b/src/fsfw/power/definitions.h @@ -8,6 +8,6 @@ namespace power { using Switch_t = uint8_t; static constexpr Switch_t NO_SWITCH = 0xFF; -} +} // namespace power #endif /* FSFW_SRC_FSFW_POWER_DEFINITIONS_H_ */ diff --git a/src/fsfw/version.cpp b/src/fsfw/version.cpp index 926e465ff..e4a62002e 100644 --- a/src/fsfw/version.cpp +++ b/src/fsfw/version.cpp @@ -1,8 +1,9 @@ #include "version.h" -#include "fsfw/FSFWVersion.h" #include +#include "fsfw/FSFWVersion.h" + #ifdef major #undef major #endif diff --git a/src/fsfw/version.h b/src/fsfw/version.h index 7cddf1938..bb4d0399a 100644 --- a/src/fsfw/version.h +++ b/src/fsfw/version.h @@ -29,7 +29,7 @@ class Version { } 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)); } diff --git a/tests/src/fsfw_tests/unit/version.cpp b/tests/src/fsfw_tests/unit/version.cpp index 92a930dcc..2967dfa54 100644 --- a/tests/src/fsfw_tests/unit/version.cpp +++ b/tests/src/fsfw_tests/unit/version.cpp @@ -17,15 +17,15 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") { fsfw::Version v1 = fsfw::Version(1, 1, 1); fsfw::Version v2 = fsfw::Version(1, 1, 1); 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); v1.revision -= 1; 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); v1.revision += 1; @@ -33,60 +33,60 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") { 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.major -= 1; 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; 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.minor -= 1; 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.minor += 2; v1.revision -= 1; 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.revision += 2; 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; REQUIRE(v1 == v2); REQUIRE(v1 <= v2); REQUIRE(v1 >= v2); - REQUIRE(not (v1 != v2)); + REQUIRE(not(v1 != v2)); #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "v" << fsfw::FSFW_VERSION << std::endl; #endif char verString[10] = {}; fsfw::FSFW_VERSION.getVersion(verString, sizeof(verString)); #if FSFW_DISABLE_PRINTOUT == 0 - printf("v%s\n",verString); + printf("v%s\n", verString); #endif }