created back transition handler and channel enum
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
20074dcbd7
commit
608d45f055
@ -19,6 +19,7 @@ enum: uint8_t {
|
|||||||
PLOC_MEMORY_DUMPER = 118,
|
PLOC_MEMORY_DUMPER = 118,
|
||||||
PDEC_HANDLER = 119,
|
PDEC_HANDLER = 119,
|
||||||
STR_HELPER = 120,
|
STR_HELPER = 120,
|
||||||
|
PL_PCDU_HANDLER = 121,
|
||||||
COMMON_SUBSYSTEM_ID_END
|
COMMON_SUBSYSTEM_ID_END
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,23 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
|||||||
opDivider.setDivider(divider);
|
opDivider.setDivider(divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PayloadPcduHandler::transitionBackToOff() {
|
||||||
|
States currentState = state;
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||||
|
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||||
|
state = States::PCDU_OFF;
|
||||||
|
adcState = AdcStates::OFF;
|
||||||
|
setMode(MODE_OFF);
|
||||||
|
// Notify FDIR
|
||||||
|
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
|
||||||
|
}
|
||||||
|
|
||||||
void PayloadPcduHandler::stateMachineToNormal() {
|
void PayloadPcduHandler::stateMachineToNormal() {
|
||||||
if (adcState == AdcStates::BOOT_DELAY) {
|
if (adcState == AdcStates::BOOT_DELAY) {
|
||||||
if (adcCountdown.hasTimedOut()) {
|
if (adcCountdown.hasTimedOut()) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include <fsfw/timemanager/Countdown.h>
|
#include <fsfw/timemanager/Countdown.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"
|
||||||
@ -30,6 +31,9 @@ class SpiCookie;
|
|||||||
*/
|
*/
|
||||||
class PayloadPcduHandler : public DeviceHandlerBase {
|
class PayloadPcduHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PL_PCDU_HANDLER;
|
||||||
|
static constexpr Event TRANSITION_BACK_TO_OFF = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
|
|
||||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
|
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
|
||||||
bool periodicPrintout);
|
bool periodicPrintout);
|
||||||
|
|
||||||
@ -45,7 +49,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class States {
|
enum class States: uint8_t {
|
||||||
PCDU_OFF,
|
PCDU_OFF,
|
||||||
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
||||||
// the ADC
|
// the ADC
|
||||||
@ -93,6 +97,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||||
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
|
||||||
|
void transitionBackToOff();
|
||||||
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;
|
||||||
|
@ -12,6 +12,25 @@ namespace plpcdu {
|
|||||||
|
|
||||||
using namespace max1227;
|
using namespace max1227;
|
||||||
|
|
||||||
|
enum PlPcduAdcChannels: uint8_t {
|
||||||
|
U_BAT_DIV_6 = 0,
|
||||||
|
// According to schematic, will be 2.2158V for Vneg = +0V and 0.2446V for Vneg = -6V
|
||||||
|
// Full Forumula: V_neg = V_post - (R1 + R2) / R1 * (V_pos - V_out) with R1 being 27.4k
|
||||||
|
// and R2 being 49.9k
|
||||||
|
U_NEG_V_FB = 1,
|
||||||
|
I_HPA = 2,
|
||||||
|
U_HPA_DIV_6 = 3,
|
||||||
|
I_MPA = 4,
|
||||||
|
U_MPA_DIV_6 = 5,
|
||||||
|
I_TX = 6,
|
||||||
|
U_TX_DIV_6 = 7,
|
||||||
|
I_X8 = 8,
|
||||||
|
U_X8_DIV_6 = 9,
|
||||||
|
I_DRO = 10,
|
||||||
|
U_DRO_DIV_6 = 11,
|
||||||
|
NUM_CHANNELS = 12
|
||||||
|
};
|
||||||
|
|
||||||
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, TEMP = 1 };
|
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, TEMP = 1 };
|
||||||
|
|
||||||
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user