From 0bbcfb34e8c6d591ff1eb2ef099a41b69f44b0ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Aug 2023 11:14:35 +0200 Subject: [PATCH] tweaks for pin handling --- CHANGELOG.md | 1 + mission/payload/PayloadPcduHandler.cpp | 30 ++++++++++++-------------- mission/payload/PayloadPcduHandler.h | 1 + tmtc | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6a2cb3..ae107d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ will consitute of a breaking change warranting a new major release: ## Changed - The `EiveSystem` now only sends reboot commands targetting the same image. +- Added 200 ms delay between switching HPA/MPA/TX/X8 and DRO GPIP pin OFF. # [v6.2.0] 2023-07-26 diff --git a/mission/payload/PayloadPcduHandler.cpp b/mission/payload/PayloadPcduHandler.cpp index 9223f454..4f22be87 100644 --- a/mission/payload/PayloadPcduHandler.cpp +++ b/mission/payload/PayloadPcduHandler.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "OBSWConfig.h" @@ -73,14 +74,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { stateMachineToNormal(modeFrom, subModeFrom); return; } else if (getMode() == _MODE_TO_ON and modeFrom == MODE_NORMAL) { - 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); + pullAllGpiosLow(200); state = States::STACK_5V_CORRECT; } DeviceHandlerBase::doTransition(modeFrom, subModeFrom); @@ -367,14 +361,7 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) { void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir) { 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); + pullAllGpiosLow(200); state = States::STACK_5V_SWITCHING; adcState = AdcStates::OFF; if (startTransitionToOff) { @@ -677,6 +664,17 @@ void PayloadPcduHandler::handleFailureInjection(std::string output, Event event) droToX8InjectionRequested = false; } +void PayloadPcduHandler::pullAllGpiosLow(uint32_t delayBeforeSwitchingOffDro) { + gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8); + TaskFactory::delayTask(delayBeforeSwitchingOffDro); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0); + gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1); +} + ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues) { diff --git a/mission/payload/PayloadPcduHandler.h b/mission/payload/PayloadPcduHandler.h index b73de353..78646104 100644 --- a/mission/payload/PayloadPcduHandler.h +++ b/mission/payload/PayloadPcduHandler.h @@ -168,6 +168,7 @@ class PayloadPcduHandler : public DeviceHandlerBase { void handleExtConvRead(const uint8_t* bufStart); void handlePrintout(); + void pullAllGpiosLow(uint32_t delayBeforeSwitchingOffDro); void checkAdcValues(); void handleOutOfBoundsPrintout(); void checkJsonFileInit(); diff --git a/tmtc b/tmtc index ab770a00..4b054b76 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit ab770a0057258cc399072477a42eb0253d919aba +Subproject commit 4b054b7628e43975e2401c7db10c358824f7a2d3