From b75102f670e9d5b2ad9e136eead7020ee415f5fd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 21 Dec 2022 14:11:31 +0100 Subject: [PATCH 01/52] add 5V stack handler --- bsp_q7s/core/ObjectFactory.cpp | 5 +++-- bsp_q7s/core/ObjectFactory.h | 3 ++- bsp_q7s/fmObjectFactory.cpp | 4 +++- mission/devices/RadiationSensorHandler.cpp | 11 ++++++---- mission/devices/RadiationSensorHandler.h | 3 ++- mission/system/objects/CMakeLists.txt | 1 + mission/system/objects/Stack5VHandler.cpp | 9 ++++++++ mission/system/objects/Stack5VHandler.h | 24 ++++++++++++++++++++++ 8 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 mission/system/objects/Stack5VHandler.cpp create mode 100644 mission/system/objects/Stack5VHandler.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 85157e66..bcd2a5a5 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -204,7 +204,8 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI #endif } -ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { +ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF, + Stack5VHandler& stackHandler) { using namespace gpio; if (gpioComIF == nullptr) { return returnvalue::FAILED; @@ -225,7 +226,7 @@ ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); spiCookieRadSensor->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RAD_SENSOR_CS_TIMEOUT); auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF, - spiCookieRadSensor, gpioComIF); + spiCookieRadSensor, gpioComIF, stackHandler); static_cast(radSensor); // The radiation sensor ADC is powered by the 5V stack connector which should always be on radSensor->setStartUpImmediately(); diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index c67353c4..9daceabf 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -2,6 +2,7 @@ #define BSP_Q7S_OBJECTFACTORY_H_ #include +#include #include #include #include @@ -29,7 +30,7 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher); void createTmpComponents(); -ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF); +ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler); void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF, PowerSwitchIF* pwrSwitcher); void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable); diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 2814c3f9..527c639b 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -33,8 +33,10 @@ void ObjectFactory::produce(void* args) { new CoreController(objects::CORE_CONTROLLER); createPcduComponents(gpioComIF, &pwrSwitcher); + auto* stackHandler = new Stack5VHandler(*pwrSwitcher); + #if OBSW_ADD_RAD_SENSORS == 1 - createRadSensorComponent(gpioComIF); + createRadSensorComponent(gpioComIF, *stackHandler); #endif #if OBSW_ADD_SUN_SENSORS == 1 createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV); diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index bc11bb45..f8e0df9e 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -2,10 +2,12 @@ #include #include #include +#include #include RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t comIF, - CookieIF *comCookie, GpioIF *gpioIF) + CookieIF *comCookie, GpioIF *gpioIF, + Stack5VHandler &handler) : DeviceHandlerBase(objectId, comIF, comCookie), dataset(this), gpioIF(gpioIF) { if (comCookie == nullptr) { sif::error << "RadiationSensorHandler: Invalid com cookie" << std::endl; @@ -73,9 +75,10 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t ReturnValue_t result = gpioIF->pullHigh(gpioIds::ENABLE_RADFET); if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::warning << "RadiationSensorHandler::buildCommandFromCommand; Pulling RADFET Enale pin " - "high failed" - << std::endl; + sif::warning + << "RadiationSensorHandler::buildCommandFromCommand: Pulling RADFET Enable pin " + "high failed" + << std::endl; #endif } /* First the fifo will be reset here */ diff --git a/mission/devices/RadiationSensorHandler.h b/mission/devices/RadiationSensorHandler.h index d16cc624..dff273a0 100644 --- a/mission/devices/RadiationSensorHandler.h +++ b/mission/devices/RadiationSensorHandler.h @@ -4,6 +4,7 @@ #include #include #include +#include /** * @brief This is the device handler class for radiation sensor on the OBC IF Board. The @@ -16,7 +17,7 @@ class RadiationSensorHandler : public DeviceHandlerBase { public: RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, - GpioIF *gpioIF); + GpioIF *gpioIF, Stack5VHandler &handler); virtual ~RadiationSensorHandler(); void setToGoToNormalModeImmediately(); void enablePeriodicDataPrint(bool enable); diff --git a/mission/system/objects/CMakeLists.txt b/mission/system/objects/CMakeLists.txt index 23e97047..75526486 100644 --- a/mission/system/objects/CMakeLists.txt +++ b/mission/system/objects/CMakeLists.txt @@ -6,6 +6,7 @@ target_sources( ComSubsystem.cpp PayloadSubsystem.cpp AcsBoardAssembly.cpp + Stack5VHandler.cpp SusAssembly.cpp RwAssembly.cpp DualLanePowerStateMachine.cpp diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp new file mode 100644 index 00000000..5b81fb46 --- /dev/null +++ b/mission/system/objects/Stack5VHandler.cpp @@ -0,0 +1,9 @@ +#include "Stack5VHandler.h" + +Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) {} + +ReturnValue_t Stack5VHandler::commandSwitchOn() { return returnvalue::OK; } + +ReturnValue_t Stack5VHandler::commandSwitchOff() { return returnvalue::OK; } + +bool Stack5VHandler::isSwitchOn() { return false; } diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h new file mode 100644 index 00000000..e88be0cd --- /dev/null +++ b/mission/system/objects/Stack5VHandler.h @@ -0,0 +1,24 @@ +#ifndef MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ +#define MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ + +#include + +#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" + +class Stack5VHandler { + public: + Stack5VHandler(PowerSwitchIF& switcher); + + ReturnValue_t commandSwitchOn(); + ReturnValue_t commandSwitchOff(); + + bool isSwitchOn(); + + private: + PowerSwitchIF& switcher; + bool radSensorIsOn = false; + bool plPcduIsOn = false; + pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK; +}; + +#endif /* MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ */ From 164bfc35218e722791e76dd06b4715b99d25c3f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 21 Dec 2022 14:34:07 +0100 Subject: [PATCH 02/52] continue stack 5v --- mission/system/objects/Stack5VHandler.cpp | 38 ++++++++++++++++++++--- mission/system/objects/Stack5VHandler.h | 9 ++++-- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index 5b81fb46..ff1f8237 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -1,9 +1,39 @@ #include "Stack5VHandler.h" -Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) {} +Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) { + stackLock = MutexFactory::instance()->createMutex(); +} -ReturnValue_t Stack5VHandler::commandSwitchOn() { return returnvalue::OK; } +ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { + MutexGuard mg(stackLock); + if (radSensorIsOn or plPcduIsOn) { + return returnvalue::OK; + } + if (commander == StackCommander::PL_PCDU) { + plPcduCommandedOn = true; + } else if (commander == StackCommander::RAD_SENSOR) { + radSensorCommandedOn = true; + } + return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); +} -ReturnValue_t Stack5VHandler::commandSwitchOff() { return returnvalue::OK; } +ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { + MutexGuard mg(stackLock); + if (not radSensorIsOn and not plPcduIsOn and not plPcduCommandedOn and not radSensorCommandedOn) { + return returnvalue::OK; + } + if (commander == StackCommander::PL_PCDU) { + plPcduCommandedOn = true; + } else if (commander == StackCommander::RAD_SENSOR) { + radSensorCommandedOn = true; + } + return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF); +} -bool Stack5VHandler::isSwitchOn() { return false; } +bool Stack5VHandler::isSwitchOn() { + MutexGuard mg(stackLock); + if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) { + return true; + } + return false; +} diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h index e88be0cd..bf06871f 100644 --- a/mission/system/objects/Stack5VHandler.h +++ b/mission/system/objects/Stack5VHandler.h @@ -5,17 +5,22 @@ #include "mission/devices/devicedefinitions/GomspaceDefinitions.h" +enum class StackCommander { RAD_SENSOR = 0, PL_PCDU = 1 }; + class Stack5VHandler { public: Stack5VHandler(PowerSwitchIF& switcher); - ReturnValue_t commandSwitchOn(); - ReturnValue_t commandSwitchOff(); + ReturnValue_t deviceToOn(StackCommander commander); + ReturnValue_t deviceToOff(StackCommander commander); bool isSwitchOn(); private: + MutexIF* stackLock; PowerSwitchIF& switcher; + bool radSensorCommandedOn = false; + bool plPcduCommandedOn = false; bool radSensorIsOn = false; bool plPcduIsOn = false; pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK; From dcf6367314a1786e28e38d5091350665162e4a94 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 21 Dec 2022 14:43:12 +0100 Subject: [PATCH 03/52] this is annoying --- mission/system/objects/Stack5VHandler.cpp | 27 +++++++++++++++++++++-- mission/system/objects/Stack5VHandler.h | 5 ++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index ff1f8237..f0833eb3 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -6,7 +6,7 @@ Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) { ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { MutexGuard mg(stackLock); - if (radSensorIsOn or plPcduIsOn) { + if (switchIsOn or handlerState == HandlerState::SWITCH_PENDING) { return returnvalue::OK; } if (commander == StackCommander::PL_PCDU) { @@ -19,7 +19,7 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { MutexGuard mg(stackLock); - if (not radSensorIsOn and not plPcduIsOn and not plPcduCommandedOn and not radSensorCommandedOn) { + if (not switchIsOn) { return returnvalue::OK; } if (commander == StackCommander::PL_PCDU) { @@ -33,7 +33,30 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { bool Stack5VHandler::isSwitchOn() { MutexGuard mg(stackLock); if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) { + if (not switchIsOn) { + if (handlerState == HandlerState::SWITCH_PENDING) { + handlerState = HandlerState::IDLE; + } + switchIsOn = true; + } + if (plPcduCommandedOn) { + plPcduIsOn = true; + } + if (radSensorCommandedOn) { + radSensorIsOn = true; + } return true; + } else { + if (switchIsOn) { + if (handlerState == HandlerState::SWITCH_PENDING) { + handlerState = HandlerState::IDLE; + } + switchIsOn = false; + } + radSensorIsOn = false; + plPcduIsOn = false; + radSensorCommandedOn = false; + plPcduCommandedOn = false; } return false; } diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h index bf06871f..4750d1d3 100644 --- a/mission/system/objects/Stack5VHandler.h +++ b/mission/system/objects/Stack5VHandler.h @@ -6,6 +6,7 @@ #include "mission/devices/devicedefinitions/GomspaceDefinitions.h" enum class StackCommander { RAD_SENSOR = 0, PL_PCDU = 1 }; +enum class HandlerState { SWITCH_PENDING, IDLE }; class Stack5VHandler { public: @@ -19,8 +20,10 @@ class Stack5VHandler { private: MutexIF* stackLock; PowerSwitchIF& switcher; - bool radSensorCommandedOn = false; + bool switchIsOn = false; + HandlerState handlerState = HandlerState::IDLE; bool plPcduCommandedOn = false; + bool radSensorCommandedOn = false; bool radSensorIsOn = false; bool plPcduIsOn = false; pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK; From 7aae4efd69e32f87c0f20cdd63f9eb945379a4f5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 21 Dec 2022 17:30:21 +0100 Subject: [PATCH 04/52] added 5v stack status read in PCDU handler --- mission/devices/PCDUHandler.cpp | 18 +++++++++ mission/devices/PCDUHandler.h | 3 ++ .../devicedefinitions/GomspaceDefinitions.h | 3 +- mission/system/objects/Stack5VHandler.cpp | 37 ++++++++++--------- mission/system/objects/Stack5VHandler.h | 3 +- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 71b4734e..2fc64731 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -11,6 +11,7 @@ PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) : SystemObject(setObjectId), poolManager(this, nullptr), + p60CoreHk(objects::P60DOCK_HANDLER), pdu1CoreHk(this), pdu2CoreHk(this), switcherSet(this), @@ -28,6 +29,22 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { readCommandQueue(); return returnvalue::OK; } + uint8_t switchState = 0; + { + PoolReadGuard pg(&p60CoreHk.outputEnables); + if (pg.getReadResult() == returnvalue::OK) { + switchState = p60CoreHk.outputEnables.value[10]; + } + } + { + PoolReadGuard pg(&switcherSet.p60Dock5VStack); + if (pg.getReadResult() == returnvalue::OK) { + if (switcherSet.p60Dock5VStack.value != switchState) { + triggerEvent(power::SWITCH_HAS_CHANGED, switchState, pcdu::Switches::P60_DOCK_5V_STACK); + } + switcherSet.p60Dock5VStack.value = switchState; + } + } return returnvalue::OK; } @@ -398,6 +415,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat using namespace pcdu; localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches); localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches); + localDataPoolMap.emplace(PoolIds::P60DOCK_SWITCHES, &p60Dock5VSwitch); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(switcherSet.getSid(), false, 5.0)); return returnvalue::OK; diff --git a/mission/devices/PCDUHandler.h b/mission/devices/PCDUHandler.h index 21bb869d..34491de8 100644 --- a/mission/devices/PCDUHandler.h +++ b/mission/devices/PCDUHandler.h @@ -56,6 +56,8 @@ class PCDUHandler : public PowerSwitchIF, /** Housekeeping manager. Handles updates of local pool variables. */ LocalDataPoolManager poolManager; + P60Dock::CoreHkSet p60CoreHk; + /** Hk table dataset of PDU1 */ PDU1::Pdu1CoreHk pdu1CoreHk; /** @@ -71,6 +73,7 @@ class PCDUHandler : public PowerSwitchIF, PoolEntry(pcdu::INIT_SWITCHES_PDU1.data(), pcdu::INIT_SWITCHES_PDU1.size()); PoolEntry pdu2Switches = PoolEntry(pcdu::INIT_SWITCHES_PDU2.data(), pcdu::INIT_SWITCHES_PDU2.size()); + PoolEntry p60Dock5VSwitch = PoolEntry(); /** The timeStamp of the current pdu2HkTableDataset */ CCSDSTime::CDS_short timeStampPdu2HkDataset; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index ca92f5e4..bc8b2edd 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -713,7 +713,7 @@ class AuxHk : public StaticLocalDataSet<12> { namespace pcdu { -enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES }; +enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES, P60DOCK_SWITCHES }; /* Switches are uint8_t datatype and go from 0 to 255 */ enum Switches : power::Switch_t { @@ -771,6 +771,7 @@ class SwitcherStates : public StaticLocalDataSet { lp_vec_t(sid.objectId, PDU1_SWITCHES, this); lp_vec_t pdu2Switches = lp_vec_t(sid.objectId, PDU2_SWITCHES, this); + lp_var_t p60Dock5VStack = lp_var_t(sid.objectId, P60DOCK_SWITCHES, this); }; } // namespace pcdu diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index f0833eb3..eb0af21f 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -6,13 +6,16 @@ Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) { ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { MutexGuard mg(stackLock); - if (switchIsOn or handlerState == HandlerState::SWITCH_PENDING) { + if (switchIsOn) { + if (commander == StackCommander::PL_PCDU) { + plPcduIsOn = true; + } else { + radSensorIsOn = true; + } return returnvalue::OK; } - if (commander == StackCommander::PL_PCDU) { - plPcduCommandedOn = true; - } else if (commander == StackCommander::RAD_SENSOR) { - radSensorCommandedOn = true; + if (handlerState == HandlerState::SWITCH_PENDING) { + return BUSY; } return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); } @@ -20,13 +23,21 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { MutexGuard mg(stackLock); if (not switchIsOn) { + if (commander == StackCommander::PL_PCDU) { + plPcduIsOn = false; + } else { + radSensorIsOn = false; + } return returnvalue::OK; } - if (commander == StackCommander::PL_PCDU) { - plPcduCommandedOn = true; - } else if (commander == StackCommander::RAD_SENSOR) { - radSensorCommandedOn = true; + if (handlerState == HandlerState::SWITCH_PENDING) { + return BUSY; } + if ((commander == StackCommander::PL_PCDU and radSensorIsOn) or + (commander == StackCommander::RAD_SENSOR and plPcduIsOn)) { + return returnvalue::OK; + } + return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF); } @@ -39,12 +50,6 @@ bool Stack5VHandler::isSwitchOn() { } switchIsOn = true; } - if (plPcduCommandedOn) { - plPcduIsOn = true; - } - if (radSensorCommandedOn) { - radSensorIsOn = true; - } return true; } else { if (switchIsOn) { @@ -55,8 +60,6 @@ bool Stack5VHandler::isSwitchOn() { } radSensorIsOn = false; plPcduIsOn = false; - radSensorCommandedOn = false; - plPcduCommandedOn = false; } return false; } diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h index 4750d1d3..3a703b86 100644 --- a/mission/system/objects/Stack5VHandler.h +++ b/mission/system/objects/Stack5VHandler.h @@ -10,6 +10,7 @@ enum class HandlerState { SWITCH_PENDING, IDLE }; class Stack5VHandler { public: + static constexpr ReturnValue_t BUSY = returnvalue::makeCode(1, 0); Stack5VHandler(PowerSwitchIF& switcher); ReturnValue_t deviceToOn(StackCommander commander); @@ -22,8 +23,6 @@ class Stack5VHandler { PowerSwitchIF& switcher; bool switchIsOn = false; HandlerState handlerState = HandlerState::IDLE; - bool plPcduCommandedOn = false; - bool radSensorCommandedOn = false; bool radSensorIsOn = false; bool plPcduIsOn = false; pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK; From 9aedc3252778f71c58a9495166332f8b4d9cbb1d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 11:00:04 +0100 Subject: [PATCH 05/52] disable rad sensor auto-on --- bsp_q7s/core/ObjectFactory.cpp | 4 ---- mission/devices/RadiationSensorHandler.cpp | 23 +++++++++++++++++----- mission/devices/RadiationSensorHandler.h | 5 +++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index bcd2a5a5..5ed6445e 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -228,10 +228,6 @@ ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF, auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF, spiCookieRadSensor, gpioComIF, stackHandler); static_cast(radSensor); - // The radiation sensor ADC is powered by the 5V stack connector which should always be on - radSensor->setStartUpImmediately(); - // It's a simple sensor, so just to to normal mode immediately - radSensor->setToGoToNormalModeImmediately(); #if OBSW_DEBUG_RAD_SENSOR == 1 radSensor->enablePeriodicDataPrint(true); #endif diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index f8e0df9e..411dd510 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -7,8 +7,11 @@ RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, GpioIF *gpioIF, - Stack5VHandler &handler) - : DeviceHandlerBase(objectId, comIF, comCookie), dataset(this), gpioIF(gpioIF) { + Stack5VHandler &stackHandler) + : DeviceHandlerBase(objectId, comIF, comCookie), + dataset(this), + gpioIF(gpioIF), + stackHandler(stackHandler) { if (comCookie == nullptr) { sif::error << "RadiationSensorHandler: Invalid com cookie" << std::endl; } @@ -17,12 +20,22 @@ RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t RadiationSensorHandler::~RadiationSensorHandler() {} void RadiationSensorHandler::doStartUp() { + if (internalState == InternalState::OFF) { + ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::RAD_SENSOR); + if (retval == BUSY) { + return; + } + internalState = InternalState::POWER_SWITCHING; + } + if (internalState == InternalState::POWER_SWITCHING) { + if (stackHandler.isSwitchOn()) { + internalState == InternalState::SETUP; + } + } if (internalState == InternalState::CONFIGURED) { if (goToNormalMode) { setMode(MODE_NORMAL); - } - - else { + } else { setMode(_MODE_TO_ON); } } diff --git a/mission/devices/RadiationSensorHandler.h b/mission/devices/RadiationSensorHandler.h index dff273a0..b4ad39de 100644 --- a/mission/devices/RadiationSensorHandler.h +++ b/mission/devices/RadiationSensorHandler.h @@ -40,16 +40,17 @@ class RadiationSensorHandler : public DeviceHandlerBase { private: enum class CommunicationStep { START_CONVERSION, READ_CONVERSIONS }; - enum class InternalState { SETUP, CONFIGURED }; + enum class InternalState { OFF, POWER_SWITCHING, SETUP, CONFIGURED }; bool printPeriodicData = false; RAD_SENSOR::RadSensorDataset dataset; static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE; GpioIF *gpioIF = nullptr; + Stack5VHandler &stackHandler; bool goToNormalMode = false; uint8_t cmdBuffer[MAX_CMD_LEN]; - InternalState internalState = InternalState::SETUP; + InternalState internalState = InternalState::OFF; CommunicationStep communicationStep = CommunicationStep::START_CONVERSION; }; From c2d2848020f6c297e7debe983166fa9de37bc497 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 11:02:33 +0100 Subject: [PATCH 06/52] use stack handler in rad sensor handler as well --- mission/devices/RadiationSensorHandler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index 411dd510..61704c91 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -41,7 +41,14 @@ void RadiationSensorHandler::doStartUp() { } } -void RadiationSensorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } +void RadiationSensorHandler::doShutDown() { + ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::RAD_SENSOR); + if (retval == BUSY) { + return; + } + internalState = InternalState::OFF; + setMode(_MODE_POWER_DOWN); +} ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { switch (communicationStep) { From 268233551d17bd35a716a676963a5d62644d6748 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 11:10:55 +0100 Subject: [PATCH 07/52] use stack handler in PL PCDU component --- bsp_q7s/core/ObjectFactory.cpp | 10 +++++----- bsp_q7s/core/ObjectFactory.h | 2 +- bsp_q7s/fmObjectFactory.cpp | 2 +- mission/devices/PayloadPcduHandler.cpp | 21 +++++---------------- mission/devices/PayloadPcduHandler.h | 6 +++--- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 5ed6445e..4976c4b2 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -830,7 +830,8 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF, } void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, - PowerSwitchIF* pwrSwitcher) { + PowerSwitchIF* pwrSwitcher, + Stack5VHandler& stackHandler) { using namespace gpio; // Create all GPIO components first GpioCookie* plPcduGpios = new GpioCookie; @@ -876,10 +877,9 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS, plpcdu::MAX_ADC_REPLY_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED); // Create device handler components - auto plPcduHandler = new PayloadPcduHandler( - objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, gpioComIF, - SdCardManager::instance(), pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, - pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false); + auto plPcduHandler = + new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, + gpioComIF, SdCardManager::instance(), stackHandler, false); spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler); // plPcduHandler->enablePeriodicPrintout(true, 5); // static_cast(plPcduHandler); diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 9daceabf..c55e8452 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -28,7 +28,7 @@ void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, SerialComIF** uar SpiComIF** spiRwComIF); void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher); void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, - PowerSwitchIF* pwrSwitcher); + PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler); void createTmpComponents(); ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler); void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF, diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 527c639b..239b3639 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -50,7 +50,7 @@ void ObjectFactory::produce(void* args) { createTmpComponents(); #endif createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF); - createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher); + createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); #if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(pwrSwitcher); #endif /* OBSW_ADD_SYRLINKS == 1 */ diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 7b4353e4..3409a483 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -16,27 +16,21 @@ PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF, SdCardMountedIF* sdcMan, - PowerSwitchIF* pwrSwitcher, power::Switch_t switchA, - power::Switch_t switchB, bool periodicPrintout) + Stack5VHandler& stackHandler, bool periodicPrintout) : DeviceHandlerBase(objectId, comIF, cookie), adcSet(this), + stackHandler(stackHandler), periodicPrintout(periodicPrintout), gpioIF(gpioIF), - sdcMan(sdcMan), - pwrStateMachine(switchA, switchB, pwrSwitcher) {} + sdcMan(sdcMan) {} void PayloadPcduHandler::doStartUp() { if ((state != States::PL_PCDU_OFF) and (state != States::ON_TRANS_SSR)) { // Config error sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl; } - if (pwrStateMachine.getState() == power::States::IDLE) { - pwrStateMachine.start(MODE_ON, pwrSubmode); - } clearSetOnOffFlag = true; - auto opCode = pwrStateMachine.fsm(); - if (opCode == power::OpCodes::TO_NOT_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) { - pwrStateMachine.reset(); + if (true) { quickTransitionAlreadyCalled = false; state = States::POWER_CHANNELS_ON; setMode(_MODE_TO_ON); @@ -48,17 +42,12 @@ void PayloadPcduHandler::doShutDown() { quickTransitionBackToOff(false, false); quickTransitionAlreadyCalled = true; } - if (pwrStateMachine.getState() == power::States::IDLE) { - pwrStateMachine.start(MODE_OFF, 0); - } if (clearSetOnOffFlag) { std::memset(adcSet.processed.value, 0, adcSet.processed.getSerializedSize()); clearSetOnOffFlag = false; } - auto opCode = pwrStateMachine.fsm(); - if (opCode == power::OpCodes::TO_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) { - pwrStateMachine.reset(); + if (true) { state = States::PL_PCDU_OFF; // No need to set mode _MODE_POWER_DOWN, power switching was already handled setMode(MODE_OFF); diff --git a/mission/devices/PayloadPcduHandler.h b/mission/devices/PayloadPcduHandler.h index 137a9a0b..899f73f8 100644 --- a/mission/devices/PayloadPcduHandler.h +++ b/mission/devices/PayloadPcduHandler.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "events/subsystemIdRanges.h" #include "fsfw/FSFW.h" @@ -62,8 +63,7 @@ class PayloadPcduHandler : public DeviceHandlerBase { static constexpr Event I_HPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 11, severity::MEDIUM); PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF, - SdCardMountedIF* sdcMan, PowerSwitchIF* pwrSwitcher, power::Switch_t switchCh0, - power::Switch_t switchCh1, bool periodicPrintout); + SdCardMountedIF* sdcMan, Stack5VHandler& stackHandler, bool periodicPrintout); void setToGoToNormalModeImmediately(bool enable); void enablePeriodicPrintout(bool enable, uint8_t divider); @@ -108,6 +108,7 @@ class PayloadPcduHandler : public DeviceHandlerBase { bool goToNormalMode = false; plpcdu::PlPcduAdcSet adcSet; + Stack5VHandler& stackHandler; std::array cmdBuf = {}; // This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment // is shut down immediately if there is a negative voltage. @@ -140,7 +141,6 @@ class PayloadPcduHandler : public DeviceHandlerBase { PoolEntry processedValues = PoolEntry({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}); PoolEntry tempC = PoolEntry({0.0}); - DualLanePowerStateMachine pwrStateMachine; void updateSwitchGpio(gpioId_t id, gpio::Levels level); From a3d1dde4550f4d8ab22c5ea579639d5a211db87c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 14:13:41 +0100 Subject: [PATCH 08/52] this should do the job --- mission/devices/PayloadPcduHandler.cpp | 36 +++++++++++++++++++---- mission/devices/PayloadPcduHandler.h | 4 ++- mission/system/objects/Stack5VHandler.cpp | 3 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 3409a483..e873e3e1 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -30,9 +30,23 @@ void PayloadPcduHandler::doStartUp() { sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl; } clearSetOnOffFlag = true; - if (true) { + if (state == States::PL_PCDU_OFF) { + state = States::STACK_5V_SWITCHING; + } + if (state == States::STACK_5V_SWITCHING) { + ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::PL_PCDU); + if (retval == BUSY) { + return; + } + state == States::STACK_5V_PENDING; + } + if (state == States::STACK_5V_PENDING) { + if (stackHandler.isSwitchOn()) { + state = States::STACK_5V_CORRECT; + } + } + if (state == States::STACK_5V_CORRECT) { quickTransitionAlreadyCalled = false; - state = States::POWER_CHANNELS_ON; setMode(_MODE_TO_ON); } } @@ -47,7 +61,19 @@ void PayloadPcduHandler::doShutDown() { clearSetOnOffFlag = false; } - if (true) { + if (state == States::STACK_5V_SWITCHING) { + ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU); + if (retval == BUSY) { + return; + } + state == States::STACK_5V_PENDING; + } + if (state == States::STACK_5V_PENDING) { + if (not stackHandler.isSwitchOn()) { + state == States::STACK_5V_CORRECT; + } + } + if (state == States::STACK_5V_CORRECT) { state = States::PL_PCDU_OFF; // No need to set mode _MODE_POWER_DOWN, power switching was already handled setMode(MODE_OFF); @@ -72,7 +98,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ setMode(MODE_OFF); return returnvalue::FAILED; } - if (state == States::POWER_CHANNELS_ON) { + if (state == States::STACK_5V_CORRECT) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Switching on SSR VBAT0 & VBAT1 GPIOs" << std::endl; #endif @@ -347,7 +373,7 @@ void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, boo gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX); gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0); gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1); - state = States::PL_PCDU_OFF; + state = States::STACK_5V_SWITCHING; adcState = AdcStates::OFF; if (startTransitionToOff) { startTransition(MODE_OFF, 0); diff --git a/mission/devices/PayloadPcduHandler.h b/mission/devices/PayloadPcduHandler.h index 899f73f8..0fd78887 100644 --- a/mission/devices/PayloadPcduHandler.h +++ b/mission/devices/PayloadPcduHandler.h @@ -78,7 +78,9 @@ class PayloadPcduHandler : public DeviceHandlerBase { private: enum class States : uint8_t { PL_PCDU_OFF, - POWER_CHANNELS_ON, + STACK_5V_SWITCHING, + STACK_5V_PENDING, + STACK_5V_CORRECT, // Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on // the ADC ON_TRANS_SSR, diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index eb0af21f..e09f2a59 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -17,6 +17,7 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { if (handlerState == HandlerState::SWITCH_PENDING) { return BUSY; } + handlerState == HandlerState::SWITCH_PENDING; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); } @@ -37,7 +38,7 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { (commander == StackCommander::RAD_SENSOR and plPcduIsOn)) { return returnvalue::OK; } - + handlerState == HandlerState::SWITCH_PENDING; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF); } From 150073ae8e4a2c6d094ac8677a3cf8959d75c577 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 14:32:36 +0100 Subject: [PATCH 09/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 383b3214..00991b92 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 383b32141c8c382b84c587d6814fe9252dde0b4a +Subproject commit 00991b92f15425aa80d2448ad304de46a08b5470 From 099759c5f58c938bffa53100a5141090f515411e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 14:37:25 +0100 Subject: [PATCH 10/52] changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f27fc7..fa5ed5a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ list yields a list of all related PRs for each release. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/329 - Allow commanding the 5V stack internally in software PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/334 +- Add automatic 5V stack commanding for all connected devices + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/335 # [v1.18.0] 01.12.2022 From c1b95e8bbdeb26ad853d73661e1cc1f6f4a7b741 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 16:14:11 +0100 Subject: [PATCH 11/52] minor bugfix, push tmtc --- mission/devices/PCDUHandler.cpp | 1 - tmtc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 2fc64731..cb75e2b3 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -27,7 +27,6 @@ PCDUHandler::~PCDUHandler() {} ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { if (counter == DeviceHandlerIF::PERFORM_OPERATION) { readCommandQueue(); - return returnvalue::OK; } uint8_t switchState = 0; { diff --git a/tmtc b/tmtc index 00991b92..9016d3d9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 00991b92f15425aa80d2448ad304de46a08b5470 +Subproject commit 9016d3d992bb6c5aa8dd11065ceb913b8ba88491 From 55ecb346659cb100362c5d7de4f9f0e37a116e43 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 16:18:30 +0100 Subject: [PATCH 12/52] set swither set entries valid --- mission/devices/PCDUHandler.cpp | 5 +++++ mission/devices/PayloadPcduHandler.cpp | 6 +++--- mission/devices/RadiationSensorHandler.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index cb75e2b3..1b47c7f1 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -33,6 +33,8 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { PoolReadGuard pg(&p60CoreHk.outputEnables); if (pg.getReadResult() == returnvalue::OK) { switchState = p60CoreHk.outputEnables.value[10]; + } else { + return returnvalue::OK; } } { @@ -41,6 +43,7 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { if (switcherSet.p60Dock5VStack.value != switchState) { triggerEvent(power::SWITCH_HAS_CHANGED, switchState, pcdu::Switches::P60_DOCK_5V_STACK); } + switcherSet.p60Dock5VStack.setValid(true); switcherSet.p60Dock5VStack.value = switchState; } } @@ -193,6 +196,7 @@ void PCDUHandler::updatePdu2SwitchStates() { if (firstSwitchInfoPdu2) { firstSwitchInfoPdu2 = false; } + switcherSet.pduSwitches.setValid(true); } else { sif::debug << "PCDUHandler::updatePdu2SwitchStates: Failed to read PDU2 Hk Dataset" << std::endl; @@ -229,6 +233,7 @@ void PCDUHandler::updatePdu1SwitchStates() { if (firstSwitchInfoPdu1) { firstSwitchInfoPdu1 = false; } + switcherSet.pdu2Switches.setValid(true); } else { sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; } diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index e873e3e1..6d4888f1 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -38,7 +38,7 @@ void PayloadPcduHandler::doStartUp() { if (retval == BUSY) { return; } - state == States::STACK_5V_PENDING; + state = States::STACK_5V_PENDING; } if (state == States::STACK_5V_PENDING) { if (stackHandler.isSwitchOn()) { @@ -66,11 +66,11 @@ void PayloadPcduHandler::doShutDown() { if (retval == BUSY) { return; } - state == States::STACK_5V_PENDING; + state = States::STACK_5V_PENDING; } if (state == States::STACK_5V_PENDING) { if (not stackHandler.isSwitchOn()) { - state == States::STACK_5V_CORRECT; + state = States::STACK_5V_CORRECT; } } if (state == States::STACK_5V_CORRECT) { diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index 61704c91..9e24b771 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -29,7 +29,7 @@ void RadiationSensorHandler::doStartUp() { } if (internalState == InternalState::POWER_SWITCHING) { if (stackHandler.isSwitchOn()) { - internalState == InternalState::SETUP; + internalState = InternalState::SETUP; } } if (internalState == InternalState::CONFIGURED) { From ac446909663b93ab7bf85d41fa68ee74ddee224e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 16:20:32 +0100 Subject: [PATCH 13/52] place that outside of the lock --- mission/devices/PCDUHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 1b47c7f1..2a8607bf 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -175,6 +175,7 @@ void PCDUHandler::updatePdu2SwitchStates() { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { switcherSet.pdu2Switches[idx] = pdu2CoreHk.outputEnables[idx]; } + switcherSet.pdu2Switches.setValid(true); MutexGuard mg(pwrMutex); checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]); @@ -196,7 +197,6 @@ void PCDUHandler::updatePdu2SwitchStates() { if (firstSwitchInfoPdu2) { firstSwitchInfoPdu2 = false; } - switcherSet.pduSwitches.setValid(true); } else { sif::debug << "PCDUHandler::updatePdu2SwitchStates: Failed to read PDU2 Hk Dataset" << std::endl; @@ -212,6 +212,7 @@ void PCDUHandler::updatePdu1SwitchStates() { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { switcherSet.pdu1Switches[idx] = pdu1CoreHk.outputEnables[idx]; } + switcherSet.pdu1Switches.setValid(true); MutexGuard mg(pwrMutex); checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3, pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]); @@ -233,7 +234,6 @@ void PCDUHandler::updatePdu1SwitchStates() { if (firstSwitchInfoPdu1) { firstSwitchInfoPdu1 = false; } - switcherSet.pdu2Switches.setValid(true); } else { sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; } From 998c39d564bd4be7584fc4d6b5892f72f9f96fe9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 16:30:38 +0100 Subject: [PATCH 14/52] some minor fixes --- mission/system/objects/Stack5VHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index e09f2a59..d970d0f1 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -17,7 +17,7 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { if (handlerState == HandlerState::SWITCH_PENDING) { return BUSY; } - handlerState == HandlerState::SWITCH_PENDING; + handlerState = HandlerState::SWITCH_PENDING; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); } @@ -38,7 +38,7 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { (commander == StackCommander::RAD_SENSOR and plPcduIsOn)) { return returnvalue::OK; } - handlerState == HandlerState::SWITCH_PENDING; + handlerState = HandlerState::SWITCH_PENDING; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF); } From cbf5ca6d93028f46ba494bd2722984d33e250423 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Dec 2022 17:17:23 +0100 Subject: [PATCH 15/52] minor fixes for MPSoC code --- .../devicedefinitions/PlocMPSoCDefinitions.h | 2 +- linux/devices/ploc/PlocMPSoCHandler.cpp | 26 +++---------------- linux/devices/ploc/PlocMPSoCHandler.h | 5 +--- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index 8a88a716..9cb609bf 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -152,7 +152,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF { * sent and received packets. */ TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount) - : ploc::SpTcBase(params, apid, sequenceCount) { + : ploc::SpTcBase(params, apid, 0, sequenceCount) { spParams.setFullPayloadLen(INIT_LENGTH); } diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index 28513314..2ac58335 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -184,12 +184,14 @@ void PlocMPSoCHandler::doShutDown() { powerState = PowerState::SHUTDOWN; break; case PowerState::OFF: + sequenceCount = 0; setMode(_MODE_POWER_DOWN); break; default: break; } #else + sequenceCount = 0; uartIsolatorSwitch.pullLow(); setMode(_MODE_POWER_DOWN); powerState = PowerState::OFF; @@ -340,7 +342,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain } } - sequenceCount++; uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK; if (recvSeqCnt != sequenceCount) { triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt); @@ -403,11 +404,9 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) { ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount); result = tcMemWrite.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcMemWrite.getFullPacketLen()); @@ -417,11 +416,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcMemRead tcMemRead(spParams, sequenceCount); result = tcMemRead.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcMemRead.getFullPacketLen()); @@ -435,12 +432,10 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData, return MPSoCReturnValuesIF::NAME_TOO_LONG; } ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount); result = tcFlashDelete.buildPacket( std::string(reinterpret_cast(commandData), commandDataLen)); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcFlashDelete.getFullPacketLen()); @@ -450,11 +445,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount); result = tcReplayStart.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcReplayStart.getFullPacketLen()); @@ -463,11 +456,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount); result = tcReplayStop.buildPacket(); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcReplayStop.getFullPacketLen()); @@ -477,11 +468,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() { ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount); result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcDownlinkPwrOn.getFullPacketLen()); @@ -490,11 +479,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandDat ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount); result = tcDownlinkPwrOff.buildPacket(); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcDownlinkPwrOff.getFullPacketLen()); @@ -504,11 +491,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() { ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount); result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcReplayWriteSeq.getFullPacketLen()); @@ -517,11 +502,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount); result = tcModeReplay.buildPacket(); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcModeReplay.getFullPacketLen()); @@ -530,11 +513,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() { ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount); result = tcModeIdle.buildPacket(); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcModeIdle.getFullPacketLen()); @@ -544,11 +525,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() { ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; - sequenceCount++; mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount); result = tcCamCmdSend.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { - sequenceCount--; return result; } finishTcPrep(tcCamCmdSend.getFullPacketLen()); @@ -560,6 +539,7 @@ void PlocMPSoCHandler::finishTcPrep(size_t packetLen) { nextReplyId = mpsoc::ACK_REPORT; rawPacket = commandBuffer; rawPacketLen = packetLen; + sequenceCount++; } ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) { diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h index a7d7a427..99a12515 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -107,10 +107,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { MessageQueueIF* eventQueue = nullptr; MessageQueueIF* commandActionHelperQueue = nullptr; - // Initiate the sequence count with the maximum value. It is incremented before - // a packet is sent, so the first value will be 0 accordingly using - // the wrap around of the counter. - SourceSequenceCounter sequenceCount = SourceSequenceCounter(ccsds::LIMIT_SEQUENCE_COUNT - 1); + SourceSequenceCounter sequenceCount = SourceSequenceCounter(0); uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE]; SpacePacketCreator creator; From 30aa802069019d325ad15361ed37dcaa7004edd2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 10:13:26 +0100 Subject: [PATCH 16/52] minor udpates for PLOC SUPV code --- .../devicedefinitions/PlocSupervisorDefinitions.h | 10 +++------- linux/devices/ploc/PlocSupervisorHandler.cpp | 7 +++---- tmtc | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index cb0639fa..ffc310f0 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -730,17 +730,13 @@ class FactoryReset : public TcBase { : TcBase(params, Apid::DATA_LOGGER, static_cast(tc::DataLoggerServiceId::FACTORY_RESET), 0) {} - ReturnValue_t buildPacket(std::optional op) { - if (op) { - setLenFromPayloadLen(1); - } + ReturnValue_t buildPacket(uint8_t op) { + setLenFromPayloadLen(1); auto res = checkSizeAndSerializeHeader(); if (res != returnvalue::OK) { return res; } - if (op) { - payloadStart[0] = op.value(); - } + payloadStart[0] = op; return calcAndSetCrc(); } diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 08c63b1a..74ea8780 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -1467,11 +1467,10 @@ ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandDa ReturnValue_t PlocSupervisorHandler::prepareFactoryResetCmd(const uint8_t* commandData, size_t len) { FactoryReset resetCmd(spParams); - std::optional op; - if (len > 0) { - op = commandData[0]; + if (len < 1) { + return HasActionsIF::INVALID_PARAMETERS; } - ReturnValue_t result = resetCmd.buildPacket(op); + ReturnValue_t result = resetCmd.buildPacket(commandData[0]); if (result != returnvalue::OK) { return result; } diff --git a/tmtc b/tmtc index 00991b92..20c2f615 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 00991b92f15425aa80d2448ad304de46a08b5470 +Subproject commit 20c2f615555e5e7ddc03a2a22e225f75dff1c320 From 0163791e26884b05a79dfea7b4ffc6518b9469d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 10:17:54 +0100 Subject: [PATCH 17/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 20c2f615..825a1972 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 20c2f615555e5e7ddc03a2a22e225f75dff1c320 +Subproject commit 825a1972c4ca63f8044eff582a97b4221d513fec From 5e1d0543d7a521c89680eec1c2f05633c55e0317 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 10:32:21 +0100 Subject: [PATCH 18/52] afmt --- linux/devices/ploc/PlocSupervisorHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 74ea8780..54af97ec 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -1468,7 +1468,7 @@ ReturnValue_t PlocSupervisorHandler::prepareFactoryResetCmd(const uint8_t* comma size_t len) { FactoryReset resetCmd(spParams); if (len < 1) { - return HasActionsIF::INVALID_PARAMETERS; + return HasActionsIF::INVALID_PARAMETERS; } ReturnValue_t result = resetCmd.buildPacket(commandData[0]); if (result != returnvalue::OK) { From 04b9b035025cd8f89dc27579d9ddfe261ecc23a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 11:00:28 +0100 Subject: [PATCH 19/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 825a1972..5c675560 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 825a1972c4ca63f8044eff582a97b4221d513fec +Subproject commit 5c675560eadadfbb5e674d9be87c206df09d1771 From cfae090de4c40c775d0fef574093780a5e1f65f9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 11:46:01 +0100 Subject: [PATCH 20/52] improvements for ploc supv SW --- linux/devices/ploc/PlocSupervisorHandler.cpp | 38 +++++++++++--------- linux/devices/ploc/PlocSupervisorHandler.h | 8 ++--- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 54af97ec..17657b50 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -136,29 +136,34 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, } void PlocSupervisorHandler::doStartUp() { - if (setTimeDuringStartup) { - if (startupState == StartupState::OFF) { - bootTimeout.resetTimer(); - startupState = StartupState::BOOTING; - } - if (startupState == StartupState::BOOTING) { - if (bootTimeout.hasTimedOut()) { - uartIsolatorSwitch.pullHigh(); - uartManager.start(); + if (startupState == StartupState::OFF) { + bootTimeout.resetTimer(); + startupState = StartupState::BOOTING; + } + if (startupState == StartupState::BOOTING) { + if (bootTimeout.hasTimedOut()) { + uartIsolatorSwitch.pullHigh(); + uartManager.start(); + if (SET_TIME_DURING_BOOT) { startupState = StartupState::SET_TIME; + } else { + startupState = StartupState::ON; } } - if (startupState == StartupState::ON) { - setMode(_MODE_TO_ON); - } - } else { - uartIsolatorSwitch.pullHigh(); + } + if (startupState == StartupState::SET_TIME_EXECUTING) { + startupState = StartupState::ON; + } + if (startupState == StartupState::ON) { setMode(_MODE_TO_ON); } } void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); + shutdownCmdSent = false; + packetInBuffer = false; + nextReplyId = supv::NONE; uartManager.stop(); uartIsolatorSwitch.pullLow(); startupState = StartupState::OFF; @@ -1896,9 +1901,8 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionRepor break; } case supv::SET_TIME_REF: { - if (startupState == StartupState::SET_TIME_EXECUTING) { - startupState = StartupState::ON; - } + // We could only allow proper bootup when the time was set successfully, but + // this makes debugging difficult. break; } default: diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 4ffe4166..85934cdc 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -97,11 +97,11 @@ class PlocSupervisorHandler : public DeviceHandlerBase { static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000; // 60 s static const uint32_t MRAM_DUMP_TIMEOUT = 60000; - // 2 s - static const uint32_t BOOT_TIMEOUT = 2000; + // 5 s + static const uint32_t BOOT_TIMEOUT = 5000; enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON }; - bool setTimeDuringStartup = true; + static constexpr bool SET_TIME_DURING_BOOT = true; StartupState startupState = StartupState::OFF; @@ -138,8 +138,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase { uint32_t receivedMramDumpPackets = 0; /** Set to true as soon as a complete space packet is present in the spacePacketBuffer */ bool packetInBuffer = false; - /** Points to the next free position in the space packet buffer */ - uint16_t bufferTop = 0; /** This buffer is used to concatenate space packets received in two different read steps */ uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE]; From 8fedaa43e909c9061728db0eafb82090cc225ba3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 12:14:01 +0100 Subject: [PATCH 21/52] important bugfix for PLOC SUPV --- linux/devices/ploc/PlocSupervisorHandler.h | 4 ++-- linux/devices/ploc/PlocSupvUartMan.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 85934cdc..52e2619b 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -97,8 +97,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase { static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000; // 60 s static const uint32_t MRAM_DUMP_TIMEOUT = 60000; - // 5 s - static const uint32_t BOOT_TIMEOUT = 5000; + // 4 s + static const uint32_t BOOT_TIMEOUT = 4000; enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON }; static constexpr bool SET_TIME_DURING_BOOT = true; diff --git a/linux/devices/ploc/PlocSupvUartMan.cpp b/linux/devices/ploc/PlocSupvUartMan.cpp index a246d97c..1fd2b841 100644 --- a/linux/devices/ploc/PlocSupvUartMan.cpp +++ b/linux/devices/ploc/PlocSupvUartMan.cpp @@ -100,6 +100,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) { state = InternalState::SLEEPING; lock->unlockMutex(); semaphore->acquire(); + putTaskToSleep = false; while (true) { if (putTaskToSleep) { performUartShutdown(); @@ -295,11 +296,14 @@ void PlocSupvUartManager::stop() { } void PlocSupvUartManager::start() { - MutexGuard mg(lock); - if (state != InternalState::SLEEPING and state != InternalState::GO_TO_SLEEP) { - return; + { + MutexGuard mg(lock); + if (state != InternalState::SLEEPING and state != InternalState::GO_TO_SLEEP) { + return; + } + state = InternalState::DEFAULT; } - state = InternalState::DEFAULT; + semaphore->release(); } From 2531de507aedde1995b8e3283ac4ba1f1cf2dfed Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 12:18:44 +0100 Subject: [PATCH 22/52] bump changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f27fc7..21bdd758 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +## Fixed + +- PLOC SUPV: Minor adaptions and important bugfix for UART manager + ## Added - First version of ACS controller From 0afadc05a459bd4e7e4a633ef4b59fe4c852a974 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 12:23:04 +0100 Subject: [PATCH 23/52] repoint tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5c675560..24f6a59c 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5c675560eadadfbb5e674d9be87c206df09d1771 +Subproject commit 24f6a59cf98a01676beba37280d8840c3d0a3dbe From 76b162113f0f88430bd1b1c87c0a92baad84ae45 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Dec 2022 12:50:10 +0100 Subject: [PATCH 24/52] add normal to on trnasition --- mission/devices/PayloadPcduHandler.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 7b4353e4..f4aba7ef 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -69,6 +69,16 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { if (getMode() == _MODE_TO_NORMAL) { 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); + state = States::POWER_CHANNELS_ON; } DeviceHandlerBase::doTransition(modeFrom, subModeFrom); } @@ -144,6 +154,10 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ } }; + // sif::debug << "DIFF MASK: " << (int)diffMask << std::endl; + + // No handling for the SSRs: If those are pulled low, the ADC is off + // and normal mode does not really make sense anyway switchHandler(DRO_ON, gpioIds::PLPCDU_ENB_DRO, "DRO"); switchHandler(X8_ON, gpioIds::PLPCDU_ENB_X8, "X8"); switchHandler(TX_ON, gpioIds::PLPCDU_ENB_TX, "TX"); From d51904de2d4991034b26e2a5913b07d568b29b57 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 9 Jan 2023 11:57:48 +0100 Subject: [PATCH 25/52] disabled damaged PL PCDU1 TMP1075 --- bsp_q7s/core/ObjectFactory.cpp | 5 +++-- linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 3 +++ mission/controller/ThermalController.cpp | 6 +++++- mission/controller/ThermalController.h | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 85157e66..5a0c6367 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -123,11 +123,12 @@ void Factory::setStaticFrameworkObjectIds() { void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::createTmpComponents() { - std::array, 5> tmpDevIds = {{ + std::vector> tmpDevIds = {{ {objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0}, {objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1}, {objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0}, - {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, + // damaged + // {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, }}; std::vector tmpDevCookies; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f10043b5..5dd87e0b 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -455,6 +455,8 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); + // damaged + /* thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, @@ -464,6 +466,7 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); + */ thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 45f26f8b..f0356f66 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -41,7 +41,8 @@ ThermalController::ThermalController(object_id_t objectId) tmp1075SetTcs0(objects::TMP1075_HANDLER_TCS_0), tmp1075SetTcs1(objects::TMP1075_HANDLER_TCS_1), tmp1075SetPlPcdu0(objects::TMP1075_HANDLER_PLPCDU_0), - tmp1075SetPlPcdu1(objects::TMP1075_HANDLER_PLPCDU_1), + // damaged + // tmp1075SetPlPcdu1(objects::TMP1075_HANDLER_PLPCDU_1), tmp1075SetIfBoard(objects::TMP1075_HANDLER_IF_BOARD), susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB), @@ -449,6 +450,8 @@ void ThermalController::copySensors() { } } } + // damaged + /* { PoolReadGuard pg(&tmp1075SetPlPcdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg.getReadResult() == returnvalue::OK) { @@ -459,6 +462,7 @@ void ThermalController::copySensors() { } } } + */ { PoolReadGuard pg(&tmp1075SetIfBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg.getReadResult() == returnvalue::OK) { diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 5071d811..5f4569c3 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -55,10 +55,12 @@ class ThermalController : public ExtendedControllerBase { MAX31865::Max31865Set max31865Set13; MAX31865::Max31865Set max31865Set14; MAX31865::Max31865Set max31865Set15; + TMP1075::Tmp1075Dataset tmp1075SetTcs0; TMP1075::Tmp1075Dataset tmp1075SetTcs1; TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0; - TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1; + // damaged + // TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1; TMP1075::Tmp1075Dataset tmp1075SetIfBoard; // SUS From cce2da522967172ae052fb227c881d92cfd9149b Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 9 Jan 2023 13:29:59 +0100 Subject: [PATCH 26/52] yeah, its sequence counter ping-pong.. --- linux/devices/ploc/PlocMPSoCHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index 2ac58335..b1914111 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -347,6 +347,8 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt); sequenceCount = recvSeqCnt; } + // This sequence count ping pong does not make any sense but it is how the MPSoC expects it. + sequenceCount++; return result; } From a704986d74d667fe37ef2244ef8561f3e0d405db Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 14:50:03 +0100 Subject: [PATCH 27/52] update README --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 403189d6..19197bfa 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ helper scripts as well. 4. Run build command by double clicking the created target or by right clicking the project folder and selecting Build Project. -# Useful and Common Commands (Host) +# Useful and Common Commands ## Build generation @@ -319,14 +319,9 @@ cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Release .. cmake --build . -j ``` -### Q7S Watchdog - -The watchdog will be built along side the primary OBSW binary. - -### Hosted +### Hosted OBSW You can also use the FSFW OSAL `host` to build on Windows or for generic OSes. -Note: Currently this is not supported. ```sh mkdir cmake-build-debug && cd cmake-build-debug @@ -334,6 +329,21 @@ cmake -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. cmake --build . -j ``` +You can also use the `linux` OSAL: + +```sh +mkdir cmake-build-debug && cd cmake-build-debug +cmake -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug .. +cmake --build . -j +``` + +Please note that some additional Linux setup might be necessary. +You can find more information in the [Linux section of the FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-linux-mcu/src/branch/mueller/master/doc/README-linux.md#raising-message-queue-size-limit) + +### Q7S Watchdog + +The watchdog will be built along side the primary OBSW binary. + ### Unittests To build the unittests, the corresponding target must be specified in the build command. From fb37014b655901f276dec59bb225d2ade4d33901 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:19:15 +0100 Subject: [PATCH 28/52] make proprietary library --- CMakeLists.txt | 13 +++++-------- linux/CMakeLists.txt | 6 +++++- linux/devices/CMakeLists.txt | 6 +++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d87c2695..92c239e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -402,13 +402,13 @@ endif() add_subdirectory(thirdparty) if(EIVE_ADD_LINUX_FILES) - add_subdirectory(${LIB_ARCSEC_PATH}) + # add_subdirectory(${LIB_ARCSEC_PATH}) add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) -if(UNIX) - add_subdirectory(${LIB_GOMSPACE_PATH}) +if(UNIX AND TGT_BSP MATCHES "arm/q7s") + # add_subdirectory(${LIB_GOMSPACE_PATH}) endif() add_subdirectory(${COMMON_PATH}) @@ -489,7 +489,8 @@ target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION} ${LIB_DUMMIES}) if(TGT_BSP MATCHES "arm/q7s") - target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC}) + target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC} + ${LIB_GOMSPACE_CLIENTS}) endif() target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} @@ -499,10 +500,6 @@ if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) endif() -if(UNIX) - target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS}) -endif() - if(EIVE_ADD_ETL_LIB) target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET}) endif() diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 7f6ea0bc..b500c823 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(csp) add_subdirectory(utility) add_subdirectory(callbacks) add_subdirectory(boardtest) @@ -9,4 +8,9 @@ if(EIVE_ADD_LINUX_FSFWCONFIG) add_subdirectory(fsfwconfig) endif() +# Dependency on proprietary library +if(TGT_BSP MATCHES "arm/q7s") + add_subdirectory(csp) +endif() + target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp scheduling.cpp) diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index de0ea1da..a6a909d0 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -7,4 +7,8 @@ target_sources( ScexDleParser.cpp ScexHelper.cpp) add_subdirectory(ploc) -add_subdirectory(startracker) + +# Dependency on proprietary library +if(TGT_BSP MATCHES "arm/q7s") + add_subdirectory(startracker) +endif() From 5303139498c8fc2da109ace253c176233c0b95a6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:21:06 +0100 Subject: [PATCH 29/52] helper script to clone all necessary submodules --- clone_submodules_no_privlibs.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 clone_submodules_no_privlibs.sh diff --git a/clone_submodules_no_privlibs.sh b/clone_submodules_no_privlibs.sh new file mode 100755 index 00000000..78ac604b --- /dev/null +++ b/clone_submodules_no_privlibs.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +git submodule update --init fsfw thirdparty/rapidcsv thirdparty/lwgps From 4f01026883350cdc41b2338e5d6dcf4b34395a6c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:21:36 +0100 Subject: [PATCH 30/52] add json clone --- clone_submodules_no_privlibs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clone_submodules_no_privlibs.sh b/clone_submodules_no_privlibs.sh index 78ac604b..ae08a9ce 100755 --- a/clone_submodules_no_privlibs.sh +++ b/clone_submodules_no_privlibs.sh @@ -1,3 +1,3 @@ #!/bin/bash -git submodule update --init fsfw thirdparty/rapidcsv thirdparty/lwgps +git submodule update --init fsfw thirdparty/rapidcsv thirdparty/lwgps thirdparty/json From 217d1b63f2a11a535dc40f004de7d39fcb9e13fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:44:29 +0100 Subject: [PATCH 31/52] some tweaks --- bsp_hosted/Dockerfile | 2 +- cmake/scripts/host/host-make-debug.sh | 4 ++++ cmake/scripts/host/host-make-release.sh | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bsp_hosted/Dockerfile b/bsp_hosted/Dockerfile index c55ccc67..4d897426 100644 --- a/bsp_hosted/Dockerfile +++ b/bsp_hosted/Dockerfile @@ -14,7 +14,7 @@ RUN set -ex; \ rm -rf build-hosted; \ mkdir build-hosted; \ cd build-hosted; \ - cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux ..; + cmake -DCMAKE_BUILD_TYPE=Release -DOSAL_FSFW=host ..; ENTRYPOINT ["cmake", "--build", "build-hosted"] CMD ["-j"] diff --git a/cmake/scripts/host/host-make-debug.sh b/cmake/scripts/host/host-make-debug.sh index 412bf68f..a0acf80f 100755 --- a/cmake/scripts/host/host-make-debug.sh +++ b/cmake/scripts/host/host-make-debug.sh @@ -1,12 +1,14 @@ #!/bin/bash cfg_script_name="cmake-build-cfg.py" init_dir=$(pwd) +root_dir="" if [ -z "${EIVE_OBSW_ROOT}" ]; then counter=0 while [ ${counter} -lt 5 ] do cd .. if [ -f ${cfg_script_name} ];then + root_dir=$(realpath "../..") break fi counter=$((counter=counter + 1)) @@ -18,6 +20,7 @@ if [ -z "${EIVE_OBSW_ROOT}" ]; then fi else cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}" + root_dir=${EIVE_OBSW_ROOT} fi build_generator="make" @@ -35,3 +38,4 @@ set -x # Print command ${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" # Use this if commands are added which should not be printed # set +x +cd ${root_dir}/${builddir} diff --git a/cmake/scripts/host/host-make-release.sh b/cmake/scripts/host/host-make-release.sh index d564c8aa..997d3294 100755 --- a/cmake/scripts/host/host-make-release.sh +++ b/cmake/scripts/host/host-make-release.sh @@ -7,6 +7,7 @@ if [ -z "${EIVE_OBSW_ROOT}" ]; then do cd .. if [ -f ${cfg_script_name} ];then + root_dir=$(realpath "../..") break fi counter=$((counter=counter + 1)) @@ -20,7 +21,7 @@ else cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}" fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="host" builddir="cmake-build-release" if [ "${OS}" = "Windows_NT" ]; then @@ -35,3 +36,4 @@ set -x # Print command ${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}" # Use this if commands are added which should not be printed # set +x +cd ${root_dir}/${builddir} From 663fa0f4ac989a3295f5f4eaca04a07f1df47130 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:47:27 +0100 Subject: [PATCH 32/52] that should be better --- cmake/scripts/host/host-make-debug.sh | 2 +- cmake/scripts/host/host-make-release.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/host/host-make-debug.sh b/cmake/scripts/host/host-make-debug.sh index a0acf80f..cb7a3fb5 100755 --- a/cmake/scripts/host/host-make-debug.sh +++ b/cmake/scripts/host/host-make-debug.sh @@ -37,5 +37,5 @@ echo "Running command (without the leading +):" set -x # Print command ${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" # Use this if commands are added which should not be printed -# set +x +set +x cd ${root_dir}/${builddir} diff --git a/cmake/scripts/host/host-make-release.sh b/cmake/scripts/host/host-make-release.sh index 997d3294..5aee7618 100755 --- a/cmake/scripts/host/host-make-release.sh +++ b/cmake/scripts/host/host-make-release.sh @@ -35,5 +35,5 @@ echo "Running command (without the leading +):" set -x # Print command ${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}" # Use this if commands are added which should not be printed -# set +x +set +x cd ${root_dir}/${builddir} From 1d8549f81089d95c9b4209242923b884e494b836 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:55:01 +0100 Subject: [PATCH 33/52] this should work better --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92c239e7..9e88c804 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -402,15 +402,14 @@ endif() add_subdirectory(thirdparty) if(EIVE_ADD_LINUX_FILES) - # add_subdirectory(${LIB_ARCSEC_PATH}) + if(TGT_BSP MATCHES "arm/q7s") + add_subdirectory(${LIB_GOMSPACE_PATH}) + add_subdirectory(${LIB_ARCSEC_PATH}) + endif() add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) -if(UNIX AND TGT_BSP MATCHES "arm/q7s") - # add_subdirectory(${LIB_GOMSPACE_PATH}) -endif() - add_subdirectory(${COMMON_PATH}) add_subdirectory(${DUMMY_PATH}) From 25e7872a6fa53bd0fc6f64d4f9f467cda47d9206 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 15:59:42 +0100 Subject: [PATCH 34/52] this is consistent --- ...e_submodules_no_privlibs.sh => clone-submodules-no-privlibs.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename clone_submodules_no_privlibs.sh => clone-submodules-no-privlibs.sh (100%) diff --git a/clone_submodules_no_privlibs.sh b/clone-submodules-no-privlibs.sh similarity index 100% rename from clone_submodules_no_privlibs.sh rename to clone-submodules-no-privlibs.sh From cb7608b4e6afc4dea97266b83f49d82fe74b9316 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 16:03:04 +0100 Subject: [PATCH 35/52] bumpchangelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21bdd758..ec47364f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ list yields a list of all related PRs for each release. ## Fixed - PLOC SUPV: Minor adaptions and important bugfix for UART manager +- Allow cloning and building the hosted OBSW version without proprietary libraries, + which also avoids the need to have a Gitea account. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/337 ## Added From 772fab2b7156cccb04b8848ae932163b10403a54 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 17:48:28 +0100 Subject: [PATCH 36/52] no PCDU for EM for now --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e88c804..3c770eb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,11 +71,13 @@ if(EIVE_Q7S_EM) 1 CACHE STRING "Q7S EM configuration") set(INIT_VAL 0) + set(OBSW_ADD_GOMSPACE_PCDU 0) else() set(OBSW_Q7S_EM 0 CACHE STRING "Q7S EM configuration") set(INIT_VAL 1) + set(OBSW_ADD_GOMSPACE_PCDU 1) endif() set(OBSW_ADD_MGT ${INIT_VAL} From 98ecbfba61170987222aed28596b524b8e76ec46 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Jan 2023 17:50:31 +0100 Subject: [PATCH 37/52] this is more correct --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c770eb3..093580d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,13 +71,11 @@ if(EIVE_Q7S_EM) 1 CACHE STRING "Q7S EM configuration") set(INIT_VAL 0) - set(OBSW_ADD_GOMSPACE_PCDU 0) else() set(OBSW_Q7S_EM 0 CACHE STRING "Q7S EM configuration") set(INIT_VAL 1) - set(OBSW_ADD_GOMSPACE_PCDU 1) endif() set(OBSW_ADD_MGT ${INIT_VAL} @@ -143,7 +141,7 @@ set(OBSW_ADD_TMP_DEVICES ${INIT_VAL} CACHE STRING "Add TMP devices") set(OBSW_ADD_GOMSPACE_PCDU - 1 + ${INIT_VAL} CACHE STRING "Add GomSpace PCDU modules") set(OBSW_ADD_RW ${INIT_VAL} From 8fde9ee9be81535b0c18261876125ba92337fd72 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 11:01:30 +0100 Subject: [PATCH 38/52] small fix for PL PCDU handler shutdown handling --- mission/devices/PayloadPcduHandler.cpp | 10 +--------- tmtc | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index c5956b6b..bcba7a6c 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -66,14 +66,6 @@ void PayloadPcduHandler::doShutDown() { if (retval == BUSY) { return; } - state = States::STACK_5V_PENDING; - } - if (state == States::STACK_5V_PENDING) { - if (not stackHandler.isSwitchOn()) { - state = States::STACK_5V_CORRECT; - } - } - if (state == States::STACK_5V_CORRECT) { state = States::PL_PCDU_OFF; // No need to set mode _MODE_POWER_DOWN, power switching was already handled setMode(MODE_OFF); @@ -93,7 +85,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX); gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0); gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1); - state = States::POWER_CHANNELS_ON; + state = States::STACK_5V_CORRECT; } DeviceHandlerBase::doTransition(modeFrom, subModeFrom); } diff --git a/tmtc b/tmtc index 24f6a59c..c4dbf3d8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 24f6a59cf98a01676beba37280d8840c3d0a3dbe +Subproject commit c4dbf3d8bedc7be1848945629c6367586390c4f4 From fca45014e45e571fa4b1f412fd7ecf204227b041 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 11:13:34 +0100 Subject: [PATCH 39/52] fixes for switchig algorithm --- mission/devices/PayloadPcduHandler.cpp | 4 +-- mission/devices/RadiationSensorHandler.cpp | 4 +-- mission/system/objects/Stack5VHandler.cpp | 37 +++++++++++++++------- mission/system/objects/Stack5VHandler.h | 7 ++-- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index bcba7a6c..908a4c3e 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -34,7 +34,7 @@ void PayloadPcduHandler::doStartUp() { state = States::STACK_5V_SWITCHING; } if (state == States::STACK_5V_SWITCHING) { - ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::PL_PCDU); + ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::PL_PCDU, true); if (retval == BUSY) { return; } @@ -62,7 +62,7 @@ void PayloadPcduHandler::doShutDown() { } if (state == States::STACK_5V_SWITCHING) { - ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU); + ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU, true); if (retval == BUSY) { return; } diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index 9e24b771..0520daec 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -21,7 +21,7 @@ RadiationSensorHandler::~RadiationSensorHandler() {} void RadiationSensorHandler::doStartUp() { if (internalState == InternalState::OFF) { - ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::RAD_SENSOR); + ReturnValue_t retval = stackHandler.deviceToOn(StackCommander::RAD_SENSOR, true); if (retval == BUSY) { return; } @@ -42,7 +42,7 @@ void RadiationSensorHandler::doStartUp() { } void RadiationSensorHandler::doShutDown() { - ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::RAD_SENSOR); + ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::RAD_SENSOR, true); if (retval == BUSY) { return; } diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index d970d0f1..457ca7b5 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -4,8 +4,11 @@ Stack5VHandler::Stack5VHandler(PowerSwitchIF& switcher) : switcher(switcher) { stackLock = MutexFactory::instance()->createMutex(); } -ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { +ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander, bool updateStates) { MutexGuard mg(stackLock); + if (updateStates) { + updateInternalStates(); + } if (switchIsOn) { if (commander == StackCommander::PL_PCDU) { plPcduIsOn = true; @@ -21,8 +24,11 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander) { return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); } -ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { +ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander, bool updateStates) { MutexGuard mg(stackLock); + if (updateStates) { + updateInternalStates(); + } if (not switchIsOn) { if (commander == StackCommander::PL_PCDU) { plPcduIsOn = false; @@ -44,6 +50,15 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander) { bool Stack5VHandler::isSwitchOn() { MutexGuard mg(stackLock); + return updateInternalStates(); +} + +void Stack5VHandler::update() { + MutexGuard mg(stackLock); + updateInternalStates(); +} + +bool Stack5VHandler::updateInternalStates() { if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) { if (not switchIsOn) { if (handlerState == HandlerState::SWITCH_PENDING) { @@ -52,15 +67,15 @@ bool Stack5VHandler::isSwitchOn() { switchIsOn = true; } return true; - } else { - if (switchIsOn) { - if (handlerState == HandlerState::SWITCH_PENDING) { - handlerState = HandlerState::IDLE; - } - switchIsOn = false; - } - radSensorIsOn = false; - plPcduIsOn = false; } + if (switchIsOn) { + if (handlerState == HandlerState::SWITCH_PENDING) { + handlerState = HandlerState::IDLE; + } + switchIsOn = false; + } + radSensorIsOn = false; + plPcduIsOn = false; + return false; } diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h index 3a703b86..36dfc907 100644 --- a/mission/system/objects/Stack5VHandler.h +++ b/mission/system/objects/Stack5VHandler.h @@ -13,10 +13,11 @@ class Stack5VHandler { static constexpr ReturnValue_t BUSY = returnvalue::makeCode(1, 0); Stack5VHandler(PowerSwitchIF& switcher); - ReturnValue_t deviceToOn(StackCommander commander); - ReturnValue_t deviceToOff(StackCommander commander); + ReturnValue_t deviceToOn(StackCommander commander, bool updateStates); + ReturnValue_t deviceToOff(StackCommander commander, bool updateStates); bool isSwitchOn(); + void update(); private: MutexIF* stackLock; @@ -26,6 +27,8 @@ class Stack5VHandler { bool radSensorIsOn = false; bool plPcduIsOn = false; pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK; + + bool updateInternalStates(); }; #endif /* MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ */ From 39dfed2ab58ab08a5eea521a2d7f0b6ba2a98b32 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 11:17:04 +0100 Subject: [PATCH 40/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5c675560..c4dbf3d8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5c675560eadadfbb5e674d9be87c206df09d1771 +Subproject commit c4dbf3d8bedc7be1848945629c6367586390c4f4 From e383c90487b2ece40cc73db774b33151d893f018 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 13:26:50 +0100 Subject: [PATCH 41/52] bump fsfw and tmtc --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 05cad893..5bb66c97 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 05cad893a2b713827cf4cdc9afe49675f18afcc7 +Subproject commit 5bb66c9723892409ac6cbdc6de9d9250f7969213 diff --git a/tmtc b/tmtc index 5c675560..c4dbf3d8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5c675560eadadfbb5e674d9be87c206df09d1771 +Subproject commit c4dbf3d8bedc7be1848945629c6367586390c4f4 From 7b6e32ff8626bda57e8c5685dcfecc63d9228d0b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 14:03:41 +0100 Subject: [PATCH 42/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index c4dbf3d8..dcd881bc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit c4dbf3d8bedc7be1848945629c6367586390c4f4 +Subproject commit dcd881bc1426370d0c410a6bfd60e2e5b5358f7d From 6503778cd5bc0379adbc6e1d458d6515f1a19aa0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 14:17:55 +0100 Subject: [PATCH 43/52] various bugfixes --- bsp_q7s/core/ObjectFactory.cpp | 2 +- mission/devices/CMakeLists.txt | 2 +- mission/devices/{PCDUHandler.cpp => PcduHandler.cpp} | 7 ++++--- mission/devices/{PCDUHandler.h => PcduHandler.h} | 0 mission/devices/devicedefinitions/GomspaceDefinitions.h | 5 ++--- 5 files changed, 8 insertions(+), 8 deletions(-) rename mission/devices/{PCDUHandler.cpp => PcduHandler.cpp} (99%) rename mission/devices/{PCDUHandler.h => PcduHandler.h} (100%) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 70e16002..7219b96d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -54,6 +54,7 @@ #include "linux/boardtest/LibgpiodTest.h" #endif #include +#include #include @@ -80,7 +81,6 @@ #include "mission/devices/HeaterHandler.h" #include "mission/devices/Max31865PT1000Handler.h" #include "mission/devices/P60DockHandler.h" -#include "mission/devices/PCDUHandler.h" #include "mission/devices/PDU1Handler.h" #include "mission/devices/PDU2Handler.h" #include "mission/devices/PayloadPcduHandler.h" diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index b8fb326c..1589a460 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -3,7 +3,7 @@ target_sources( PRIVATE GomspaceDeviceHandler.cpp BpxBatteryHandler.cpp Tmp1075Handler.cpp - PCDUHandler.cpp + PcduHandler.cpp P60DockHandler.cpp PDU1Handler.cpp PDU2Handler.cpp diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PcduHandler.cpp similarity index 99% rename from mission/devices/PCDUHandler.cpp rename to mission/devices/PcduHandler.cpp index 2a8607bf..0030242f 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PcduHandler.cpp @@ -1,11 +1,10 @@ -#include "PCDUHandler.h" - #include #include #include #include #include #include +#include #include PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) @@ -104,8 +103,10 @@ void PCDUHandler::initializeSwitchStates() { for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { if (idx < PDU::CHANNELS_LEN) { switchStates[idx] = INIT_SWITCHES_PDU1.at(idx); - } else { + } else if (idx < PDU::CHANNELS_LEN * 2) { switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN); + } else { + switchStates[idx] = OFF; } } } catch (const std::out_of_range& err) { diff --git a/mission/devices/PCDUHandler.h b/mission/devices/PcduHandler.h similarity index 100% rename from mission/devices/PCDUHandler.h rename to mission/devices/PcduHandler.h diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index bc8b2edd..75a81d8f 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -737,11 +737,10 @@ enum Switches : power::Switch_t { PDU2_CH7_ACS_BOARD_SIDE_B_3V3, PDU2_CH8_PAYLOAD_CAMERA, - P60_DOCK_5V_STACK + P60_DOCK_5V_STACK, + NUMBER_OF_SWITCHES }; -static constexpr uint8_t NUMBER_OF_SWITCHES = 18; - static const uint8_t ON = 1; static const uint8_t OFF = 0; From 557162fe8cb02d664f6b3d1229304ea7a2e4a091 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 15:04:49 +0100 Subject: [PATCH 44/52] some more bugfixes --- mission/devices/PcduHandler.cpp | 73 ++++++++++++----------- mission/devices/PcduHandler.h | 2 +- mission/system/objects/Stack5VHandler.cpp | 36 +++++------ mission/system/objects/Stack5VHandler.h | 1 + 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/mission/devices/PcduHandler.cpp b/mission/devices/PcduHandler.cpp index 0030242f..5e952edf 100644 --- a/mission/devices/PcduHandler.cpp +++ b/mission/devices/PcduHandler.cpp @@ -41,6 +41,8 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { if (pg.getReadResult() == returnvalue::OK) { if (switcherSet.p60Dock5VStack.value != switchState) { triggerEvent(power::SWITCH_HAS_CHANGED, switchState, pcdu::Switches::P60_DOCK_5V_STACK); + MutexGuard mg(pwrMutex); + switchStates[pcdu::P60_DOCK_5V_STACK] = switchState; } switcherSet.p60Dock5VStack.setValid(true); switcherSet.p60Dock5VStack.value = switchState; @@ -178,23 +180,23 @@ void PCDUHandler::updatePdu2SwitchStates() { } switcherSet.pdu2Switches.setValid(true); MutexGuard mg(pwrMutex); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH0_Q7S, pdu2CoreHk.outputEnables[Channels::Q7S]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, - pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH1]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH2_RW_5V, pdu2CoreHk.outputEnables[Channels::RW]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V, - pdu2CoreHk.outputEnables[Channels::TCS_HEATER_IN]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3, - pdu2CoreHk.outputEnables[Channels::SUS_REDUNDANT]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, - pdu2CoreHk.outputEnables[Channels::DEPY_MECHANISM]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, - pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH6]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3, - pdu2CoreHk.outputEnables[Channels::ACS_B_SIDE]); - checkAndUpdateSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA, - pdu2CoreHk.outputEnables[Channels::PAYLOAD_CAMERA]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8, + pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH1]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH2_RW_5V, pdu2CoreHk.outputEnables[Channels::RW]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V, + pdu2CoreHk.outputEnables[Channels::TCS_HEATER_IN]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH4_SUS_REDUNDANT_3V3, + pdu2CoreHk.outputEnables[Channels::SUS_REDUNDANT]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, + pdu2CoreHk.outputEnables[Channels::DEPY_MECHANISM]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, + pdu2CoreHk.outputEnables[Channels::PAYLOAD_PCDU_CH6]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH7_ACS_BOARD_SIDE_B_3V3, + pdu2CoreHk.outputEnables[Channels::ACS_B_SIDE]); + checkAndUpdatePduSwitch(pdu, Switches::PDU2_CH8_PAYLOAD_CAMERA, + pdu2CoreHk.outputEnables[Channels::PAYLOAD_CAMERA]); if (firstSwitchInfoPdu2) { firstSwitchInfoPdu2 = false; } @@ -215,23 +217,24 @@ void PCDUHandler::updatePdu1SwitchStates() { } switcherSet.pdu1Switches.setValid(true); MutexGuard mg(pwrMutex); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3, - pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V, - pdu1CoreHk.outputEnables[Channels::SYRLINKS]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V, - pdu1CoreHk.outputEnables[Channels::STR]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH3_MGT_5V, pdu1CoreHk.outputEnables[Channels::MGT]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3, - pdu1CoreHk.outputEnables[Channels::SUS_NOMINAL]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V, - pdu1CoreHk.outputEnables[Channels::SOL_CELL_EXPERIMENT]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH6_PLOC_12V, - pdu1CoreHk.outputEnables[Channels::PLOC]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3, - pdu1CoreHk.outputEnables[Channels::ACS_A_SIDE]); - checkAndUpdateSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED, - pdu1CoreHk.outputEnables[Channels::UNUSED]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH0_TCS_BOARD_3V3, + pdu1CoreHk.outputEnables[Channels::TCS_BOARD_3V3]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH1_SYRLINKS_12V, + pdu1CoreHk.outputEnables[Channels::SYRLINKS]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH2_STAR_TRACKER_5V, + pdu1CoreHk.outputEnables[Channels::STR]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH3_MGT_5V, + pdu1CoreHk.outputEnables[Channels::MGT]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH4_SUS_NOMINAL_3V3, + pdu1CoreHk.outputEnables[Channels::SUS_NOMINAL]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH5_SOLAR_CELL_EXP_5V, + pdu1CoreHk.outputEnables[Channels::SOL_CELL_EXPERIMENT]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH6_PLOC_12V, + pdu1CoreHk.outputEnables[Channels::PLOC]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH7_ACS_A_SIDE_3V3, + pdu1CoreHk.outputEnables[Channels::ACS_A_SIDE]); + checkAndUpdatePduSwitch(pdu, Switches::PDU1_CH8_UNOCCUPIED, + pdu1CoreHk.outputEnables[Channels::UNUSED]); if (firstSwitchInfoPdu1) { firstSwitchInfoPdu1 = false; } @@ -450,8 +453,8 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) { } } -void PCDUHandler::checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, - uint8_t setValue) { +void PCDUHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, + uint8_t setValue) { using namespace pcdu; if (switchStates[switchIdx] != setValue) { #if OBSW_INITIALIZE_SWITCHES == 1 diff --git a/mission/devices/PcduHandler.h b/mission/devices/PcduHandler.h index 34491de8..d1f3996b 100644 --- a/mission/devices/PcduHandler.h +++ b/mission/devices/PcduHandler.h @@ -130,7 +130,7 @@ class PCDUHandler : public PowerSwitchIF, */ void updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset, CCSDSTime::CDS_short* datasetTimeStamp); - void checkAndUpdateSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, uint8_t setValue); + void checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx, uint8_t setValue); }; #endif /* MISSION_DEVICES_PCDUHANDLER_H_ */ diff --git a/mission/system/objects/Stack5VHandler.cpp b/mission/system/objects/Stack5VHandler.cpp index 457ca7b5..1a3141c4 100644 --- a/mission/system/objects/Stack5VHandler.cpp +++ b/mission/system/objects/Stack5VHandler.cpp @@ -9,6 +9,9 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander, bool updateSt if (updateStates) { updateInternalStates(); } + if (handlerState == HandlerState::SWITCH_PENDING) { + return BUSY; + } if (switchIsOn) { if (commander == StackCommander::PL_PCDU) { plPcduIsOn = true; @@ -17,10 +20,9 @@ ReturnValue_t Stack5VHandler::deviceToOn(StackCommander commander, bool updateSt } return returnvalue::OK; } - if (handlerState == HandlerState::SWITCH_PENDING) { - return BUSY; - } + handlerState = HandlerState::SWITCH_PENDING; + targetState = true; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_ON); } @@ -29,6 +31,11 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander, bool updateS if (updateStates) { updateInternalStates(); } + // wait for our turn + if (handlerState == HandlerState::SWITCH_PENDING) { + return BUSY; + } + // If the switch is already off, we are done if (not switchIsOn) { if (commander == StackCommander::PL_PCDU) { plPcduIsOn = false; @@ -37,14 +44,13 @@ ReturnValue_t Stack5VHandler::deviceToOff(StackCommander commander, bool updateS } return returnvalue::OK; } - if (handlerState == HandlerState::SWITCH_PENDING) { - return BUSY; - } + // If one device is still on, do not turn off the switch if ((commander == StackCommander::PL_PCDU and radSensorIsOn) or (commander == StackCommander::RAD_SENSOR and plPcduIsOn)) { return returnvalue::OK; } handlerState = HandlerState::SWITCH_PENDING; + targetState = false; return switcher.sendSwitchCommand(stackSwitch, PowerSwitchIF::SWITCH_OFF); } @@ -60,22 +66,16 @@ void Stack5VHandler::update() { bool Stack5VHandler::updateInternalStates() { if (switcher.getSwitchState(stackSwitch) == PowerSwitchIF::SWITCH_ON) { - if (not switchIsOn) { - if (handlerState == HandlerState::SWITCH_PENDING) { - handlerState = HandlerState::IDLE; - } + if (handlerState == HandlerState::SWITCH_PENDING and targetState) { + handlerState = HandlerState::IDLE; switchIsOn = true; } return true; - } - if (switchIsOn) { - if (handlerState == HandlerState::SWITCH_PENDING) { - handlerState = HandlerState::IDLE; - } + } else if (handlerState == HandlerState::SWITCH_PENDING and not targetState) { + handlerState = HandlerState::IDLE; switchIsOn = false; + radSensorIsOn = false; + plPcduIsOn = false; } - radSensorIsOn = false; - plPcduIsOn = false; - return false; } diff --git a/mission/system/objects/Stack5VHandler.h b/mission/system/objects/Stack5VHandler.h index 36dfc907..7ade81e5 100644 --- a/mission/system/objects/Stack5VHandler.h +++ b/mission/system/objects/Stack5VHandler.h @@ -23,6 +23,7 @@ class Stack5VHandler { MutexIF* stackLock; PowerSwitchIF& switcher; bool switchIsOn = false; + bool targetState = false; HandlerState handlerState = HandlerState::IDLE; bool radSensorIsOn = false; bool plPcduIsOn = false; From 635473b6879ad2b0b2be49c27a8827c9e5544220 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 15:08:38 +0100 Subject: [PATCH 45/52] better naming --- mission/devices/PcduHandler.cpp | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mission/devices/PcduHandler.cpp b/mission/devices/PcduHandler.cpp index 5e952edf..29b8dc6e 100644 --- a/mission/devices/PcduHandler.cpp +++ b/mission/devices/PcduHandler.cpp @@ -251,52 +251,52 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO uint16_t memoryAddress = 0; size_t parameterValueSize = sizeof(uint8_t); uint8_t parameterValue = 0; - GomspaceDeviceHandler* pdu = nullptr; + GomspaceDeviceHandler* module = nullptr; switch (switchNr) { case pcdu::PDU1_CH0_TCS_BOARD_3V3: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH1_SYRLINKS_12V: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SYRLINKS; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH2_STAR_TRACKER_5V: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_STAR_TRACKER; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH3_MGT_5V: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_MGT; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH4_SUS_NOMINAL_3V3: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH5_SOLAR_CELL_EXP_5V: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH6_PLOC_12V: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_PLOC; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH7_ACS_A_SIDE_3V3: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } case pcdu::PDU1_CH8_UNOCCUPIED: { memoryAddress = PDU1::CONFIG_ADDRESS_OUT_EN_CHANNEL8; - pdu = ObjectManager::instance()->get(objects::PDU1_HANDLER); + module = ObjectManager::instance()->get(objects::PDU1_HANDLER); break; } // This is a dangerous command. Reject/Igore it for now @@ -308,47 +308,47 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO } case pcdu::PDU2_CH1_PL_PCDU_BATT_0_14V8: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH2_RW_5V: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_RW; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH3_TCS_BOARD_HEATER_IN_8V: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH4_SUS_REDUNDANT_3V3: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH5_DEPLOYMENT_MECHANISM_8V: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH6_PL_PCDU_BATT_1_14V8: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH7_ACS_BOARD_SIDE_B_3V3: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::PDU2_CH8_PAYLOAD_CAMERA: { memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA; - pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); + module = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; } case pcdu::P60_DOCK_5V_STACK: { memoryAddress = P60Dock::CONFIG_ADDRESS_OUT_EN_5V_STACK; - pdu = ObjectManager::instance()->get(objects::P60DOCK_HANDLER); + module = ObjectManager::instance()->get(objects::P60DOCK_HANDLER); break; } @@ -384,7 +384,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO CommandMessage message; ActionMessage::setCommand(&message, GOMSPACE::PARAM_SET, storeAddress); - result = commandQueue->sendMessage(pdu->getCommandQueue(), &message, 0); + result = commandQueue->sendMessage(module->getCommandQueue(), &message, 0); if (result != returnvalue::OK) { sif::debug << "PCDUHandler::sendSwitchCommand: Failed to send message to PDU Handler" << std::endl; From d52ee5ff38cdad38e827dcb16d500ace4b8618e1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 15:16:52 +0100 Subject: [PATCH 46/52] finally appears to work --- mission/devices/PayloadPcduHandler.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 908a4c3e..0f691c75 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -25,7 +25,7 @@ PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, sdcMan(sdcMan) {} void PayloadPcduHandler::doStartUp() { - if ((state != States::PL_PCDU_OFF) and (state != States::ON_TRANS_SSR)) { + if (state > States::STACK_5V_CORRECT) { // Config error sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl; } @@ -60,16 +60,13 @@ void PayloadPcduHandler::doShutDown() { std::memset(adcSet.processed.value, 0, adcSet.processed.getSerializedSize()); clearSetOnOffFlag = false; } - - if (state == States::STACK_5V_SWITCHING) { - ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU, true); - if (retval == BUSY) { - return; - } - state = States::PL_PCDU_OFF; - // No need to set mode _MODE_POWER_DOWN, power switching was already handled - setMode(MODE_OFF); + ReturnValue_t retval = stackHandler.deviceToOff(StackCommander::PL_PCDU, true); + if (retval == BUSY) { + return; } + state = States::PL_PCDU_OFF; + // No need to set mode _MODE_POWER_DOWN, power switching was already handled + setMode(MODE_OFF); } void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { From 82d4569e793d6798f23806913571556f69bce761 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 15:40:04 +0100 Subject: [PATCH 47/52] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index dcd881bc..b032defa 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit dcd881bc1426370d0c410a6bfd60e2e5b5358f7d +Subproject commit b032defa7c6450cbbf21ffe8cfc50f6d5d5bc614 From 27e2708b7b669b023371a9964a84deb8e60d88cd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 15:41:09 +0100 Subject: [PATCH 48/52] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10bdcb1c..7a79325c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +## Changed + +- 5V stack is now off by default + ## Fixed - PLOC SUPV: Minor adaptions and important bugfix for UART manager From ce9fac6b71b97da30116911685e450bc1b8ae049 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Jan 2023 16:23:54 +0100 Subject: [PATCH 49/52] v1.19.0 --- CHANGELOG.md | 2 ++ CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a79325c..fb2c5be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v1.19.0] 10.01.2023 + ## Changed - 5V stack is now off by default diff --git a/CMakeLists.txt b/CMakeLists.txt index 093580d3..190d6658 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1) -set(OBSW_VERSION_MINOR_IF_GIT_FAILS 18) +set(OBSW_VERSION_MINOR_IF_GIT_FAILS 19) set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0) # set(CMAKE_VERBOSE TRUE) From 93eac8c6eb907e728f4b8cc4496c21973479b475 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Jan 2023 09:26:33 +0100 Subject: [PATCH 50/52] update README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 19197bfa..b6fa64e9 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,7 @@ When using Windows, run theses steps in MSYS2. 2. Update all the submodules ```sh - git submodule init - git submodule sync - git submodule update + git submodule update --init ``` 3. Ensure that the cross-compiler is working with `arm-linux-gnueabihf-gcc --version` and that @@ -322,6 +320,8 @@ cmake --build . -j ### Hosted OBSW You can also use the FSFW OSAL `host` to build on Windows or for generic OSes. +You can use the `clone-submodules-no-privlibs.sh` script to only clone the required (non-private) +submodules required to build the hosted OBSW. ```sh mkdir cmake-build-debug && cd cmake-build-debug From 7ea03106f77b6ba7d0ee1001f1806edbc3bb010a Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Thu, 12 Jan 2023 19:14:47 +0100 Subject: [PATCH 51/52] Added a udp forwarding --- scripts/q7s-ssh-udp-forwarding.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 scripts/q7s-ssh-udp-forwarding.sh diff --git a/scripts/q7s-ssh-udp-forwarding.sh b/scripts/q7s-ssh-udp-forwarding.sh new file mode 100755 index 00000000..35303246 --- /dev/null +++ b/scripts/q7s-ssh-udp-forwarding.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Setting up all Q7S ports" +echo "upd connection from local port 18000 -> tcp ssh tunnel -> EM port 7301" + + +socat udp4-listen:18000,reuseaddr,fork tcp:localhost:18002 & +ssh -L 18002:localhost:18123 eive@flatsat.eive.absatvirt.lw 'socat tcp4-listen:18123,reuseaddr udp:192.168.133.10:7301' + From 3ae08a4a57f62e5d420619858dae32cff4ce806f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 13 Jan 2023 11:21:02 +0100 Subject: [PATCH 52/52] bump fsfw and tmtc, update changelog --- CHANGELOG.md | 4 ++++ fsfw | 2 +- tmtc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb2c5be0..e04ce0f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +## Changed + +- Bumped FSFW for Service 11 improvement which includes size and CRC check for contained TC + # [v1.19.0] 10.01.2023 ## Changed diff --git a/fsfw b/fsfw index 5bb66c97..accaf855 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5bb66c9723892409ac6cbdc6de9d9250f7969213 +Subproject commit accaf855ee53d3dc429d7bcdf1b7b89768c166b6 diff --git a/tmtc b/tmtc index b032defa..d652c466 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b032defa7c6450cbbf21ffe8cfc50f6d5d5bc614 +Subproject commit d652c4663b6e738345799026a16d6d2f00d7e65d