heater tweaks + coverity fix

This commit is contained in:
Robin Müller 2021-04-20 16:12:50 +02:00
parent 17adb2cc3e
commit 54ff8f9341
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 359 additions and 352 deletions

View File

@ -1,15 +1,14 @@
#include "../devicehandlers/DeviceHandlerFailureIsolation.h"
#include "Heater.h"
#include "../devicehandlers/DeviceHandlerFailureIsolation.h"
#include "../power/Fuse.h"
#include "../ipc/QueueFactory.h"
Heater::Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1) :
HealthDevice(objectId, 0), internalState(STATE_OFF), powerSwitcher(
NULL), pcduQueueId(0), switch0(switch0), switch1(switch1), wasOn(
false), timedOut(false), reactedToBeingFaulty(false), passive(
false), eventQueue(NULL), heaterOnCountdown(10800000)/*about two orbits*/, parameterHelper(
this), lastAction(CLEAR) {
NULL), pcduQueueId(0), switch0(switch0), switch1(switch1), wasOn(false), timedOut(false),
reactedToBeingFaulty(false), passive(false), eventQueue(NULL),
heaterOnCountdown(10800000)/*about two orbits*/, parameterHelper(this), lastAction(CLEAR) {
eventQueue = QueueFactory::instance()->createMessageQueue();
}
@ -286,7 +285,10 @@ void Heater::handleQueue() {
if (result == HasReturnvaluesIF::RETURN_OK) {
return;
}
parameterHelper.handleParameterMessage(&command);
result = parameterHelper.handleParameterMessage(&command);
if (result == HasReturnvaluesIF::RETURN_OK) {
return;
}
}
}
@ -316,7 +318,9 @@ void Heater::handleEventQueue() {
switch (event.getEvent()) {
case Fuse::FUSE_WENT_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.
// 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.
case HEATER_STAYED_ON:
if (healthHelper.healthTable->isCommandable(getObjectId())) {
healthHelper.setHealth(HasHealthIF::FAULTY);
internalState = STATE_FAULTY;

View File

@ -1,13 +1,13 @@
#ifndef FRAMEWORK_THERMAL_HEATER_H_
#define FRAMEWORK_THERMAL_HEATER_H_
#ifndef FSFW_THERMAL_HEATER_H_
#define FSFW_THERMAL_HEATER_H_
#include "../devicehandlers/HealthDevice.h"
#include "../parameters/ParameterHelper.h"
#include "../power/PowerSwitchIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../timemanager/Countdown.h"
#include <stdint.h>
//class RedundantHeater;
#include <cstdint>
class Heater: public HealthDevice, public ReceivesParameterMessagesIF {
friend class RedundantHeater;
@ -47,11 +47,14 @@ protected:
STATE_PASSIVE,
STATE_WAIT_FOR_SWITCHES_ON,
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_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
//if no fdir reaction is triggered under external control the state is still ok and no need for any special treatment is needed
STATE_WAIT, // Used when waiting for system to recover from miniops
// Entered when under external control and a fdir reaction would be triggered.
// 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;
PowerSwitchIF *powerSwitcher;
@ -87,4 +90,4 @@ protected:
void handleEventQueue();
};
#endif /* FRAMEWORK_THERMAL_HEATER_H_ */
#endif /* FSFW_THERMAL_HEATER_H_ */