adc check handling done
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-02-25 19:07:47 +01:00
parent a5e2208e01
commit 49e58b2365
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 638 additions and 489 deletions

View File

@ -1198,8 +1198,9 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
// Create device handler components // Create device handler components
auto plPcduHandler = new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, auto plPcduHandler =
spiCookie, gpioComIF, SdCardManager::instance(), false); new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF,
SdCardManager::instance(), false);
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler); spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
static_cast<void>(plPcduHandler); static_cast<void>(plPcduHandler);
#if OBSW_TEST_PL_PCDU == 1 #if OBSW_TEST_PL_PCDU == 1

View File

@ -1,6 +1,6 @@
#include <fsfw/ipc/MutexGuard.h>
#include "SdCardManager.h" #include "SdCardManager.h"
#include <fsfw/ipc/MutexGuard.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>

View File

@ -10,12 +10,12 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "mission/memory/definitions.h"
#include "mission/memory/SdCardMountedIF.h"
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"
#include "fsfw/events/Event.h" #include "fsfw/events/Event.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw_hal/linux/CommandExecutor.h" #include "fsfw_hal/linux/CommandExecutor.h"
#include "mission/memory/SdCardMountedIF.h"
#include "mission/memory/definitions.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
class MutexIF; class MutexIF;

View File

@ -39,6 +39,8 @@ void PayloadPcduHandler::doStartUp() {
transitionOk = false; transitionOk = false;
// We are now in ON mode // We are now in ON mode
startTransition(MODE_NORMAL, 0); startTransition(MODE_NORMAL, 0);
adcCountdown.setTimeout(50);
adcCountdown.resetTimer();
adcState = AdcStates::BOOT_DELAY; adcState = AdcStates::BOOT_DELAY;
// The ADC can now be read. If the values are not close to zero, we should not allow // The ADC can now be read. If the values are not close to zero, we should not allow
// transition // transition
@ -47,6 +49,139 @@ void PayloadPcduHandler::doStartUp() {
} }
} }
void PayloadPcduHandler::stateMachineToNormal() {
using namespace plpcdu;
if (adcState == AdcStates::BOOT_DELAY) {
if (adcCountdown.hasTimedOut()) {
adcState = AdcStates::SEND_SETUP;
adcCmdExecuted = false;
}
}
if (adcState == AdcStates::SEND_SETUP) {
if (adcCmdExecuted) {
adcState = AdcStates::NORMAL;
setMode(MODE_NORMAL, NORMAL_ADC_ONLY);
adcCountdown.setTimeout(100);
adcCountdown.resetTimer();
adcCmdExecuted = false;
}
}
if (submode == plpcdu::NORMAL_ALL_ON) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (not commandExecuted) {
float waitTime = SSR_TO_DRO_WAIT_TIME;
params.getValue(PlPcduParameter::SSR_TO_DRO_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
commandExecuted = true;
// TODO: For now, skip ADC check
transitionOk = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_DRO;
// Now start monitoring for negative voltages instead
monMode = MonitoringMode::NEGATIVE;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_DRO) {
if (not commandExecuted) {
float waitTime = DRO_TO_X8_WAIT_TIME;
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on DRO and start monitoring for negative voltages
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
adcCountdown.setTimeout(100);
adcCountdown.resetTimer();
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_X8;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_X8) {
if (not commandExecuted) {
float waitTime = X8_TO_TX_WAIT_TIME;
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on X8
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
adcCountdown.setTimeout(100);
adcCountdown.resetTimer();
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_TX;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_TX) {
if (not commandExecuted) {
float waitTime = TX_TO_MPA_WAIT_TIME;
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on TX
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
// Wait for 100 ms before checking ADC values
adcCountdown.setTimeout(100);
adcCountdown.resetTimer();
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_MPA;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_MPA) {
if (not commandExecuted) {
float waitTime = MPA_TO_HPA_WAIT_TIME;
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on MPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
// Wait for 100 ms before checking ADC values
adcCountdown.setTimeout(100);
adcCountdown.resetTimer();
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_HPA;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_HPA) {
if (not commandExecuted) {
// Switch on HPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::PCDU_ON;
setMode(MODE_NORMAL, plpcdu::NORMAL_ALL_ON);
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}
}
}
}
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(); stateMachineToNormal();
@ -269,18 +404,79 @@ void PayloadPcduHandler::checkAdcValues() {
adcSet.processed[U_X8_DIV_6] = static_cast<float>(adcSet.channels[9]) * SCALE_VOLTAGE; adcSet.processed[U_X8_DIV_6] = static_cast<float>(adcSet.channels[9]) * SCALE_VOLTAGE;
adcSet.processed[I_DRO] = static_cast<float>(adcSet.channels[10]) * SCALE_CURRENT_DRO * 1000.0; adcSet.processed[I_DRO] = static_cast<float>(adcSet.channels[10]) * SCALE_CURRENT_DRO * 1000.0;
adcSet.processed[U_DRO_DIV_6] = static_cast<float>(adcSet.channels[11]) * SCALE_VOLTAGE; adcSet.processed[U_DRO_DIV_6] = static_cast<float>(adcSet.channels[11]) * SCALE_VOLTAGE;
if(state >= States::ON_TRANS_DRO) { float lowerBound = 0.0;
if(adcSet.processed[U_BAT_DIV_6] < -6.0 or adcSet.processed[U_BAT_DIV_6] > -3.3) { float upperBound = 0.0;
bool tooLarge = false; bool adcTransition = false;
if(adcSet.processed[U_BAT_DIV_6] > -3.3) { adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy();
tooLarge = true; // Now check against voltage and current limits, depending on state
if (state >= States::ON_TRANS_DRO and not adcTransition) {
params.getValue(PlPcduParameter::NEG_V_LOWER_BOUND_K, lowerBound);
params.getValue(PlPcduParameter::NEG_V_UPPER_BOUND_K, upperBound);
if (not checkVoltage(adcSet.processed[U_NEG_V_FB], lowerBound, upperBound,
NEG_V_OUT_OF_BOUNDS)) {
return;
} }
uint32_t rawVoltage = 0; params.getValue(PlPcduParameter::DRO_U_LOWER_BOUND_K, lowerBound);
size_t serSize = 0; params.getValue(PlPcduParameter::DRO_U_UPPER_BOUND_K, upperBound);
SerializeAdapter::serialize(&adcSet.processed[U_BAT_DIV_6], if (not checkVoltage(adcSet.processed[U_DRO_DIV_6], lowerBound, upperBound,
reinterpret_cast<uint8_t*>(&rawVoltage), &serSize, 4, SerializeIF::Endianness::NETWORK); U_DRO_OUT_OF_BOUNDS)) {
triggerEvent(NEG_V_OUT_OF_BOUNDS, tooLarge, rawVoltage); return;
transitionBackToOff(); }
params.getValue(PlPcduParameter::DRO_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_DRO], upperBound, I_DRO_OUT_OF_BOUNDS)) {
return;
}
}
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy();
if (state >= States::ON_TRANS_X8 and not adcTransition) {
params.getValue(PlPcduParameter::X8_U_LOWER_BOUND_K, lowerBound);
params.getValue(PlPcduParameter::X8_U_UPPER_BOUND_K, upperBound);
if (not checkVoltage(adcSet.processed[U_X8_DIV_6], lowerBound, upperBound,
U_X8_OUT_OF_BOUNDS)) {
return;
}
params.getValue(PlPcduParameter::X8_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_X8], upperBound, I_X8_OUT_OF_BOUNDS)) {
return;
}
}
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy();
if (state >= States::ON_TRANS_TX and not adcTransition) {
params.getValue(PlPcduParameter::TX_U_LOWER_BOUND_K, lowerBound);
params.getValue(PlPcduParameter::TX_U_UPPER_BOUND_K, upperBound);
if (not checkVoltage(adcSet.processed[U_TX_DIV_6], lowerBound, upperBound,
U_TX_OUT_OF_BOUNDS)) {
return;
}
params.getValue(PlPcduParameter::TX_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_TX], upperBound, I_TX_OUT_OF_BOUNDS)) {
return;
}
}
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy();
if (state >= States::ON_TRANS_MPA and not adcTransition) {
params.getValue(PlPcduParameter::MPA_U_LOWER_BOUND_K, lowerBound);
params.getValue(PlPcduParameter::MPA_U_UPPER_BOUND_K, upperBound);
if (not checkVoltage(adcSet.processed[U_MPA_DIV_6], lowerBound, upperBound,
U_MPA_OUT_OF_BOUNDS)) {
return;
}
params.getValue(PlPcduParameter::MPA_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_MPA], upperBound, I_MPA_OUT_OF_BOUNDS)) {
return;
}
}
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy();
if (state >= States::ON_TRANS_HPA and not adcTransition) {
params.getValue(PlPcduParameter::HPA_U_LOWER_BOUND_K, lowerBound);
params.getValue(PlPcduParameter::HPA_U_UPPER_BOUND_K, upperBound);
if (not checkVoltage(adcSet.processed[U_HPA_DIV_6], lowerBound, upperBound,
U_HPA_OUT_OF_BOUNDS)) {
return;
}
params.getValue(PlPcduParameter::HPA_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_HPA], upperBound, I_HPA_OUT_OF_BOUNDS)) {
return;
} }
} }
} }
@ -296,125 +492,38 @@ void PayloadPcduHandler::checkJsonFileInit() {
} }
} }
void PayloadPcduHandler::stateMachineToNormal() { bool PayloadPcduHandler::checkVoltage(float val, float lowerBound, float upperBound, Event event) {
using namespace plpcdu; bool tooLarge = false;
if (adcState == AdcStates::BOOT_DELAY) { if (val < lowerBound or val > upperBound) {
if (adcCountdown.hasTimedOut()) { if (val > upperBound) {
adcState = AdcStates::SEND_SETUP; tooLarge = true;
adcCmdExecuted = false; } else {
tooLarge = false;
} }
uint32_t p2 = 0;
serializeFloat(p2, val);
triggerEvent(event, tooLarge, p2);
transitionBackToOff();
return false;
} }
if (adcState == AdcStates::SEND_SETUP) { return true;
if (adcCmdExecuted) {
adcState = AdcStates::NORMAL;
setMode(MODE_NORMAL, NORMAL_ADC_ONLY);
adcCmdExecuted = false;
}
}
if (submode == plpcdu::NORMAL_ALL_ON) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (not commandExecuted) {
float waitTime = SSR_TO_DRO_WAIT_TIME;
params.getValue(PlPcduParameter::SSR_TO_DRO_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
commandExecuted = true;
// TODO: For now, skip ADC check
transitionOk = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_DRO;
// Now start monitoring for negative voltages instead
monMode = MonitoringMode::NEGATIVE;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_DRO) {
if (not commandExecuted) {
float waitTime = DRO_TO_X8_WAIT_TIME;
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on DRO and start monitoring for negative voltages
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_X8;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_X8) {
if (not commandExecuted) {
float waitTime = X8_TO_TX_WAIT_TIME;
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on X8
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_TX;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_TX) {
if (not commandExecuted) {
float waitTime = TX_TO_MPA_WAIT_TIME;
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on TX
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_MPA;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_MPA) {
if (not commandExecuted) {
float waitTime = MPA_TO_HPA_WAIT_TIME;
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on MPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_HPA;
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_HPA) {
if (not commandExecuted) {
// Switch on HPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::PCDU_ON;
setMode(MODE_NORMAL, plpcdu::NORMAL_ALL_ON);
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
} }
bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event) {
if (val > upperBound) {
uint32_t p2 = 0;
serializeFloat(p2, val);
triggerEvent(event, true, p2);
transitionBackToOff();
return false;
} }
return true;
} }
ReturnValue_t PayloadPcduHandler::serializeFloat(uint32_t& param, float val) {
size_t dummy = 0;
return SerializeAdapter::serialize(&val, reinterpret_cast<uint8_t*>(&param), &dummy, 4,
SerializeIF::Endianness::NETWORK);
} }
#ifdef FSFW_OSAL_LINUX #ifdef FSFW_OSAL_LINUX
@ -546,4 +655,5 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
#endif #endif

View File

@ -144,6 +144,9 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void checkAdcValues(); void checkAdcValues();
void checkJsonFileInit(); void checkJsonFileInit();
void stateMachineToNormal(); void stateMachineToNormal();
bool checkVoltage(float val, float lowerBound, float upperBound, Event event);
bool checkCurrent(float val, float upperBound, Event event);
ReturnValue_t serializeFloat(uint32_t& param, float val);
}; };
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */ #endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */

View File

@ -1,18 +1,17 @@
#ifndef LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ #ifndef LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
#define LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ #define LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <cstddef>
#include <filesystem>
#include <nlohmann/json.hpp>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "mission/devices/max1227.h" #include "mission/devices/max1227.h"
#include "mission/memory/NVMParameterBase.h" #include "mission/memory/NVMParameterBase.h"
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <nlohmann/json.hpp>
#include <cstddef>
#include <filesystem>
namespace plpcdu { namespace plpcdu {
using namespace max1227; using namespace max1227;
@ -84,35 +83,35 @@ static constexpr float SCALE_CURRENT_DRO = MAX122X_SCALE / (GAIN_INA169 * R_SHUN
// TODO: Make these configurable parameters using a JSON file // TODO: Make these configurable parameters using a JSON file
// Upper bound of currents in milliamperes [mA] // Upper bound of currents in milliamperes [mA]
static constexpr float NEG_V_LOWER_BOUND = -6.0; static constexpr double NEG_V_LOWER_BOUND = -6.0;
static constexpr float NEG_V_UPPER_BOUND = -3.3; static constexpr double NEG_V_UPPER_BOUND = -3.3;
static constexpr float DRO_U_LOWER_BOUND = 5.0; static constexpr double DRO_U_LOWER_BOUND = 5.0;
static constexpr float DRO_U_UPPER_BOUND = 7.0; static constexpr double DRO_U_UPPER_BOUND = 7.0;
static constexpr float DRO_I_UPPER_BOUND = 40.0; static constexpr double DRO_I_UPPER_BOUND = 40.0;
static constexpr float X8_U_LOWER_BOUND = 2.6; static constexpr double X8_U_LOWER_BOUND = 2.6;
static constexpr float X8_U_UPPER_BOUND = 4.0; static constexpr double X8_U_UPPER_BOUND = 4.0;
static constexpr float X8_I_UPPER_BOUND = 100.0; static constexpr double X8_I_UPPER_BOUND = 100.0;
static constexpr float TX_U_LOWER_BOUND = 2.6; static constexpr double TX_U_LOWER_BOUND = 2.6;
static constexpr float TX_U_UPPER_BOUND = 4.0; static constexpr double TX_U_UPPER_BOUND = 4.0;
static constexpr float TX_I_UPPER_BOUND = 250.0; static constexpr double TX_I_UPPER_BOUND = 250.0;
static constexpr float MPA_U_LOWER_BOUND = 2.6; static constexpr double MPA_U_LOWER_BOUND = 2.6;
static constexpr float MPA_U_UPPER_BOUND = 4.0; static constexpr double MPA_U_UPPER_BOUND = 4.0;
static constexpr float MPA_I_UPPER_BOUND = 650.0; static constexpr double MPA_I_UPPER_BOUND = 650.0;
static constexpr float HPA_U_LOWER_BOUND = 9.6; static constexpr double HPA_U_LOWER_BOUND = 9.6;
static constexpr float HPA_U_UPPER_BOUND = 11.0; static constexpr double HPA_U_UPPER_BOUND = 11.0;
static constexpr float HPA_I_UPPER_BOUND = 3000.0; static constexpr double HPA_I_UPPER_BOUND = 3000.0;
// Wait time in floating point seconds // Wait time in floating point seconds
static constexpr float SSR_TO_DRO_WAIT_TIME = 5.0; static constexpr double SSR_TO_DRO_WAIT_TIME = 5.0;
static constexpr float DRO_TO_X8_WAIT_TIME = 905.0; static constexpr double DRO_TO_X8_WAIT_TIME = 905.0;
static constexpr float X8_TO_TX_WAIT_TIME = 5.0; static constexpr double X8_TO_TX_WAIT_TIME = 5.0;
static constexpr float TX_TO_MPA_WAIT_TIME = 5.0; static constexpr double TX_TO_MPA_WAIT_TIME = 5.0;
static constexpr float MPA_TO_HPA_WAIT_TIME = 5.0; static constexpr double MPA_TO_HPA_WAIT_TIME = 5.0;
/** /**
* The current of the processed values is calculated and stored as a milliamperes [mA]. * The current of the processed values is calculated and stored as a milliamperes [mA].
@ -137,14 +136,53 @@ class PlPcduParameter : public NVMParameterBase {
static constexpr char TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait"; static constexpr char TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait";
static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait"; static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait";
PlPcduParameter() static constexpr char NEG_V_LOWER_BOUND_K[] = "negVoltLowerBound";
: NVMParameterBase(""), mountPrefix("") { static constexpr char NEG_V_UPPER_BOUND_K[] = "negVoltUpperBound";
static constexpr char DRO_U_LOWER_BOUND_K[] = "droVoltLowerBound";
static constexpr char DRO_U_UPPER_BOUND_K[] = "droVoltUpperBound";
static constexpr char DRO_I_UPPER_BOUND_K[] = "droCurrUpperBound";
static constexpr char X8_U_LOWER_BOUND_K[] = "x8VoltLowerBound";
static constexpr char X8_U_UPPER_BOUND_K[] = "x8VoltUpperBound";
static constexpr char X8_I_UPPER_BOUND_K[] = "x8CurrUpperBound";
static constexpr char TX_U_LOWER_BOUND_K[] = "txVoltLowerBound";
static constexpr char TX_U_UPPER_BOUND_K[] = "txVoltUpperBound";
static constexpr char TX_I_UPPER_BOUND_K[] = "txCurrUpperBound";
static constexpr char MPA_U_LOWER_BOUND_K[] = "mpaVoltLowerBound";
static constexpr char MPA_U_UPPER_BOUND_K[] = "mpaVoltUpperBound";
static constexpr char MPA_I_UPPER_BOUND_K[] = "mpaCurrUpperBound";
static constexpr char HPA_U_LOWER_BOUND_K[] = "hpaVoltLowerBound";
static constexpr char HPA_U_UPPER_BOUND_K[] = "hpaVoltUpperBound";
static constexpr char HPA_I_UPPER_BOUND_K[] = "hpaCurrUpperBound";
PlPcduParameter() : NVMParameterBase(""), mountPrefix("") {
// Initialize with default values // Initialize with default values
insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME); insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME);
insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_WAIT_TIME); insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_WAIT_TIME);
insertValue(X8_TO_TX_WAIT_TIME_K, X8_TO_TX_WAIT_TIME); insertValue(X8_TO_TX_WAIT_TIME_K, X8_TO_TX_WAIT_TIME);
insertValue(TX_TO_MPA_WAIT_TIME_K, TX_TO_MPA_WAIT_TIME); insertValue(TX_TO_MPA_WAIT_TIME_K, TX_TO_MPA_WAIT_TIME);
insertValue(MPA_TO_HPA_WAIT_TIME_K, MPA_TO_HPA_WAIT_TIME); insertValue(MPA_TO_HPA_WAIT_TIME_K, MPA_TO_HPA_WAIT_TIME);
insertValue(NEG_V_LOWER_BOUND_K, NEG_V_LOWER_BOUND);
insertValue(NEG_V_UPPER_BOUND_K, NEG_V_UPPER_BOUND);
insertValue(DRO_U_LOWER_BOUND_K, DRO_U_LOWER_BOUND);
insertValue(DRO_U_UPPER_BOUND_K, DRO_U_UPPER_BOUND);
insertValue(DRO_I_UPPER_BOUND_K, DRO_I_UPPER_BOUND);
insertValue(X8_U_LOWER_BOUND_K, X8_U_LOWER_BOUND);
insertValue(X8_U_UPPER_BOUND_K, X8_U_UPPER_BOUND);
insertValue(X8_I_UPPER_BOUND_K, X8_I_UPPER_BOUND);
insertValue(TX_U_LOWER_BOUND_K, TX_U_LOWER_BOUND);
insertValue(TX_U_UPPER_BOUND_K, TX_U_UPPER_BOUND);
insertValue(TX_I_UPPER_BOUND_K, TX_I_UPPER_BOUND);
insertValue(MPA_U_LOWER_BOUND_K, MPA_U_LOWER_BOUND);
insertValue(MPA_U_UPPER_BOUND_K, MPA_U_UPPER_BOUND);
insertValue(MPA_I_UPPER_BOUND_K, MPA_I_UPPER_BOUND);
insertValue(HPA_U_LOWER_BOUND_K, HPA_U_LOWER_BOUND);
insertValue(HPA_U_UPPER_BOUND_K, HPA_U_UPPER_BOUND);
insertValue(HPA_I_UPPER_BOUND_K, HPA_I_UPPER_BOUND);
} }
ReturnValue_t initialize(std::string mountPrefix) { ReturnValue_t initialize(std::string mountPrefix) {

View File

@ -1,21 +1,18 @@
#ifndef MISSION_MEMORY_SDCARDMOUNTERIF_H_ #ifndef MISSION_MEMORY_SDCARDMOUNTERIF_H_
#define MISSION_MEMORY_SDCARDMOUNTERIF_H_ #define MISSION_MEMORY_SDCARDMOUNTERIF_H_
#include "definitions.h"
#include <string> #include <string>
#include "definitions.h"
class SdCardMountedIF { class SdCardMountedIF {
public: public:
virtual ~SdCardMountedIF(){}; virtual ~SdCardMountedIF(){};
virtual std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) = 0; virtual std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) = 0;
virtual bool isSdCardMounted(sd::SdCard sdCard) = 0; virtual bool isSdCardMounted(sd::SdCard sdCard) = 0;
virtual ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const = 0; virtual ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const = 0;
private:
private:
}; };
#endif /* MISSION_MEMORY_SDCARDMOUNTERIF_H_ */ #endif /* MISSION_MEMORY_SDCARDMOUNTERIF_H_ */