From 00bafd98fe2711c261151c8dbaedc6c867e5413e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:24:34 +0200 Subject: [PATCH] obsw config, gps update --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++++---- common/config/devConf.h | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 1 + mission/devices/GPSHyperionHandler.cpp | 12 ++++++++++-- mission/devices/GPSHyperionHandler.h | 6 +++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 8f88a1c7..7b5247f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,7 +457,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -470,7 +470,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); // Commented until ACS board V2 in in clean room again // Gyro 0 Side A @@ -502,6 +502,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler->setStartUpImmediately(); //gyroL3gHandler->setGoNormalModeAtStartup(); + bool debugGps = false; +#if OBSW_DEBUG_GPS == 1 + debugGps = true; +#endif resetArgsGnss1.gnss1 = true; resetArgsGnss1.gpioComIF = gpioComIF; resetArgsGnss1.waitPeriodMs = 100; @@ -517,11 +521,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, - uartCookieGps0, true); + uartCookieGps0, debugGps); gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); gpsHandler0->setStartUpImmediately(); auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, - uartCookieGps1, true); + uartCookieGps1, debugGps); gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1); gpsHandler1->setStartUpImmediately(); } diff --git a/common/config/devConf.h b/common/config/devConf.h index 41126fdd..e1d95b5e 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -26,10 +26,10 @@ static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; -static constexpr uint32_t RW_SPEED = 300000; +static constexpr uint32_t RW_SPEED = 300'000; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; -static constexpr uint32_t RTD_SPEED = 2000000; +static constexpr uint32_t RTD_SPEED = 2'000'000; } diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index dc397635..32f29a09 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -63,6 +63,7 @@ debugging. */ #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU2 0 +#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_IMQT 0 diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 5e44f89c..26b86a76 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -23,7 +23,6 @@ GPSHyperionHandler::~GPSHyperionHandler() {} void GPSHyperionHandler::doStartUp() { if(internalState == InternalStates::NONE) { commandExecuted = false; - updatePeriodicReply(true, GpsHyperion::GPS_REPLY); internalState = InternalStates::WAIT_FIRST_MESSAGE; } @@ -76,7 +75,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { // Pass data to GPS library if(len > 0) { - sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; + // sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; if (internalState == InternalStates::WAIT_FIRST_MESSAGE) { // TODO: Check whether data is valid by checking whether NMEA start string is valid? commandExecuted = true; @@ -202,3 +201,12 @@ void GPSHyperionHandler::setResetPinTriggerFunction(gpioResetFunction_t resetCal void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { } + +ReturnValue_t GPSHyperionHandler::initialize() { + ReturnValue_t result = DeviceHandlerBase::initialize(); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // Enable reply immediately for now + return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 03c572a3..13591b44 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -14,12 +14,16 @@ */ class GPSHyperionHandler: public DeviceHandlerBase { public: - using gpioResetFunction_t = ReturnValue_t (*) (void* args); + GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, bool debugHyperionGps = false); virtual ~GPSHyperionHandler(); + using gpioResetFunction_t = ReturnValue_t (*) (void* args); + void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); + + ReturnValue_t initialize() override; protected: gpioResetFunction_t resetCallback = nullptr;