important fix, 0 init removed

This commit is contained in:
Robin Müller 2020-08-27 20:07:03 +02:00
parent 8f2d5a5528
commit c4c607776c
2 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,7 @@
#include "DeviceHandlerBase.h"
#include "DeviceHandlerFailureIsolation.h"
#include "../devicehandlers/DeviceHandlerIF.h"
#include "../modes/HasModesIF.h"
#include "../health/HealthTableIF.h"
#include "../power/Fuse.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
@ -11,12 +13,15 @@ object_id_t DeviceHandlerFailureIsolation::powerConfirmationId =
DeviceHandlerFailureIsolation::DeviceHandlerFailureIsolation(object_id_t owner,
object_id_t parent) :
FailureIsolationBase(owner, parent),
strangeReplyCount(MAX_STRANGE_REPLIES, STRANGE_REPLIES_TIME_MS,
strangeReplyCount(DEFAULT_MAX_STRANGE_REPLIES,
DEFAULT_STRANGE_REPLIES_TIME_MS,
parameterDomainBase++),
missedReplyCount( MAX_MISSED_REPLY_COUNT, MISSED_REPLY_TIME_MS,
missedReplyCount( DEFAULT_MAX_MISSED_REPLY_COUNT,
DEFAULT_MISSED_REPLY_TIME_MS,
parameterDomainBase++),
recoveryCounter(MAX_REBOOT, REBOOT_TIME_MS, parameterDomainBase++),
fdirState(NONE), powerConfirmation(0) {
recoveryCounter(DEFAULT_MAX_REBOOT, DEFAULT_REBOOT_TIME_MS,
parameterDomainBase++),
fdirState(NONE) {
}
DeviceHandlerFailureIsolation::~DeviceHandlerFailureIsolation() {

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#include "../fdir/FaultCounter.h"
#include "../fdir/FailureIsolationBase.h"
@ -20,23 +20,27 @@ public:
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex);
protected:
FaultCounter strangeReplyCount;
FaultCounter missedReplyCount;
FaultCounter recoveryCounter;
enum FDIRState {
NONE, RECOVERY_ONGOING, DEVICE_MIGHT_BE_OFF, AWAIT_SHUTDOWN
};
FDIRState fdirState;
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;
static const uint32_t REBOOT_TIME_MS = 180000;
static const uint32_t MAX_STRANGE_REPLIES = 10;
static const uint32_t STRANGE_REPLIES_TIME_MS = 10000;
static const uint32_t MAX_MISSED_REPLY_COUNT = 5;
static const uint32_t MISSED_REPLY_TIME_MS = 10000;
static const uint32_t DEFAULT_MAX_REBOOT = 1;
static const uint32_t DEFAULT_REBOOT_TIME_MS = 180000;
static const uint32_t DEFAULT_MAX_STRANGE_REPLIES = 10;
static const uint32_t DEFAULT_STRANGE_REPLIES_TIME_MS = 10000;
static const uint32_t DEFAULT_MAX_MISSED_REPLY_COUNT = 5;
static const uint32_t DEFAULT_MISSED_REPLY_TIME_MS = 10000;
virtual ReturnValue_t eventReceived(EventMessage* event);
virtual void eventConfirmed(EventMessage* event);
void wasParentsFault(EventMessage* event);
@ -50,4 +54,4 @@ protected:
bool isFdirInActionOrAreWeFaulty(EventMessage* event);
};
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_ */
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_ */