From d80ef280dd493f4df4a4b6461be86bdd45bdc213 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 13:53:32 +0200 Subject: [PATCH] update power API --- fsfw | 2 +- mission/devices/HeaterHandler.cpp | 6 ++++-- mission/devices/HeaterHandler.h | 4 ++-- mission/devices/PCDUHandler.cpp | 13 ++++++++----- mission/devices/PCDUHandler.h | 4 ++-- tmtc | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fsfw b/fsfw index e6130263..3ea9f999 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e6130263ef144c5b1f6eafef734a0150a92d6cda +Subproject commit 3ea9f999b746963efad591517e80ccd904cb051f diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 255ba6ec..53acf02e 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -134,7 +134,7 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t return result; } -void HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const { +ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { ReturnValue_t result; store_address_t storeAddress; uint8_t commandData[2]; @@ -338,7 +338,9 @@ gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) { MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } -void HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) const {} +ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { + return RETURN_OK; +} ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0; } diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 2a8ce555..18b821ec 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -43,8 +43,8 @@ class HeaterHandler : public ExecutableObjectIF, virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; - virtual void sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const override; - virtual void sendFuseOnCommand(uint8_t fuseNr) const override; + virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; /** * @brief This function will be called from the Heater object to check * the current switch state. diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index e54222b1..e59f2ab7 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -205,7 +205,7 @@ void PCDUHandler::updatePdu1SwitchStates() { LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; } -void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const { +ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { using namespace pcduSwitches; ReturnValue_t result; uint16_t memoryAddress = 0; @@ -261,7 +261,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const } // This is a dangerous command. Reject/Igore it for now case pcduSwitches::PDU2_CH0_Q7S: { - return; + return RETURN_FAILED; // memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_Q7S; // pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); // break; @@ -309,7 +309,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const default: { sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl; - return; + return RETURN_FAILED; } } @@ -322,7 +322,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const break; default: sif::error << "PCDUHandler::sendSwitchCommand: Invalid state commanded" << std::endl; - return; + return RETURN_FAILED; } GomspaceSetParamMessage setParamMessage(memoryAddress, ¶meterValue, parameterValueSize); @@ -347,9 +347,12 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const // Can't use trigger event because of const function constraint, but this hack seems to work this->forwardEvent(power::SWITCH_CMD_SENT, parameterValue, switchNr); } + return RETURN_OK; } -void PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) const {} +ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { + return RETURN_OK; +} ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) { diff --git a/mission/devices/PCDUHandler.h b/mission/devices/PCDUHandler.h index 3d014205..c44052bb 100644 --- a/mission/devices/PCDUHandler.h +++ b/mission/devices/PCDUHandler.h @@ -33,8 +33,8 @@ class PCDUHandler : public PowerSwitchIF, store_address_t storeId = storeId::INVALID_STORE_ADDRESS, bool* clearMessage = nullptr) override; - virtual void sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const override; - virtual void sendFuseOnCommand(uint8_t fuseNr) const override; + virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; virtual ReturnValue_t getSwitchState(uint8_t switchNr) const override; virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; virtual uint32_t getSwitchDelayMs(void) const override; diff --git a/tmtc b/tmtc index 43a534db..e3743042 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 43a534db9cf8ee14e6c1296dac8b3e2c3c94b240 +Subproject commit e37430423e814b9e05f25d63970f2c2b5048cfb1