fdir update #158

Merged
gaisser merged 6 commits from KSat/fsfw:mueller/devices/FDIR into master 2020-09-01 12:21:51 +02:00
2 changed files with 5 additions and 6 deletions
Showing only changes of commit 8f2d5a5528 - Show all commits

View File

@ -5,7 +5,8 @@
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../thermal/ThermalComponentIF.h"
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = 0;
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId =
objects::NO_OBJECT;
DeviceHandlerFailureIsolation::DeviceHandlerFailureIsolation(object_id_t owner,
object_id_t parent) :
@ -70,7 +71,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
break;
//****Power*****
case PowerSwitchIF::SWITCH_WENT_OFF:
if(hasPowerConfirmation) {
if(powerConfirmation != MessageQueueIF::NO_QUEUE) {
result = sendConfirmationRequest(event, powerConfirmation);
if (result == RETURN_OK) {
setFdirState(DEVICE_MIGHT_BE_OFF);
@ -171,7 +172,6 @@ ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
powerConfirmationId);
if (power != nullptr) {
powerConfirmation = power->getEventReceptionQueue();

Can we avoid the aditional bool by checking powerConfirmation != NO_QUEUE?

Can we avoid the aditional bool by checking powerConfirmation != NO_QUEUE?

Yeah it's better like that.

Yeah it's better like that.
hasPowerConfirmation = true;
}
return RETURN_OK;

View File

@ -3,11 +3,11 @@
#include "../fdir/FaultCounter.h"
#include "../fdir/FailureIsolationBase.h"
namespace Factory{
void setStaticFrameworkObjectIds();
}
class DeviceHandlerFailureIsolation: public FailureIsolationBase {
friend void (Factory::setStaticFrameworkObjectIds)();
friend class Heater;
@ -28,8 +28,7 @@ protected:
NONE, RECOVERY_ONGOING, DEVICE_MIGHT_BE_OFF, AWAIT_SHUTDOWN
};
FDIRState fdirState;
bool hasPowerConfirmation = false;
MessageQueueId_t powerConfirmation;
MessageQueueId_t powerConfirmation = MessageQueueIF::NO_QUEUE;
static object_id_t powerConfirmationId;
// TODO: Are those hardcoded value? How can they be changed.
static const uint32_t MAX_REBOOT = 1;

These values are used to initialize the defaults. Can be overwritten by child implementations.

These values are used to initialize the defaults. Can be overwritten by child implementations.

ahhh that makes sense. maybe put DEFAULT_ in name to make it more explicit?

ahhh that makes sense. maybe put DEFAULT_ in name to make it more explicit?