v1.10.0 #220
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit e6130263ef144c5b1f6eafef734a0150a92d6cda
|
Subproject commit 6ea1eabb2dd3688f2c7db484cd141f15c9f4fe49
|
@ -28,17 +28,39 @@ void PayloadPcduHandler::doStartUp() {
|
|||||||
// Config error
|
// Config error
|
||||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||||
}
|
}
|
||||||
// TODO: Handle switching power on here
|
if (pwrStateMachine.getState() == power::States::IDLE) {
|
||||||
// TODO: Go to on mode here instead, indicating that the power is on
|
pwrStateMachine.start(MODE_ON, pwrSubmode);
|
||||||
// We are now in ON mode
|
}
|
||||||
|
auto opCode = pwrStateMachine.fsm();
|
||||||
|
if (opCode == power::OpCodes::TO_NOT_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) {
|
||||||
|
pwrStateMachine.reset();
|
||||||
|
quickTransitionAlreadyCalled = false;
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PayloadPcduHandler::doShutDown() {
|
||||||
|
if (not quickTransitionAlreadyCalled) {
|
||||||
|
quickTransitionBackToOff(false, false);
|
||||||
|
quickTransitionAlreadyCalled = true;
|
||||||
|
}
|
||||||
|
if (pwrStateMachine.getState() == power::States::IDLE) {
|
||||||
|
pwrStateMachine.start(MODE_OFF, 0);
|
||||||
|
}
|
||||||
|
auto opCode = pwrStateMachine.fsm();
|
||||||
|
if (opCode == power::OpCodes::TO_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) {
|
||||||
|
pwrStateMachine.reset();
|
||||||
|
// No need to set mode _MODE_POWER_DOWN, power switching was already handled
|
||||||
|
setMode(MODE_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) {
|
void PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||||
using namespace plpcdu;
|
using namespace plpcdu;
|
||||||
if (submode == plpcdu::NORMAL_ALL_ON or submode == plpcdu::NORMAL_ADC_ONLY) {
|
if (submode == plpcdu::NORMAL_ALL_ON or submode == plpcdu::NORMAL_ADC_ONLY) {
|
||||||
if (state == States::PL_PCDU_OFF) {
|
if (state == States::PL_PCDU_OFF) {
|
||||||
// TODO: Config error, emit error printout
|
sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF"
|
||||||
|
<< "detected" << std::endl;
|
||||||
setMode(MODE_OFF);
|
setMode(MODE_OFF);
|
||||||
}
|
}
|
||||||
if (state == States::POWER_CHANNELS_ON) {
|
if (state == States::POWER_CHANNELS_ON) {
|
||||||
@ -215,11 +237,11 @@ void PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subMode
|
|||||||
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||||
if (mode == _MODE_TO_NORMAL) {
|
if (mode == _MODE_TO_NORMAL) {
|
||||||
stateMachineToNormal(modeFrom, subModeFrom);
|
stateMachineToNormal(modeFrom, subModeFrom);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadPcduHandler::doShutDown() { transitionBackToOff(false); }
|
|
||||||
|
|
||||||
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
switch (adcState) {
|
switch (adcState) {
|
||||||
case (AdcStates::SEND_SETUP): {
|
case (AdcStates::SEND_SETUP): {
|
||||||
@ -402,7 +424,7 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
|||||||
opDivider.setDivider(divider);
|
opDivider.setDivider(divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadPcduHandler::transitionBackToOff(bool notifyFdir) {
|
void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir) {
|
||||||
States currentState = state;
|
States currentState = state;
|
||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||||
@ -414,7 +436,9 @@ void PayloadPcduHandler::transitionBackToOff(bool notifyFdir) {
|
|||||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||||
state = States::PL_PCDU_OFF;
|
state = States::PL_PCDU_OFF;
|
||||||
adcState = AdcStates::OFF;
|
adcState = AdcStates::OFF;
|
||||||
setMode(MODE_OFF);
|
if (startTransitionToOff) {
|
||||||
|
startTransition(MODE_OFF, 0);
|
||||||
|
}
|
||||||
if (notifyFdir) {
|
if (notifyFdir) {
|
||||||
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
|
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
|
||||||
}
|
}
|
||||||
@ -568,7 +592,8 @@ bool PayloadPcduHandler::checkVoltage(float val, float lowerBound, float upperBo
|
|||||||
serializeFloat(p2, val);
|
serializeFloat(p2, val);
|
||||||
triggerEvent(event, tooLarge, p2);
|
triggerEvent(event, tooLarge, p2);
|
||||||
transitionOk = false;
|
transitionOk = false;
|
||||||
transitionBackToOff(true);
|
quickTransitionBackToOff(true, true);
|
||||||
|
quickTransitionAlreadyCalled = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -580,7 +605,8 @@ bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event)
|
|||||||
serializeFloat(p2, val);
|
serializeFloat(p2, val);
|
||||||
triggerEvent(event, true, p2);
|
triggerEvent(event, true, p2);
|
||||||
transitionOk = false;
|
transitionOk = false;
|
||||||
transitionBackToOff(true);
|
quickTransitionBackToOff(true, true);
|
||||||
|
quickTransitionAlreadyCalled = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -670,7 +696,8 @@ void PayloadPcduHandler::handleFailureInjection(std::string output, Event event)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
triggerEvent(event, 0, 0);
|
triggerEvent(event, 0, 0);
|
||||||
transitionOk = false;
|
transitionOk = false;
|
||||||
transitionBackToOff(true);
|
quickTransitionBackToOff(true, true);
|
||||||
|
quickTransitionAlreadyCalled = true;
|
||||||
droToX8InjectionRequested = false;
|
droToX8InjectionRequested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,13 +4,14 @@
|
|||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include <fsfw/timemanager/Countdown.h>
|
#include <fsfw/timemanager/Countdown.h>
|
||||||
#include <mission/system/DualLanePowerStateMachine.h>
|
|
||||||
|
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||||
#include "mission/memory/SdCardMountedIF.h"
|
#include "mission/memory/SdCardMountedIF.h"
|
||||||
|
#include "mission/system/DualLanePowerStateMachine.h"
|
||||||
|
#include "mission/system/definitions.h"
|
||||||
|
|
||||||
#ifdef FSFW_OSAL_LINUX
|
#ifdef FSFW_OSAL_LINUX
|
||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
@ -98,6 +99,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
PL_PCDU_ON,
|
PL_PCDU_ON,
|
||||||
} state = States::PL_PCDU_OFF;
|
} state = States::PL_PCDU_OFF;
|
||||||
|
|
||||||
|
duallane::Submodes pwrSubmode = duallane::Submodes::A_SIDE;
|
||||||
|
|
||||||
enum class AdcMode { EXT_CONV, INT_CONV } adcMode = AdcMode::INT_CONV;
|
enum class AdcMode { EXT_CONV, INT_CONV } adcMode = AdcMode::INT_CONV;
|
||||||
|
|
||||||
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
||||||
@ -130,6 +133,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
GpioIF* gpioIF;
|
GpioIF* gpioIF;
|
||||||
SdCardMountedIF* sdcMan;
|
SdCardMountedIF* sdcMan;
|
||||||
plpcdu::PlPcduParameter params;
|
plpcdu::PlPcduParameter params;
|
||||||
|
bool quickTransitionAlreadyCalled = true;
|
||||||
|
|
||||||
PoolEntry<uint16_t> channelValues = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
PoolEntry<uint16_t> channelValues = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
PoolEntry<float> processedValues =
|
PoolEntry<float> processedValues =
|
||||||
@ -141,7 +145,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
// Main FDIR function which goes from any PL PCDU state back to all off
|
// Main FDIR function which goes from any PL PCDU state back to all off
|
||||||
void transitionBackToOff(bool notifyFdir);
|
void quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir);
|
||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user