From d80ef280dd493f4df4a4b6461be86bdd45bdc213 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 13:53:32 +0200 Subject: [PATCH 01/19] update power API --- fsfw | 2 +- mission/devices/HeaterHandler.cpp | 6 ++++-- mission/devices/HeaterHandler.h | 4 ++-- mission/devices/PCDUHandler.cpp | 13 ++++++++----- mission/devices/PCDUHandler.h | 4 ++-- tmtc | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fsfw b/fsfw index e6130263..3ea9f999 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e6130263ef144c5b1f6eafef734a0150a92d6cda +Subproject commit 3ea9f999b746963efad591517e80ccd904cb051f diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 255ba6ec..53acf02e 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -134,7 +134,7 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t return result; } -void HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const { +ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { ReturnValue_t result; store_address_t storeAddress; uint8_t commandData[2]; @@ -338,7 +338,9 @@ gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) { MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } -void HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) const {} +ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { + return RETURN_OK; +} ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0; } diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 2a8ce555..18b821ec 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -43,8 +43,8 @@ class HeaterHandler : public ExecutableObjectIF, virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; - virtual void sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const override; - virtual void sendFuseOnCommand(uint8_t fuseNr) const override; + virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; /** * @brief This function will be called from the Heater object to check * the current switch state. diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index e54222b1..e59f2ab7 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -205,7 +205,7 @@ void PCDUHandler::updatePdu1SwitchStates() { LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; } -void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const { +ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { using namespace pcduSwitches; ReturnValue_t result; uint16_t memoryAddress = 0; @@ -261,7 +261,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const } // This is a dangerous command. Reject/Igore it for now case pcduSwitches::PDU2_CH0_Q7S: { - return; + return RETURN_FAILED; // memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_Q7S; // pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); // break; @@ -309,7 +309,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const default: { sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl; - return; + return RETURN_FAILED; } } @@ -322,7 +322,7 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const break; default: sif::error << "PCDUHandler::sendSwitchCommand: Invalid state commanded" << std::endl; - return; + return RETURN_FAILED; } GomspaceSetParamMessage setParamMessage(memoryAddress, ¶meterValue, parameterValueSize); @@ -347,9 +347,12 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const // Can't use trigger event because of const function constraint, but this hack seems to work this->forwardEvent(power::SWITCH_CMD_SENT, parameterValue, switchNr); } + return RETURN_OK; } -void PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) const {} +ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { + return RETURN_OK; +} ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) { diff --git a/mission/devices/PCDUHandler.h b/mission/devices/PCDUHandler.h index 3d014205..c44052bb 100644 --- a/mission/devices/PCDUHandler.h +++ b/mission/devices/PCDUHandler.h @@ -33,8 +33,8 @@ class PCDUHandler : public PowerSwitchIF, store_address_t storeId = storeId::INVALID_STORE_ADDRESS, bool* clearMessage = nullptr) override; - virtual void sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const override; - virtual void sendFuseOnCommand(uint8_t fuseNr) const override; + virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; + virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; virtual ReturnValue_t getSwitchState(uint8_t switchNr) const override; virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; virtual uint32_t getSwitchDelayMs(void) const override; diff --git a/tmtc b/tmtc index 43a534db..e3743042 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 43a534db9cf8ee14e6c1296dac8b3e2c3c94b240 +Subproject commit e37430423e814b9e05f25d63970f2c2b5048cfb1 From 69ba11acc1c839ac4625e2dd35fc5c1745d80b37 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Mar 2022 16:07:13 +0200 Subject: [PATCH 02/19] perform nReset handling in Assembly now --- mission/devices/HeaterHandler.cpp | 1 + mission/system/AcsBoardAssembly.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 53acf02e..9e97f02a 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -164,6 +164,7 @@ ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t o << "message" << std::endl; } } + return RETURN_OK; } void HeaterHandler::handleActiveCommands() { diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/AcsBoardAssembly.cpp index 5a8f0956..6ea701d5 100644 --- a/mission/system/AcsBoardAssembly.cpp +++ b/mission/system/AcsBoardAssembly.cpp @@ -142,6 +142,18 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A); cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); if (gpsUsable) { + if (gpioIF->pullHigh(gpioIds::GNSS_0_NRESET) != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 high (used GNSS)" << std::endl; +#endif + } + if (gpioIF->pullLow(gpioIds::GNSS_1_NRESET) != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 low (unused GNSS)" << std::endl; +#endif + } if (gpioIF->pullLow(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low" @@ -165,6 +177,18 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); if (gpsUsable) { + if (gpioIF->pullHigh(gpioIds::GNSS_1_NRESET) != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 high (used GNSS)" << std::endl; +#endif + } + if (gpioIF->pullLow(gpioIds::GNSS_0_NRESET) != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 low (unused GNSS)" << std::endl; +#endif + } if (gpioIF->pullHigh(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high" @@ -186,6 +210,8 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); ReturnValue_t status = RETURN_OK; if (gpsUsable) { + gpioIF->pullHigh(gpioIds::GNSS_1_NRESET); + gpioIF->pullHigh(gpioIds::GNSS_0_NRESET); if (defaultSubmode == Submodes::A_SIDE) { status = gpioIF->pullLow(gpioIds::GNSS_SELECT); } else { From 9eaa73264441e37b673456caf3ae60a02d21ee41 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Mar 2022 16:08:13 +0200 Subject: [PATCH 03/19] delete code which is not required anymore --- bsp_q7s/core/ObjectFactory.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 4c8ec3fc..80ac754a 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -278,10 +278,8 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); - pdu1handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF); PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); - pdu2handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); From 0ba2caaf61428ce2e517fc5b17cb444810ef38ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Mar 2022 16:53:05 +0200 Subject: [PATCH 04/19] set the time in the code directly now --- linux/devices/GPSHyperionLinuxController.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index a811fbc5..7ebff478 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -9,6 +9,7 @@ #include #endif #include +#include GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps) @@ -172,6 +173,8 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { timeval time = {}; time.tv_sec = gpsSet.unixSeconds.value; time.tv_usec = gps->fix.time.tv_nsec / 1000; + // Update the system time here for now. NTP seems to be unable to do so for whatever reason + settimeofday(&time, nullptr); Clock::TimeOfDay_t timeOfDay = {}; Clock::convertTimevalToTimeOfDay(&time, &timeOfDay); gpsSet.year = timeOfDay.year; @@ -192,6 +195,9 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { std::cout << "Longitude: " << gps->fix.longitude << std::endl; std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl; std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; + std::time_t t = std::time(nullptr); + std::tm tm = *std::gmtime(&t); + std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl; } } #endif From a8457d7966257907eb28fc00fe9dabe2e3bab99e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Mar 2022 16:59:48 +0200 Subject: [PATCH 05/19] small safety mechanism for time --- linux/devices/GPSHyperionLinuxController.cpp | 15 +++++++++++++-- linux/devices/GPSHyperionLinuxController.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 7ebff478..821946c7 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -173,8 +173,19 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { timeval time = {}; time.tv_sec = gpsSet.unixSeconds.value; time.tv_usec = gps->fix.time.tv_nsec / 1000; - // Update the system time here for now. NTP seems to be unable to do so for whatever reason - settimeofday(&time, nullptr); + std::time_t t = std::time(nullptr); + if (time.tv_sec == t) { + timeIsConstantCounter++; + } else { + timeIsConstantCounter = 0; + } + // If the received time does not change anymore for whatever reason, do not set it here + // to avoid stale times + if(timeIsConstantCounter < 3) { + // Update the system time here for now. NTP seems to be unable to do so for whatever reason + settimeofday(&time, nullptr); + } + Clock::TimeOfDay_t timeOfDay = {}; Clock::convertTimevalToTimeOfDay(&time, &timeOfDay); gpsSet.year = timeOfDay.year; diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index f0e4e6e0..d0157f9c 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -51,6 +51,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { bool modeCommanded = true; gpsmm myGpsmm; bool debugHyperionGps = false; + uint32_t timeIsConstantCounter = 0; void readGpsDataFromGpsd(); }; From 9cfb2bad51626d90b40106c00685852368300d87 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Mar 2022 17:47:40 +0200 Subject: [PATCH 06/19] only set time every 60 seconds --- linux/devices/GPSHyperionLinuxController.cpp | 9 ++++++--- linux/devices/GPSHyperionLinuxController.h | 1 + mission/devices/HeaterHandler.cpp | 4 +--- mission/devices/PCDUHandler.cpp | 4 +--- mission/system/AcsBoardAssembly.cpp | 12 ++++++++---- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 821946c7..1a1f752e 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -16,7 +16,9 @@ GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, obj : ExtendedControllerBase(objectId, objects::NO_OBJECT), gpsSet(this), myGpsmm(GPSD_SHARED_MEMORY, nullptr), - debugHyperionGps(debugHyperionGps) {} + debugHyperionGps(debugHyperionGps) { + timeUpdateCd.resetTimer(); +} GPSHyperionLinuxController::~GPSHyperionLinuxController() {} @@ -180,10 +182,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { timeIsConstantCounter = 0; } // If the received time does not change anymore for whatever reason, do not set it here - // to avoid stale times - if(timeIsConstantCounter < 3) { + // to avoid stale times. Also, don't do it too often often to avoid jumping times + if (timeIsConstantCounter < 3 and timeUpdateCd.hasTimedOut()) { // Update the system time here for now. NTP seems to be unable to do so for whatever reason settimeofday(&time, nullptr); + timeUpdateCd.resetTimer(); } Clock::TimeOfDay_t timeOfDay = {}; diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index d0157f9c..46acb5fc 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -52,6 +52,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { gpsmm myGpsmm; bool debugHyperionGps = false; uint32_t timeIsConstantCounter = 0; + Countdown timeUpdateCd = Countdown(60); void readGpsDataFromGpsd(); }; diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 9e97f02a..fcafefd8 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -339,9 +339,7 @@ gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) { MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } -ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { - return RETURN_OK; -} +ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; } ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0; } diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index e59f2ab7..ab35b52f 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -350,9 +350,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO return RETURN_OK; } -ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { - return RETURN_OK; -} +ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; } ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) { diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/AcsBoardAssembly.cpp index 6ea701d5..e93d79b8 100644 --- a/mission/system/AcsBoardAssembly.cpp +++ b/mission/system/AcsBoardAssembly.cpp @@ -145,13 +145,15 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s if (gpioIF->pullHigh(gpioIds::GNSS_0_NRESET) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 0 high (used GNSS)" << std::endl; + "of GNSS 0 high (used GNSS)" + << std::endl; #endif } if (gpioIF->pullLow(gpioIds::GNSS_1_NRESET) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 1 low (unused GNSS)" << std::endl; + "of GNSS 1 low (unused GNSS)" + << std::endl; #endif } if (gpioIF->pullLow(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { @@ -180,13 +182,15 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s if (gpioIF->pullHigh(gpioIds::GNSS_1_NRESET) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 1 high (used GNSS)" << std::endl; + "of GNSS 1 high (used GNSS)" + << std::endl; #endif } if (gpioIF->pullLow(gpioIds::GNSS_0_NRESET) != HasReturnvaluesIF::RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 0 low (unused GNSS)" << std::endl; + "of GNSS 0 low (unused GNSS)" + << std::endl; #endif } if (gpioIF->pullHigh(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { From f1fe1154473102b31287c814b13a28f5ba0ecda4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 30 Mar 2022 13:12:19 +0200 Subject: [PATCH 07/19] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 3ea9f999..c2581ff4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 3ea9f999b746963efad591517e80ccd904cb051f +Subproject commit c2581ff4f5fe9c5aacfa0905868d07959e90f29e From 413f5526395d75f0c63003d0bf25fb3738b620a2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 31 Mar 2022 16:16:01 +0200 Subject: [PATCH 08/19] improvements from sus test --- bsp_q7s/core/InitMission.cpp | 6 ++++-- bsp_q7s/core/ObjectFactory.cpp | 19 ++++++++++--------- bsp_q7s/core/ObjectFactory.h | 3 +++ fsfw | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 2 +- .../pollingSequenceFactory.cpp | 9 +-------- tmtc | 2 +- 7 files changed, 21 insertions(+), 22 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 1d502fef..ced1d12a 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -127,12 +127,14 @@ void initmission::initTasks() { "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); result = sysTask->addComponent(objects::ACS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("ACS_ASS", objects::ACS_BOARD_ASS); + initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS); } +#if OBSW_ADD_SUS_BOARD_ASS == 1 result = sysTask->addComponent(objects::SUS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("SUS_ASS", objects::SUS_BOARD_ASS); + initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS); } +#endif result = sysTask->addComponent(objects::TCS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e7dbbe6e..5caa44f4 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -711,15 +711,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, acsBoardHelper, gpioComIF); static_cast(acsAss); -#if OBSW_TEST_ACS_BOARD_ASS == 1 - CommandMessage msg; - ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, - duallane::A_SIDE); - ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Sending mode command failed" << std::endl; - } -#endif #endif /* OBSW_ADD_ACS_HANDLERS == 1 */ } @@ -1222,3 +1213,13 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { new UartTestClass(objects::UART_TEST); #endif } + +void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) { + CommandMessage msg; + ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, + duallane::A_SIDE); + ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Sending mode command failed" << std::endl; + } +} diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 958e8f86..37581170 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -6,6 +6,7 @@ class UartComIF; class SpiComIF; class I2cComIF; class PowerSwitchIF; +class AcsBoardAssembly; namespace ObjectFactory { @@ -31,6 +32,8 @@ void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF); +void testAcsBrdAss(AcsBoardAssembly* assAss); + }; // namespace ObjectFactory #endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/fsfw b/fsfw index c2581ff4..b3d2d440 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c2581ff4f5fe9c5aacfa0905868d07959e90f29e +Subproject commit b3d2d440d790899cee60797c2dacae53812df279 diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 69e6744b..1e7fc090 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -44,6 +44,7 @@ debugging. */ #define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_SUN_SENSORS 1 +#define OBSW_ADD_SUS_BOARD_ASS 1 #define OBSW_ADD_ACS_BOARD 1 #define OBSW_ADD_ACS_HANDLERS 1 #define OBSW_ADD_RW 0 @@ -115,7 +116,6 @@ debugging. */ #define OBSW_ADD_UART_TEST_CODE 0 #define OBSW_TEST_ACS 0 -#define OBSW_TEST_ACS_BOARD_ASS 0 #define OBSW_DEBUG_ACS 0 #define OBSW_TEST_SUS 0 #define OBSW_DEBUG_SUS 0 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index fdd4897e..0f9232e0 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -177,14 +177,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool addSus9 = true; bool addSus10 = true; bool addSus11 = true; - /** - * The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all - * requests to a sun sensor must be performed consecutively. Another reason for calling multiple - * device handler cycles is that the ADC conversions take some time. Thus first the ADC - * conversions are initiated and in a next step the results can be read from the internal FIFO. - * One sun sensor communication sequence also blocks the SPI bus. So other devices can not be - * inserted between the device handler cycles of one SUS. - */ + if (addSus0) { /* Write setup */ thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION); diff --git a/tmtc b/tmtc index b5a9dac8..a1478466 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b5a9dac8f6d3733779a67a72b14a20091069a346 +Subproject commit a14784666f6d8ce0e3d993ae60edd235363a95e1 From c55fafee484dc7d718796d41a1ea16662ea121b0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 1 Apr 2022 14:11:41 +0200 Subject: [PATCH 09/19] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index b3d2d440..1bc7a918 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit b3d2d440d790899cee60797c2dacae53812df279 +Subproject commit 1bc7a918694030d1f49f1d2998a289d77b132849 From 189674a9bb1ddd750d85eca022ac8c19d8695653 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 3 Apr 2022 20:12:14 +0200 Subject: [PATCH 10/19] re-enable all suses --- .../pollingSequenceFactory.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index dece29fe..0f9232e0 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -165,17 +165,17 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #if OBSW_ADD_SUN_SENSORS == 1 - bool addSus0 = false; - bool addSus1 = false; - bool addSus2 = false; - bool addSus3 = false; - bool addSus4 = false; - bool addSus5 = false; - bool addSus6 = false; - bool addSus7 = false; - bool addSus8 = false; - bool addSus9 = false; - bool addSus10 = false; + bool addSus0 = true; + bool addSus1 = true; + bool addSus2 = true; + bool addSus3 = true; + bool addSus4 = true; + bool addSus5 = true; + bool addSus6 = true; + bool addSus7 = true; + bool addSus8 = true; + bool addSus9 = true; + bool addSus10 = true; bool addSus11 = true; if (addSus0) { From 99f56a89af000324ada562ee8ff9913d4969a5de Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Apr 2022 12:00:39 +0200 Subject: [PATCH 11/19] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index a1478466..a39c7007 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a14784666f6d8ce0e3d993ae60edd235363a95e1 +Subproject commit a39c7007c6aef8cac559b38cdf1b9c8815c346ee From b12ffb6f44c2bf120a9d82548afe8f658568faf9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Apr 2022 13:39:35 +0200 Subject: [PATCH 12/19] PL PCDU switch states like mode bitmask now --- bsp_q7s/core/ObjectFactory.cpp | 6 +- .../PlocSupervisorDefinitions.h | 2 +- linux/devices/ploc/PlocMPSoCHandler.cpp | 131 +++++++++--------- linux/devices/ploc/PlocSupervisorHandler.cpp | 21 ++- linux/devices/ploc/PlocUpdater.cpp | 23 ++- .../devices/startracker/StarTrackerHandler.h | 2 +- mission/devices/P60DockHandler.cpp | 3 + mission/devices/PayloadPcduHandler.cpp | 34 +++-- mission/devices/RadiationSensorHandler.cpp | 24 ++-- mission/devices/SyrlinksHkHandler.cpp | 31 +++-- mission/devices/SyrlinksHkHandler.h | 3 +- .../payloadPcduDefinitions.h | 17 +-- mission/system/AcsBoardAssembly.cpp | 30 ++-- 13 files changed, 165 insertions(+), 162 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 123ef60e..2d28a095 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -662,9 +662,9 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { auto supvGpioCookie = new GpioCookie; supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); gpioComIF->addGpios(supvGpioCookie); - auto supervisorCookie = new UartCookie( - objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, - uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20); + auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, + q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, + uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20); supervisorCookie->setNoFixedSizeReply(); new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index 96e72f86..58166e98 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -1541,6 +1541,6 @@ class LatchupStatusReport : public StaticLocalDataSet { lp_var_t isSet = lp_var_t(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this); }; -} // namespace PLOC_SPV +} // namespace supv #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */ diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index d6777afd..13fa9ed7 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -1,9 +1,9 @@ #include "PlocMPSoCHandler.h" -#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h" #include "OBSWConfig.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/globalfunctions/CRC.h" +#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h" PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, @@ -87,8 +87,8 @@ void PlocMPSoCHandler::performOperationHook() { } } CommandMessage message; - for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK; - result = commandActionHelperQueue->receiveMessage(&message)) { + for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); + result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) { result = commandActionHelper.handleReply(&message); if (result == RETURN_OK) { continue; @@ -133,31 +133,31 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI } void PlocMPSoCHandler::doStartUp() { - switch(powerState) { - case PowerState::OFF: + switch (powerState) { + case PowerState::OFF: commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); powerState = PowerState::BOOTING; break; - case PowerState::ON: + case PowerState::ON: setMode(_MODE_TO_ON); uartIsolatorSwitch.pullHigh(); break; - default: + default: break; } } void PlocMPSoCHandler::doShutDown() { - switch(powerState) { - case PowerState::ON: + switch (powerState) { + case PowerState::ON: uartIsolatorSwitch.pullLow(); commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC); powerState = PowerState::SHUTDOWN; break; - case PowerState::OFF: + case PowerState::OFF: setMode(_MODE_POWER_DOWN); break; - default: + default: break; } } @@ -703,64 +703,57 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { return replyLen; } -MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { - return commandActionHelperQueue; -} +MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; } -void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { - return; -} +void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; } void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step, - ReturnValue_t returnCode) { - switch (actionId) { - case supv::START_MPSOC: - sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" - << std::endl; - powerState = PowerState::OFF; - break; - case supv::SHUTDOWN_MPSOC: - triggerEvent(MPSOC_SHUTDOWN_FAILED); - sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" - << std::endl; - // TODO: Setting state to on or off here? - powerState = PowerState::ON; - break; - default: - sif::debug - << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply" - << std::endl; - break; - } + ReturnValue_t returnCode) { + switch (actionId) { + case supv::START_MPSOC: + sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl; + powerState = PowerState::OFF; + break; + case supv::SHUTDOWN_MPSOC: + triggerEvent(MPSOC_SHUTDOWN_FAILED); + sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl; + // TODO: Setting state to on or off here? + powerState = PowerState::ON; + break; + default: + sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply" + << std::endl; + break; + } } void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { - return; + return; } void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) { - if (actionId != supv::EXE_REPORT) { - sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action " - << "ID" << std::endl; - return; - } - switch(powerState) { + if (actionId != supv::EXE_REPORT) { + sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action " + << "ID" << std::endl; + return; + } + switch (powerState) { case PowerState::BOOTING: { - powerState = PowerState::ON; - break; + powerState = PowerState::ON; + break; } case PowerState::SHUTDOWN: { - powerState = PowerState::OFF; - break; + powerState = PowerState::OFF; + break; } default: { break; } - } + } } void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { - handleActionCommandFailure(actionId); + handleActionCommandFailure(actionId); } void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, @@ -862,27 +855,27 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) { switch (actionId) { case supv::ACK_REPORT: case supv::EXE_REPORT: - break; + break; default: - sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID " - << std::endl; - return; + sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID " + << std::endl; + return; } - switch(powerState) { - case PowerState::BOOTING: { - sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC" - << std::endl; - powerState = PowerState::OFF; - break; - } - case PowerState::SHUTDOWN: { - sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" - << std::endl; - powerState = PowerState::ON; - break; - } - default: - break; + switch (powerState) { + case PowerState::BOOTING: { + sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC" + << std::endl; + powerState = PowerState::OFF; + break; + } + case PowerState::SHUTDOWN: { + sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" + << std::endl; + powerState = PowerState::ON; + break; + } + default: + break; } return; } diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 078475c9..5065c7dd 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -384,7 +384,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { if (powerSwitch == power::NO_SWITCH) { - return DeviceHandlerBase::NO_SWITCH; + return DeviceHandlerBase::NO_SWITCH; } *numberOfSwitches = 1; *switches = &powerSwitch; @@ -489,8 +489,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite switch (command->first) { case supv::GET_HK_REPORT: { enabledReplies = 3; - result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, - supv::HK_REPORT); + result = + DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::HK_REPORT); if (result != RETURN_OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::HK_REPORT << " not in replyMap" << std::endl; @@ -589,15 +589,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT); if (result != RETURN_OK) { - sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " - << supv::ACK_REPORT << " not in replyMap" << std::endl; + sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::ACK_REPORT + << " not in replyMap" << std::endl; } result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT); if (result != RETURN_OK) { - sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " - << supv::EXE_REPORT << " not in replyMap" << std::endl; + sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::EXE_REPORT + << " not in replyMap" << std::endl; } return RETURN_OK; @@ -1013,7 +1013,7 @@ void PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) { void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) { supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2), - *(commandData + 3)); + *(commandData + 3)); packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); } @@ -1459,9 +1459,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) { return MRAM_FILE_NOT_EXISTS; } std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out); - file.write( - reinterpret_cast(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), - packetLen - 1); + file.write(reinterpret_cast(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), + packetLen - 1); file.close(); return RETURN_OK; } diff --git a/linux/devices/ploc/PlocUpdater.cpp b/linux/devices/ploc/PlocUpdater.cpp index 220b1e00..37a553da 100644 --- a/linux/devices/ploc/PlocUpdater.cpp +++ b/linux/devices/ploc/PlocUpdater.cpp @@ -262,12 +262,11 @@ void PlocUpdater::commandUpdateAvailable() { calcImageCrc(); supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast(image), - static_cast(partition), imageSize, imageCrc, - numOfUpdatePackets); + static_cast(partition), imageSize, imageCrc, numOfUpdatePackets); - result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, - supv::UPDATE_AVAILABLE, packet.getWholeData(), - packet.getFullSize()); + result = + commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_AVAILABLE, + packet.getWholeData(), packet.getFullSize()); if (result != RETURN_OK) { sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" << " packet to supervisor handler" << std::endl; @@ -311,9 +310,9 @@ void PlocUpdater::commandUpdatePacket() { } packet.makeCrc(); - result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, - supv::UPDATE_IMAGE_DATA, packet.getWholeData(), - packet.getFullSize()); + result = + commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_IMAGE_DATA, + packet.getWholeData(), packet.getFullSize()); if (result != RETURN_OK) { sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update" @@ -335,12 +334,10 @@ void PlocUpdater::commandUpdateVerify() { ReturnValue_t result = RETURN_OK; supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast(image), - static_cast(partition), imageSize, imageCrc, - numOfUpdatePackets); + static_cast(partition), imageSize, imageCrc, numOfUpdatePackets); - result = - commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY, - packet.getWholeData(), packet.getFullSize()); + result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY, + packet.getWholeData(), packet.getFullSize()); if (result != RETURN_OK) { sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" << " packet to supervisor handler" << std::endl; diff --git a/linux/devices/startracker/StarTrackerHandler.h b/linux/devices/startracker/StarTrackerHandler.h index 2667db31..90a30966 100644 --- a/linux/devices/startracker/StarTrackerHandler.h +++ b/linux/devices/startracker/StarTrackerHandler.h @@ -7,12 +7,12 @@ #include "ArcsecJsonParamBase.h" #include "OBSWConfig.h" #include "StrHelper.h" +#include "devices/powerSwitcherList.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/src/fsfw/serialize/SerializeAdapter.h" #include "fsfw/timemanager/Countdown.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" #include "thirdparty/arcsec_star_tracker/common/SLIP.h" -#include "devices/powerSwitcherList.h" /** * @brief This is the device handler for the star tracker from arcsec. diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index b506a92b..ed209b86 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -441,6 +441,9 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &local localDataPoolMap.emplace(P60System::P60DOCK_ANT6_DEPL, new PoolEntry({0})); localDataPoolMap.emplace(P60System::P60DOCK_AR6_DEPL, new PoolEntry({0})); +#if OBSW_ENABLE_PERIODIC_HK == 1 + poolManager.subscribeForPeriodicPacket(p60dockHkTableDataset.getSid(), false, 0.8, true); +#endif return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 7a1924c1..67cf8c10 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -66,7 +66,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) { using namespace plpcdu; - if (submode == NormalSubmodes::SOLID_STATE_RELAYS_ADC_ON) { + if (((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) { if (state == States::PL_PCDU_OFF) { sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF" << "detected" << std::endl; @@ -116,7 +116,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ } } - if (submode == NormalSubmodes::DRO_ON) { + if (((submode >> DRO_ON) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Enabling PL PCDU DRO module" << std::endl; #endif @@ -127,7 +127,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ setMode(MODE_NORMAL, submode); } - if (submode == NormalSubmodes::X8_ON) { + if (((submode >> X8_ON) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Enabling PL PCDU X8 module" << std::endl; #endif @@ -138,7 +138,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ setMode(MODE_NORMAL, submode); } - if (submode == NormalSubmodes::TX_ON) { + if (((submode >> TX_ON) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Enabling PL PCDU TX module" << std::endl; #endif @@ -149,7 +149,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ setMode(MODE_NORMAL, submode); } - if (submode == NormalSubmodes::MPA_ON) { + if (((submode >> MPA_ON) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Enabling PL PCDU MPA module" << std::endl; #endif @@ -160,7 +160,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ setMode(MODE_NORMAL, submode); } - if (submode == NormalSubmodes::HPA_ON) { + if (((submode >> HPA_ON) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Enabling PL PCDU HPA module" << std::endl; #endif @@ -549,24 +549,30 @@ ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t using namespace plpcdu; if (mode == MODE_NORMAL) { // Also deals with the case where the mode is MODE_ON, submode should be 0 here - if (submode == NormalSubmodes::SOLID_STATE_RELAYS_ADC_ON and - (this->mode == MODE_NORMAL and this->submode != NormalSubmodes::ALL_OFF)) { + if ((((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == SOLID_STATE_RELAYS_ADC_ON) and + (this->mode == MODE_NORMAL and this->submode != ALL_OFF_SUBMODE)) { return TRANS_NOT_ALLOWED; } - if ((submode == NormalSubmodes::DRO_ON and - this->submode != NormalSubmodes::SOLID_STATE_RELAYS_ADC_ON)) { + if (((((submode >> DRO_ON) & 1) == 1) and + (this->submode != (1 << SOLID_STATE_RELAYS_ADC_ON)))) { return TRANS_NOT_ALLOWED; } - if ((submode == NormalSubmodes::X8_ON and this->submode != NormalSubmodes::DRO_ON)) { + if ((((submode >> X8_ON) & 1) == 1) and + (this->submode != ((1 << SOLID_STATE_RELAYS_ADC_ON) | (1 << DRO_ON)))) { return TRANS_NOT_ALLOWED; } - if ((submode == NormalSubmodes::TX_ON and this->submode != NormalSubmodes::X8_ON)) { + if (((((submode >> TX_ON) & 1) == 1) and + (this->submode != ((1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } - if ((submode == NormalSubmodes::MPA_ON and this->submode != NormalSubmodes::TX_ON)) { + if ((((submode >> MPA_ON) & 1) == 1 and + (this->submode != + ((1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } - if ((submode == NormalSubmodes::HPA_ON and this->submode != NormalSubmodes::MPA_ON)) { + if ((((submode >> HPA_ON) & 1) == 1 and + (this->submode != ((1 << MPA_ON) | (1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) | + (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } return HasReturnvaluesIF::RETURN_OK; diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index 179444ca..e91d8427 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -92,15 +92,15 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t return RETURN_OK; } case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: { - printPeriodicData = true; - rawPacketLen = 0; - return RETURN_OK; - } - case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: { - rawPacketLen = 0; - printPeriodicData = false; - return RETURN_OK; - } + printPeriodicData = true; + rawPacketLen = 0; + return RETURN_OK; + } + case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: { + rawPacketLen = 0; + printPeriodicData = false; + return RETURN_OK; + } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -123,7 +123,7 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t switch (*foundId) { case RAD_SENSOR::START_CONVERSION: case RAD_SENSOR::WRITE_SETUP: - *foundLen = remainingSize; + *foundLen = remainingSize; return IGNORE_REPLY_DATA; case RAD_SENSOR::READ_CONVERSIONS: { ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET); @@ -138,8 +138,8 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t } case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: - sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl; - break; + sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl; + break; default: break; } diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index 017bd53c..53a8af23 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -139,42 +139,45 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic return RETURN_OK; } case (SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE): { - readTxAgcValueHighByte.copy(reinterpret_cast(commandBuffer), readTxAgcValueHighByte.size(), 0); + readTxAgcValueHighByte.copy(reinterpret_cast(commandBuffer), + readTxAgcValueHighByte.size(), 0); rawPacketLen = readTxAgcValueHighByte.size(); rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE; rawPacket = commandBuffer; return RETURN_OK; } case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): { - readTxAgcValueLowByte.copy(reinterpret_cast(commandBuffer), readTxAgcValueLowByte.size(), 0); + readTxAgcValueLowByte.copy(reinterpret_cast(commandBuffer), + readTxAgcValueLowByte.size(), 0); rawPacketLen = readTxAgcValueLowByte.size(); rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE; rawPacket = commandBuffer; return RETURN_OK; } case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE): - tempPowerAmpBoardHighByte.copy(reinterpret_cast(commandBuffer), tempPowerAmpBoardHighByte.size(), - 0); + tempPowerAmpBoardHighByte.copy(reinterpret_cast(commandBuffer), + tempPowerAmpBoardHighByte.size(), 0); rawPacketLen = tempPowerAmpBoardHighByte.size(); rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE; rawPacket = commandBuffer; return RETURN_OK; case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE): - tempPowerAmpBoardLowByte.copy(reinterpret_cast(commandBuffer), tempPowerAmpBoardLowByte.size(), - 0); + tempPowerAmpBoardLowByte.copy(reinterpret_cast(commandBuffer), + tempPowerAmpBoardLowByte.size(), 0); rawPacketLen = tempPowerAmpBoardLowByte.size(); rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE; rawPacket = commandBuffer; return RETURN_OK; case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE): - tempBasebandBoardHighByte.copy(reinterpret_cast(commandBuffer), tempBasebandBoardHighByte.size(), - 0); + tempBasebandBoardHighByte.copy(reinterpret_cast(commandBuffer), + tempBasebandBoardHighByte.size(), 0); rawPacketLen = tempBasebandBoardHighByte.size(); rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE; rawPacket = commandBuffer; return RETURN_OK; case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE): - tempBasebandBoardLowByte.copy(reinterpret_cast(commandBuffer), tempBasebandBoardLowByte.size(), 0); + tempBasebandBoardLowByte.copy(reinterpret_cast(commandBuffer), + tempBasebandBoardLowByte.size(), 0); rawPacketLen = tempBasebandBoardLowByte.size(); rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE; rawPacket = commandBuffer; @@ -352,8 +355,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons rawTempBasebandBoard |= convertHexStringToUint8( reinterpret_cast(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); tempBasebandBoard = calcTempVal(rawTempBasebandBoard); - sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" - << std::endl; + sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" + << std::endl; break; case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE): result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); @@ -364,8 +367,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } rawTempPowerAmplifier = 0; rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast( - packet + SYRLINKS::MESSAGE_HEADER_SIZE)) - << 8; + packet + SYRLINKS::MESSAGE_HEADER_SIZE)) + << 8; break; case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE): result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); @@ -378,7 +381,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons reinterpret_cast(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier); sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C" - << std::endl; + << std::endl; break; default: { sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl; diff --git a/mission/devices/SyrlinksHkHandler.h b/mission/devices/SyrlinksHkHandler.h index 9b9e05c2..a8cb7b8c 100644 --- a/mission/devices/SyrlinksHkHandler.h +++ b/mission/devices/SyrlinksHkHandler.h @@ -1,10 +1,11 @@ #ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #define MISSION_DEVICES_SYRLINKSHKHANDLER_H_ +#include + #include "devices/powerSwitcherList.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" -#include /** * @brief This is the device handler for the syrlinks transceiver. It handles the command diff --git a/mission/devices/devicedefinitions/payloadPcduDefinitions.h b/mission/devices/devicedefinitions/payloadPcduDefinitions.h index 3013cb82..ab387fc7 100644 --- a/mission/devices/devicedefinitions/payloadPcduDefinitions.h +++ b/mission/devices/devicedefinitions/payloadPcduDefinitions.h @@ -91,16 +91,17 @@ static constexpr DeviceCommandId_t SETUP_CMD = 1; static constexpr DeviceCommandId_t READ_TEMP_EXT = 2; static constexpr DeviceCommandId_t READ_WITH_TEMP_EXT = 3; -enum NormalSubmodes { - ALL_OFF = 0, - SOLID_STATE_RELAYS_ADC_ON = 1, - DRO_ON = 2, - X8_ON = 3, - TX_ON = 4, - MPA_ON = 5, - HPA_ON = 6 +enum NormalSubmodeBits { + SOLID_STATE_RELAYS_ADC_ON = 0, + DRO_ON = 1, + X8_ON = 2, + TX_ON = 3, + MPA_ON = 4, + HPA_ON = 5 }; +static constexpr Submode_t ALL_OFF_SUBMODE = 0; + // 12 ADC values * 2 + trailing zero static constexpr size_t ADC_REPLY_SIZE = 25; // Conversion byte + 24 * zero diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/AcsBoardAssembly.cpp index e319f32b..0d65d20e 100644 --- a/mission/system/AcsBoardAssembly.cpp +++ b/mission/system/AcsBoardAssembly.cpp @@ -143,13 +143,13 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); if (gpsUsable) { gpioHandler(gpioIds::GNSS_0_NRESET, true, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 0 high (used GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 high (used GNSS)"); gpioHandler(gpioIds::GNSS_1_NRESET, false, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 1 low (unused GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 low (unused GNSS)"); gpioHandler(gpioIds::GNSS_SELECT, false, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low"); } break; } @@ -168,13 +168,13 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); if (gpsUsable) { gpioHandler(gpioIds::GNSS_0_NRESET, false, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 0 low (unused GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 low (unused GNSS)"); gpioHandler(gpioIds::GNSS_1_NRESET, true, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 1 high (used GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 high (used GNSS)"); gpioHandler(gpioIds::GNSS_SELECT, true, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high"); } break; } @@ -191,11 +191,11 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s ReturnValue_t status = RETURN_OK; if (gpsUsable) { gpioHandler(gpioIds::GNSS_0_NRESET, true, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 0 high (used GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 high (used GNSS)"); gpioHandler(gpioIds::GNSS_1_NRESET, true, - "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" - "of GNSS 1 high (used GNSS)"); + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 high (used GNSS)"); if (defaultSubmode == Submodes::A_SIDE) { status = gpioIF->pullLow(gpioIds::GNSS_SELECT); } else { @@ -245,7 +245,7 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) { void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) { ReturnValue_t result = RETURN_OK; - if(high) { + if (high) { result = gpioIF->pullHigh(gpio); } else { result = gpioIF->pullLow(gpio); From d315d6b4589168974b7ec556bfbd353431dc147d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Apr 2022 13:53:44 +0200 Subject: [PATCH 13/19] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index a39c7007..8b5554d6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a39c7007c6aef8cac559b38cdf1b9c8815c346ee +Subproject commit 8b5554d6fdfb9e2d982e4a2af4f5e6d6e844794e From 4327fcb92e47d2d5dc52d434cf6f814763377484 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Apr 2022 13:55:25 +0200 Subject: [PATCH 14/19] set internal state properly --- mission/devices/PayloadPcduHandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 67cf8c10..b08e73ca 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -51,6 +51,7 @@ void PayloadPcduHandler::doShutDown() { auto opCode = pwrStateMachine.fsm(); if (opCode == power::OpCodes::TO_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) { pwrStateMachine.reset(); + state = States::PL_PCDU_OFF; // No need to set mode _MODE_POWER_DOWN, power switching was already handled setMode(MODE_OFF); } From 834e935c64bf6257df1c455cb36667751dbd2e4c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 00:14:18 +0200 Subject: [PATCH 15/19] switch handling working now --- mission/devices/PayloadPcduHandler.cpp | 101 +++++++++++-------------- mission/devices/PayloadPcduHandler.h | 3 + 2 files changed, 46 insertions(+), 58 deletions(-) diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index b08e73ca..621b7d9e 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -67,6 +67,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) { using namespace plpcdu; + bool doFinish = true; if (((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) { if (state == States::PL_PCDU_OFF) { sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF" @@ -83,22 +84,24 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1); state = States::ON_TRANS_SSR; transitionOk = true; + doFinish = false; } if (state == States::ON_TRANS_SSR) { // If necessary, check whether a certain amount of time has elapsed if (transitionOk) { transitionOk = false; state = States::ON_TRANS_ADC_CLOSE_ZERO; - adcCountdown.setTimeout(50); adcCountdown.resetTimer(); adcState = AdcStates::BOOT_DELAY; + doFinish = false; // If the values are not close to zero, we should not allow transition monMode = MonitoringMode::CLOSE_TO_ZERO; } } if (state == States::ON_TRANS_ADC_CLOSE_ZERO) { if (adcState == AdcStates::BOOT_DELAY) { + doFinish = false; if (adcCountdown.hasTimedOut()) { adcState = AdcStates::SEND_SETUP; adcCmdExecuted = false; @@ -107,68 +110,38 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ if (adcState == AdcStates::SEND_SETUP) { if (adcCmdExecuted) { adcState = AdcStates::NORMAL; + doFinish = true; adcCountdown.setTimeout(100); adcCountdown.resetTimer(); adcCmdExecuted = false; - setMode(MODE_NORMAL, submode); - return HasReturnvaluesIF::RETURN_OK; } } } } - if (((submode >> DRO_ON) & 1) == 1) { + auto switchHandler = [&](NormalSubmodeBits bit, gpioId_t id, std::string info) { + if (((diffMask >> bit) & 1) == 1) { + if (((submode >> bit) & 1) == 1) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "Enabling PL PCDU DRO module" << std::endl; + sif::info << "Enabling PL PCDU " << info << " module" << std::endl; #endif - // Switch on DRO and start monitoring for negative voltages - gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO); - adcCountdown.setTimeout(100); - adcCountdown.resetTimer(); - setMode(MODE_NORMAL, submode); - } + // Switch on DRO and start monitoring for negative voltages + updateSwitchGpio(id, gpio::Levels::HIGH); + } else { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "Disabling PL PCDU " << info << " module" << std::endl; +#endif + updateSwitchGpio(id, gpio::Levels::LOW); + } + } + }; - if (((submode >> X8_ON) & 1) == 1) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "Enabling PL PCDU X8 module" << std::endl; -#endif - // Switch on DRO and start monitoring for negative voltages - gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8); - adcCountdown.setTimeout(100); - adcCountdown.resetTimer(); - setMode(MODE_NORMAL, submode); - } - - if (((submode >> TX_ON) & 1) == 1) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "Enabling PL PCDU TX module" << std::endl; -#endif - // Switch on DRO and start monitoring for negative voltages - gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX); - adcCountdown.setTimeout(100); - adcCountdown.resetTimer(); - setMode(MODE_NORMAL, submode); - } - - if (((submode >> MPA_ON) & 1) == 1) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "Enabling PL PCDU MPA module" << std::endl; -#endif - // Switch on DRO and start monitoring for negative voltages - gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA); - adcCountdown.setTimeout(100); - adcCountdown.resetTimer(); - setMode(MODE_NORMAL, submode); - } - - if (((submode >> HPA_ON) & 1) == 1) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "Enabling PL PCDU HPA module" << std::endl; -#endif - // Switch on DRO and start monitoring for negative voltages - gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA); - adcCountdown.setTimeout(100); - adcCountdown.resetTimer(); + switchHandler(DRO_ON, gpioIds::PLPCDU_ENB_DRO, "DRO"); + switchHandler(X8_ON, gpioIds::PLPCDU_ENB_X8, "X8"); + switchHandler(TX_ON, gpioIds::PLPCDU_ENB_TX, "TX"); + switchHandler(MPA_ON, gpioIds::PLPCDU_ENB_MPA, "MPA"); + switchHandler(HPA_ON, gpioIds::PLPCDU_ENB_HPA, "HPA"); + if (doFinish) { setMode(MODE_NORMAL, submode); } return RETURN_OK; @@ -202,6 +175,16 @@ ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t return NOTHING_TO_SEND; } +void PayloadPcduHandler::updateSwitchGpio(gpioId_t id, gpio::Levels level) { + if (level == gpio::Levels::HIGH) { + gpioIF->pullHigh(id); + } else { + gpioIF->pullLow(id); + } + adcCountdown.setTimeout(100); + adcCountdown.resetTimer(); +} + void PayloadPcduHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(plpcdu::READ_CMD, 2, &adcSet); insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1, &adcSet); @@ -549,31 +532,33 @@ bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event) ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) { using namespace plpcdu; if (mode == MODE_NORMAL) { + diffMask = submode ^ this->submode; // Also deals with the case where the mode is MODE_ON, submode should be 0 here if ((((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == SOLID_STATE_RELAYS_ADC_ON) and (this->mode == MODE_NORMAL and this->submode != ALL_OFF_SUBMODE)) { return TRANS_NOT_ALLOWED; } if (((((submode >> DRO_ON) & 1) == 1) and - (this->submode != (1 << SOLID_STATE_RELAYS_ADC_ON)))) { + ((this->submode & 0b1) != (1 << SOLID_STATE_RELAYS_ADC_ON)))) { return TRANS_NOT_ALLOWED; } if ((((submode >> X8_ON) & 1) == 1) and - (this->submode != ((1 << SOLID_STATE_RELAYS_ADC_ON) | (1 << DRO_ON)))) { + ((this->submode & 0b11) != ((1 << SOLID_STATE_RELAYS_ADC_ON) | (1 << DRO_ON)))) { return TRANS_NOT_ALLOWED; } if (((((submode >> TX_ON) & 1) == 1) and - (this->submode != ((1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { + ((this->submode & 0b111) != + ((1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } if ((((submode >> MPA_ON) & 1) == 1 and - (this->submode != + ((this->submode & 0b1111) != ((1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } if ((((submode >> HPA_ON) & 1) == 1 and - (this->submode != ((1 << MPA_ON) | (1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) | - (1 << SOLID_STATE_RELAYS_ADC_ON))))) { + ((this->submode & 0b11111) != ((1 << MPA_ON) | (1 << TX_ON) | (1 << X8_ON) | + (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } return HasReturnvaluesIF::RETURN_OK; diff --git a/mission/devices/PayloadPcduHandler.h b/mission/devices/PayloadPcduHandler.h index 18311ec8..dba5b4ef 100644 --- a/mission/devices/PayloadPcduHandler.h +++ b/mission/devices/PayloadPcduHandler.h @@ -134,6 +134,7 @@ class PayloadPcduHandler : public DeviceHandlerBase { SdCardMountedIF* sdcMan; plpcdu::PlPcduParameter params; bool quickTransitionAlreadyCalled = true; + uint8_t diffMask = 0; PoolEntry channelValues = PoolEntry({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}); PoolEntry processedValues = @@ -141,6 +142,8 @@ class PayloadPcduHandler : public DeviceHandlerBase { PoolEntry tempC = PoolEntry({0.0}); DualLanePowerStateMachine pwrStateMachine; + void updateSwitchGpio(gpioId_t id, gpio::Levels level); + void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; void doStartUp() override; void doShutDown() override; From 06a15ccec18aa8458da45c84060ed7c127189d65 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 00:16:15 +0200 Subject: [PATCH 16/19] submodule updates --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 1bc7a918..0677de39 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 1bc7a918694030d1f49f1d2998a289d77b132849 +Subproject commit 0677de39aa4c20e8ee1c066909818d2dfffcbc2a diff --git a/tmtc b/tmtc index 8b5554d6..5d9f0083 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8b5554d6fdfb9e2d982e4a2af4f5e6d6e844794e +Subproject commit 5d9f0083204ff7fcb8269241695aad3ef824f32c From c6e16e0866c9c8e5e3f855042a9b64638acbef8a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 09:57:19 +0200 Subject: [PATCH 17/19] resolve merge conflict, ran afmt --- mission/devices/SyrlinksHkHandler.cpp | 57 +++++++++++---------------- mission/devices/SyrlinksHkHandler.h | 11 ++---- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index 2a847071..9108a6f1 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -192,10 +192,10 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() { true, syrlinks::ACK_REPLY); this->insertInCommandAndReplyMap(syrlinks::WRITE_LCL_CONFIG, 1, nullptr, syrlinks::ACK_SIZE, false, true, syrlinks::ACK_REPLY); - this->insertInCommandAndReplyMap(syrlinks::CONFIG_BPSK, 1, nullptr, syrlinks::ACK_SIZE, - false, true, syrlinks::ACK_REPLY); - this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE, - false, true, syrlinks::ACK_REPLY); + this->insertInCommandAndReplyMap(syrlinks::CONFIG_BPSK, 1, nullptr, syrlinks::ACK_SIZE, false, + true, syrlinks::ACK_REPLY); + this->insertInCommandAndReplyMap(syrlinks::CONFIG_OQPSK, 1, nullptr, syrlinks::ACK_SIZE, false, + true, syrlinks::ACK_REPLY); this->insertInCommandMap(syrlinks::ENABLE_DEBUG); this->insertInCommandMap(syrlinks::DISABLE_DEBUG); this->insertInCommandAndReplyMap(syrlinks::READ_LCL_CONFIG, 1, nullptr, @@ -361,17 +361,12 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons rawTempBasebandBoard |= convertHexStringToUint8( reinterpret_cast(packet + syrlinks::MESSAGE_HEADER_SIZE)); tempBasebandBoard = calcTempVal(rawTempBasebandBoard); -<<<<<<< HEAD - sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" - << std::endl; -======= temperatureSet.temperatureBasebandBoard = tempBasebandBoard; PoolReadGuard rg(&temperatureSet); if (debug) { sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C" << std::endl; } ->>>>>>> origin/develop break; } case (syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE): { @@ -383,11 +378,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } rawTempPowerAmplifier = 0; rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast( -<<<<<<< HEAD - packet + SYRLINKS::MESSAGE_HEADER_SIZE)) -======= packet + syrlinks::MESSAGE_HEADER_SIZE)) ->>>>>>> origin/develop << 8; break; } @@ -401,17 +392,12 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons rawTempPowerAmplifier |= convertHexStringToUint8( reinterpret_cast(packet + syrlinks::MESSAGE_HEADER_SIZE)); tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier); -<<<<<<< HEAD - sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C" - << std::endl; -======= PoolReadGuard rg(&temperatureSet); temperatureSet.temperaturePowerAmplifier = tempPowerAmplifier; if (debug) { sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C" << std::endl; } ->>>>>>> origin/develop break; } default: { @@ -485,7 +471,8 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { case '0': return RETURN_OK; case '1': - sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart framing or parity error" << std::endl; + sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart framing or parity error" + << std::endl; return UART_FRAMIN_OR_PARITY_ERROR_ACK; case '2': sif::debug << "SyrlinksHkHandler::parseReplyStatus: Bad character detected" << std::endl; @@ -555,15 +542,15 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) { #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1 if (debug) { - sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value - << std::endl; - sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl; - sif::info << "Syrlinks RX Frequency Shift: " << rxDataset.rxFrequencyShift << std::endl; - sif::info << "Syrlinks RX IQ Power: " << rxDataset.rxIqPower << std::endl; - sif::info << "Syrlinks RX AGC Value: " << rxDataset.rxAgcValue << std::endl; - sif::info << "Syrlinks RX Demod Eb: " << rxDataset.rxDemodEb << std::endl; - sif::info << "Syrlinks RX Demod N0: " << rxDataset.rxDemodN0 << std::endl; - sif::info << "Syrlinks RX Datarate: " << (unsigned int)rxDataset.rxDataRate.value << std::endl; + sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value + << std::endl; + sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl; + sif::info << "Syrlinks RX Frequency Shift: " << rxDataset.rxFrequencyShift << std::endl; + sif::info << "Syrlinks RX IQ Power: " << rxDataset.rxIqPower << std::endl; + sif::info << "Syrlinks RX AGC Value: " << rxDataset.rxAgcValue << std::endl; + sif::info << "Syrlinks RX Demod Eb: " << rxDataset.rxDemodEb << std::endl; + sif::info << "Syrlinks RX Demod N0: " << rxDataset.rxDemodN0 << std::endl; + sif::info << "Syrlinks RX Datarate: " << (unsigned int)rxDataset.rxDataRate.value << std::endl; } #endif } @@ -572,8 +559,8 @@ void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) { uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE; uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast(packet + offset)); if (debug) { - sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: " - << static_cast(lclConfig) << std::endl; + sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: " + << static_cast(lclConfig) << std::endl; } } @@ -583,8 +570,8 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) { txDataset.txStatus = convertHexStringToUint8(reinterpret_cast(packet + offset)); #if OBSW_DEBUG_SYRLINKS == 1 if (debug) { - sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value - << std::endl; + sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value + << std::endl; } #endif } @@ -595,8 +582,8 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) { txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast(packet + offset)); #if OBSW_DEBUG_SYRLINKS == 1 if (debug) { - sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value - << std::endl; + sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value + << std::endl; } #endif } @@ -608,7 +595,7 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) { convertHexStringToUint8(reinterpret_cast(packet + offset)); #if OBSW_DEBUG_SYRLINKS == 1 if (debug) { - sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl; + sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl; } #endif } diff --git a/mission/devices/SyrlinksHkHandler.h b/mission/devices/SyrlinksHkHandler.h index 6d8c6002..78ae6d99 100644 --- a/mission/devices/SyrlinksHkHandler.h +++ b/mission/devices/SyrlinksHkHandler.h @@ -5,10 +5,9 @@ #include "devices/powerSwitcherList.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" -#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" -#include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw/timemanager/Countdown.h" -#include +#include "fsfw_hal/linux/gpio/Gpio.h" +#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" /** * @brief This is the device handler for the syrlinks transceiver. It handles the command @@ -104,11 +103,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase { uint8_t commandBuffer[syrlinks::MAX_COMMAND_SIZE]; - enum class StartupState { - OFF, - ENABLE_TEMPERATURE_PROTECTION, - DONE - }; + enum class StartupState { OFF, ENABLE_TEMPERATURE_PROTECTION, DONE }; StartupState startupState = StartupState::OFF; From b2933f95d72bc809425b394145471e42aab10988 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 11:07:51 +0200 Subject: [PATCH 18/19] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 43917d98..a11d7455 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 43917d98c025b446aa0d79d2166b1f031fb288ae +Subproject commit a11d7455dfaf2e736f73f6c4dda1f8c06b9f1234 From 5c4ae861b16cb1a41254276143cc575373ad92bf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 11:11:37 +0200 Subject: [PATCH 19/19] exclude gps changes --- linux/devices/GPSHyperionLinuxController.cpp | 26 ++------------------ linux/devices/GPSHyperionLinuxController.h | 2 -- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index b892dc70..a811fbc5 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -9,16 +9,13 @@ #include #endif #include -#include GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps) : ExtendedControllerBase(objectId, objects::NO_OBJECT), gpsSet(this), myGpsmm(GPSD_SHARED_MEMORY, nullptr), - debugHyperionGps(debugHyperionGps) { - timeUpdateCd.resetTimer(); -} + debugHyperionGps(debugHyperionGps) {} GPSHyperionLinuxController::~GPSHyperionLinuxController() {} @@ -79,11 +76,9 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool( localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry()); - bool enablePeriodicHk = false; #if OBSW_ENABLE_PERIODIC_HK == 1 - enablePeriodicHk = true; + poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), true, 2.0, false); #endif - poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), enablePeriodicHk, 2.0, false); return HasReturnvaluesIF::RETURN_OK; } @@ -177,20 +172,6 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { timeval time = {}; time.tv_sec = gpsSet.unixSeconds.value; time.tv_usec = gps->fix.time.tv_nsec / 1000; - std::time_t t = std::time(nullptr); - if (time.tv_sec == t) { - timeIsConstantCounter++; - } else { - timeIsConstantCounter = 0; - } - // If the received time does not change anymore for whatever reason, do not set it here - // to avoid stale times. Also, don't do it too often often to avoid jumping times - if (timeIsConstantCounter < 3 and timeUpdateCd.hasTimedOut()) { - // Update the system time here for now. NTP seems to be unable to do so for whatever reason - settimeofday(&time, nullptr); - timeUpdateCd.resetTimer(); - } - Clock::TimeOfDay_t timeOfDay = {}; Clock::convertTimevalToTimeOfDay(&time, &timeOfDay); gpsSet.year = timeOfDay.year; @@ -211,9 +192,6 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { std::cout << "Longitude: " << gps->fix.longitude << std::endl; std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl; std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; - std::time_t t = std::time(nullptr); - std::tm tm = *std::gmtime(&t); - std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl; } } #endif diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 46acb5fc..f0e4e6e0 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -51,8 +51,6 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { bool modeCommanded = true; gpsmm myGpsmm; bool debugHyperionGps = false; - uint32_t timeIsConstantCounter = 0; - Countdown timeUpdateCd = Countdown(60); void readGpsDataFromGpsd(); };