From 6ea1eabb2dd3688f2c7db484cd141f15c9f4fe49 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 12:21:25 +0200 Subject: [PATCH 1/5] small order change in DHB --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 18f8a2f7..742fe6f9 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -361,14 +361,12 @@ void DeviceHandlerBase::doStateMachine() { } } break; case _MODE_WAIT_OFF: { - uint32_t currentUptime; - Clock::getUptime(¤tUptime); - if (powerSwitcher == nullptr) { setMode(MODE_OFF); break; } - + uint32_t currentUptime; + Clock::getUptime(¤tUptime); if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) { triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0); setMode(MODE_ERROR_ON); From 60972228ef7f8a3efaa192e857e409ea80b77efb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 12:47:09 +0200 Subject: [PATCH 2/5] reworked power switch interface --- src/fsfw/power/CMakeLists.txt | 12 ++++---- src/fsfw/power/DummyPowerSwitcher.cpp | 42 +++++++++++++++++++++++++++ src/fsfw/power/DummyPowerSwitcher.h | 31 ++++++++++++++++++++ src/fsfw/power/PowerSwitchIF.h | 4 +-- 4 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 src/fsfw/power/DummyPowerSwitcher.cpp create mode 100644 src/fsfw/power/DummyPowerSwitcher.h diff --git a/src/fsfw/power/CMakeLists.txt b/src/fsfw/power/CMakeLists.txt index 1c625db1..10e4a44d 100644 --- a/src/fsfw/power/CMakeLists.txt +++ b/src/fsfw/power/CMakeLists.txt @@ -1,7 +1,7 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - Fuse.cpp - PowerComponent.cpp - PowerSensor.cpp - PowerSwitcher.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + Fuse.cpp + PowerComponent.cpp + PowerSensor.cpp + PowerSwitcher.cpp + DummyPowerSwitcher.cpp ) \ No newline at end of file diff --git a/src/fsfw/power/DummyPowerSwitcher.cpp b/src/fsfw/power/DummyPowerSwitcher.cpp new file mode 100644 index 00000000..fe900e72 --- /dev/null +++ b/src/fsfw/power/DummyPowerSwitcher.cpp @@ -0,0 +1,42 @@ +#include "DummyPowerSwitcher.h" + +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; +} + +void DummyPowerSwitcher::setInitialFusesList(std::vector fuseList) { + this->fuseList = fuseList; +} + +ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) { + if (switchNr < switcherList.capacity()) { + switcherList[switchNr] = onOff; + } + return RETURN_FAILED; +} + +ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) { + if(fuseNr < fuseList.capacity()) { + fuseList[fuseNr] = FUSE_ON; + } + return RETURN_FAILED; +} + +ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const { + if (switchNr < switcherList.capacity()) { + return switcherList[switchNr]; + } + return HasReturnvaluesIF::RETURN_FAILED; +} + +ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { + return RETURN_OK; +} + +uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { + return 5000; +} diff --git a/src/fsfw/power/DummyPowerSwitcher.h b/src/fsfw/power/DummyPowerSwitcher.h new file mode 100644 index 00000000..39de608d --- /dev/null +++ b/src/fsfw/power/DummyPowerSwitcher.h @@ -0,0 +1,31 @@ +#ifndef FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ +#define FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ + +#include "PowerSwitchIF.h" +#include "definitions.h" + +#include +#include + +class DummyPowerSwitcher: public PowerSwitchIF { +public: + DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs = 5000); + + void setInitialSwitcherList(std::vector switcherList); + void setInitialFusesList(std::vector switcherList); + + virtual ReturnValue_t sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) override; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; + virtual ReturnValue_t getSwitchState(power::Switch_t switchNr) const override; + virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; + virtual uint32_t getSwitchDelayMs(void) const override; + +private: + std::vector switcherList; + std::vector fuseList; + uint32_t switchDelayMs = 5000; +}; + + + +#endif /* FSFW_SRC_FSFW_POWER_DUMMYPOWERSWITCHER_H_ */ diff --git a/src/fsfw/power/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h index b2c0cb9b..71c5523d 100644 --- a/src/fsfw/power/PowerSwitchIF.h +++ b/src/fsfw/power/PowerSwitchIF.h @@ -38,11 +38,11 @@ class PowerSwitchIF : public HasReturnvaluesIF { * @param switchNr * @param onOff on == @c SWITCH_ON; off != @c SWITCH_ON */ - virtual void sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) const = 0; + virtual ReturnValue_t sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) = 0; /** * Sends a command to the Power Unit to enable a certain fuse. */ - virtual void sendFuseOnCommand(uint8_t fuseNr) const = 0; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) = 0; /** * get the state of the Switches. From 79f3c7324a3db5a6d36b19ac41b5eb158a723c50 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 12:59:32 +0200 Subject: [PATCH 3/5] tweaks for dummy power switcher --- src/fsfw/power/DummyPowerSwitcher.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/fsfw/power/DummyPowerSwitcher.cpp b/src/fsfw/power/DummyPowerSwitcher.cpp index fe900e72..4f18901d 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; @@ -34,9 +34,10 @@ ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const } ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { - return RETURN_OK; + if (fuseNr < fuseList.capacity()) { + return fuseList[fuseNr]; + } + return HasReturnvaluesIF::RETURN_FAILED; } -uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { - return 5000; -} +uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { return switchDelayMs; } From 3ea9f999b746963efad591517e80ccd904cb051f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 12:59:51 +0200 Subject: [PATCH 4/5] apply auto-formatter --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 11 ++-- src/fsfw/devicehandlers/DeviceHandlerBase.h | 4 +- src/fsfw/power/DummyPowerSwitcher.h | 14 +++--- 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, 51 insertions(+), 49 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 742fe6f9..453ae8ac 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -125,13 +125,14 @@ ReturnValue_t DeviceHandlerBase::initialize() { return result; } 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(this->parent); HasHealthIF* healthIF = ObjectManager::instance()->get(this->parent); - if(modeIF != nullptr and healthIF != nullptr) { + if (modeIF != nullptr and healthIF != nullptr) { 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::setPowerSwitcher(PowerSwitchIF* switcher) { this->powerSwitcher = switcher; } +void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) { + this->powerSwitcher = switcher; +} diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index a8de34eb..69711bff 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -103,9 +103,9 @@ class DeviceHandlerBase : public DeviceHandlerIF, DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF *comCookie, FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20); - void setCustomFdir(FailureIsolationBase* fdir); + void setCustomFdir(FailureIsolationBase *fdir); void setParent(object_id_t parent); - void setPowerSwitcher(PowerSwitchIF* switcher); + void setPowerSwitcher(PowerSwitchIF *switcher); void setHkDestination(object_id_t hkDestination); /** diff --git a/src/fsfw/power/DummyPowerSwitcher.h b/src/fsfw/power/DummyPowerSwitcher.h index 39de608d..3582f8d7 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/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h index 71c5523d..bc883fbc 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 83679772..7608c6e7 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 1e4fe296..ed2a0037 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 926e465f..e4a62002 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 7cddf193..bb4d0399 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 92a930dc..2967dfa5 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 } From 1bc7a918694030d1f49f1d2998a289d77b132849 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 1 Apr 2022 14:08:29 +0200 Subject: [PATCH 5/5] apply auto-formatter --- hal/src/fsfw_hal/linux/gpio/Gpio.h | 15 ++++++--------- src/fsfw/action/CommandActionHelper.h | 3 +-- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 13 ++++++------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hal/src/fsfw_hal/linux/gpio/Gpio.h b/hal/src/fsfw_hal/linux/gpio/Gpio.h index 2ffe2146..40cc1df5 100644 --- a/hal/src/fsfw_hal/linux/gpio/Gpio.h +++ b/hal/src/fsfw_hal/linux/gpio/Gpio.h @@ -12,16 +12,13 @@ class Gpio { public: Gpio(gpioId_t gpioId, GpioIF* gpioIF) : gpioId(gpioId), gpioIF(gpioIF) { - if (gpioIF == nullptr) { - sif::error << "Gpio::Gpio: Invalid GpioIF" << std::endl; - } - } - ReturnValue_t pullHigh() { - return gpioIF->pullHigh(gpioId); - } - ReturnValue_t pullLow() { - return gpioIF->pullLow(gpioId); + if (gpioIF == nullptr) { + sif::error << "Gpio::Gpio: Invalid GpioIF" << std::endl; + } } + ReturnValue_t pullHigh() { return gpioIF->pullHigh(gpioId); } + ReturnValue_t pullLow() { return gpioIF->pullLow(gpioId); } + private: gpioId_t gpioId = gpio::NO_GPIO; GpioIF* gpioIF = nullptr; diff --git a/src/fsfw/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h index f0eac6d9..3b8acb04 100644 --- a/src/fsfw/action/CommandActionHelper.h +++ b/src/fsfw/action/CommandActionHelper.h @@ -18,8 +18,7 @@ class CommandActionHelper { virtual ~CommandActionHelper(); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data = nullptr, uint32_t size = 0); - ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, - SerializeIF* data); + ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data); ReturnValue_t initialize(); ReturnValue_t handleReply(CommandMessage* reply); uint8_t getCommandCount() const; diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 12473590..b0a5d1f0 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -466,16 +466,15 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId) { DeviceCommandId_t replyId = NO_COMMAND_ID; DeviceCommandMap::iterator command = cookieInfo.pendingCommand; if (command->second.useAlternativeReplyId) { - replyId = command->second.alternativeReplyId; - } - else { - replyId = commandId; + replyId = command->second.alternativeReplyId; + } else { + replyId = commandId; } DeviceReplyIter iter = deviceReplyMap.find(replyId); if (iter != deviceReplyMap.end()) { - if (iter->second.delayCycles != 0) { - return iter->second.replyLen; - } + if (iter->second.delayCycles != 0) { + return iter->second.replyLen; + } } return 0; }