right we need dummies ...

This commit is contained in:
Marius Eggert 2023-10-10 10:06:10 +02:00
parent 5f9247ee1e
commit 33d3e7686c
6 changed files with 62 additions and 0 deletions

View File

@ -43,3 +43,18 @@ ReturnValue_t PlPcduDummy::initializeLocalDataPool(localpool::DataPool &localDat
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry<float>({0.0}, true)); localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry<float>({0.0}, true));
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlPcduDummy::checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
uint32_t *msToReachTheMode) {
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
return NON_OP_STATE_OF_CHARGE;
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -1,7 +1,9 @@
#ifndef DUMMIES_PLPCDUDUMMY_H_ #ifndef DUMMIES_PLPCDUDUMMY_H_
#define DUMMIES_PLPCDUDUMMY_H_ #define DUMMIES_PLPCDUDUMMY_H_
#include <common/config/eive/objects.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
#include <mission/payload/payloadPcduDefinitions.h> #include <mission/payload/payloadPcduDefinitions.h>
class PlPcduDummy : public DeviceHandlerBase { class PlPcduDummy : public DeviceHandlerBase {
@ -29,6 +31,10 @@ class PlPcduDummy : public DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
ReturnValue_t checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
uint32_t *msToReachTheMode) override;
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
}; };
#endif /* DUMMIES_PLPCDUDUMMY_H_ */ #endif /* DUMMIES_PLPCDUDUMMY_H_ */

View File

@ -23,6 +23,21 @@ ReturnValue_t PlocMpsocDummy::buildCommandFromCommand(DeviceCommandId_t deviceCo
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocMpsocDummy::checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
uint32_t *msToReachTheMode) {
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
return NON_OP_STATE_OF_CHARGE;
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}
ReturnValue_t PlocMpsocDummy::scanForReply(const uint8_t *start, size_t len, ReturnValue_t PlocMpsocDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK; return returnvalue::OK;

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <common/config/eive/objects.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
#include "mission/power/defs.h" #include "mission/power/defs.h"
@ -24,6 +26,9 @@ class PlocMpsocDummy : public DeviceHandlerBase {
size_t commandDataLen) override; size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override; size_t *foundLen) override;
ReturnValue_t checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
uint32_t *msToReachTheMode) override;
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override; void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;

View File

@ -51,3 +51,19 @@ ReturnValue_t PlocSupervisorDummy::getSwitches(const uint8_t **switches,
*switches = reinterpret_cast<const uint8_t *>(&switchId); *switches = reinterpret_cast<const uint8_t *>(&switchId);
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocSupervisorDummy::checkModeCommand(Mode_t commandedMode,
Submode_t commandedSubmode,
uint32_t *msToReachTheMode) {
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
return NON_OP_STATE_OF_CHARGE;
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <common/config/eive/objects.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
#include <mission/power/defs.h> #include <mission/power/defs.h>
class PlocSupervisorDummy : public DeviceHandlerBase { class PlocSupervisorDummy : public DeviceHandlerBase {
@ -32,4 +34,7 @@ class PlocSupervisorDummy : public DeviceHandlerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override; ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
ReturnValue_t checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
uint32_t *msToReachTheMode) override;
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
}; };