Merge branch 'development' into mueller/serialiize-element-coverity

This commit is contained in:
Steffen Gaisser 2021-04-20 17:52:01 +02:00
commit a0caa92a8a
6 changed files with 363 additions and 358 deletions

View File

@ -16,9 +16,9 @@ ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
CommandMessage command; CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command); ReturnValue_t result = commandQueue->receiveMessage(&command);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
} }
return HasReturnvaluesIF::RETURN_OK; return result;
} }
ReturnValue_t HealthDevice::initialize() { ReturnValue_t HealthDevice::initialize() {

View File

@ -99,8 +99,8 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s
sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString << sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString <<
" | " << infoString << std::endl; " | " << infoString << std::endl;
#else #else
sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString, sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(),
errorSrcString, infoString); errorSrcString.c_str(), infoString.c_str());
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
if(sleepDuration > 0) { if(sleepDuration > 0) {

View File

@ -1,15 +1,13 @@
#include "../devicehandlers/DeviceHandlerFailureIsolation.h"
#include "Heater.h" #include "Heater.h"
#include "../devicehandlers/DeviceHandlerFailureIsolation.h"
#include "../power/Fuse.h" #include "../power/Fuse.h"
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
Heater::Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1) : Heater::Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1) :
HealthDevice(objectId, 0), internalState(STATE_OFF), powerSwitcher( HealthDevice(objectId, 0), internalState(STATE_OFF), switch0(switch0), switch1(switch1),
NULL), pcduQueueId(0), switch0(switch0), switch1(switch1), wasOn( heaterOnCountdown(10800000)/*about two orbits*/,
false), timedOut(false), reactedToBeingFaulty(false), passive( parameterHelper(this) {
false), eventQueue(NULL), heaterOnCountdown(10800000)/*about two orbits*/, parameterHelper(
this), lastAction(CLEAR) {
eventQueue = QueueFactory::instance()->createMessageQueue(); eventQueue = QueueFactory::instance()->createMessageQueue();
} }
@ -226,7 +224,6 @@ void Heater::setSwitch(uint8_t number, ReturnValue_t state,
triggerEvent(HEATER_STAYED_ON); triggerEvent(HEATER_STAYED_ON);
} }
} }
//SHOULDDO MiniOps during switch timeout leads to a faulty switch
} }
} }
} }
@ -286,7 +283,10 @@ void Heater::handleQueue() {
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
return; return;
} }
parameterHelper.handleParameterMessage(&command); result = parameterHelper.handleParameterMessage(&command);
if (result == HasReturnvaluesIF::RETURN_OK) {
return;
}
} }
} }
@ -316,7 +316,9 @@ void Heater::handleEventQueue() {
switch (event.getEvent()) { switch (event.getEvent()) {
case Fuse::FUSE_WENT_OFF: case Fuse::FUSE_WENT_OFF:
case HEATER_STAYED_OFF: case HEATER_STAYED_OFF:
case HEATER_STAYED_ON://Setting it faulty does not help, but we need to reach a stable state and can check for being faulty before throwing this event again. // HEATER_STAYED_ON is a setting if faulty does not help, but we need to reach a stable state and can check
// for being faulty before throwing this event again.
case HEATER_STAYED_ON:
if (healthHelper.healthTable->isCommandable(getObjectId())) { if (healthHelper.healthTable->isCommandable(getObjectId())) {
healthHelper.setHealth(HasHealthIF::FAULTY); healthHelper.setHealth(HasHealthIF::FAULTY);
internalState = STATE_FAULTY; internalState = STATE_FAULTY;

View File

@ -1,13 +1,13 @@
#ifndef FRAMEWORK_THERMAL_HEATER_H_ #ifndef FSFW_THERMAL_HEATER_H_
#define FRAMEWORK_THERMAL_HEATER_H_ #define FSFW_THERMAL_HEATER_H_
#include "../devicehandlers/HealthDevice.h" #include "../devicehandlers/HealthDevice.h"
#include "../parameters/ParameterHelper.h" #include "../parameters/ParameterHelper.h"
#include "../power/PowerSwitchIF.h" #include "../power/PowerSwitchIF.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../timemanager/Countdown.h" #include "../timemanager/Countdown.h"
#include <stdint.h> #include <cstdint>
//class RedundantHeater;
class Heater: public HealthDevice, public ReceivesParameterMessagesIF { class Heater: public HealthDevice, public ReceivesParameterMessagesIF {
friend class RedundantHeater; friend class RedundantHeater;
@ -47,35 +47,38 @@ protected:
STATE_PASSIVE, STATE_PASSIVE,
STATE_WAIT_FOR_SWITCHES_ON, STATE_WAIT_FOR_SWITCHES_ON,
STATE_WAIT_FOR_SWITCHES_OFF, STATE_WAIT_FOR_SWITCHES_OFF,
STATE_WAIT_FOR_FDIR, //used to avoid doing anything until fdir decided what to do STATE_WAIT_FOR_FDIR, // Used to avoid doing anything until fdir decided what to do
STATE_FAULTY, STATE_FAULTY,
STATE_WAIT, //used when waiting for system to recover from miniops STATE_WAIT, // Used when waiting for system to recover from miniops
STATE_EXTERNAL_CONTROL //entered when under external control and a fdir reaction would be triggered. This is useful when leaving external control into an unknown state // Entered when under external control and a fdir reaction would be triggered.
//if no fdir reaction is triggered under external control the state is still ok and no need for any special treatment is needed // This is useful when leaving external control into an unknown state
STATE_EXTERNAL_CONTROL
// If no fdir reaction is triggered under external control the state is still ok and
// no need for any special treatment is needed
} internalState; } internalState;
PowerSwitchIF *powerSwitcher; PowerSwitchIF *powerSwitcher = nullptr;
MessageQueueId_t pcduQueueId; MessageQueueId_t pcduQueueId = MessageQueueIF::NO_QUEUE;
uint8_t switch0; uint8_t switch0;
uint8_t switch1; uint8_t switch1;
bool wasOn; bool wasOn = false;
bool timedOut; bool timedOut = false;
bool reactedToBeingFaulty; bool reactedToBeingFaulty = false;
bool passive; bool passive = false;
MessageQueueIF* eventQueue; MessageQueueIF* eventQueue = nullptr;
Countdown heaterOnCountdown; Countdown heaterOnCountdown;
Countdown switchCountdown; Countdown switchCountdown;
ParameterHelper parameterHelper; ParameterHelper parameterHelper;
enum Action { enum Action {
SET, CLEAR SET, CLEAR
} lastAction; } lastAction = CLEAR;
void doAction(Action action); void doAction(Action action);
@ -87,4 +90,4 @@ protected:
void handleEventQueue(); void handleEventQueue();
}; };
#endif /* FRAMEWORK_THERMAL_HEATER_H_ */ #endif /* FSFW_THERMAL_HEATER_H_ */

View File

@ -25,6 +25,6 @@ uint32_t TimeMessage::getCounterValue() {
return temp; return temp;
} }
size_t TimeMessage::getMinimumMessageSize() { size_t TimeMessage::getMinimumMessageSize() const {
return this->MAX_SIZE; return this->MAX_SIZE;
} }

View File

@ -11,7 +11,7 @@ protected:
* @brief This call always returns the same fixed size of the message. * @brief This call always returns the same fixed size of the message.
* @return Returns HEADER_SIZE + \c sizeof(timeval) + sizeof(uint32_t). * @return Returns HEADER_SIZE + \c sizeof(timeval) + sizeof(uint32_t).
*/ */
size_t getMinimumMessageSize(); size_t getMinimumMessageSize() const override;
public: public:
/** /**