From 65b0376f6980a499086a2f9c4152dbecf581d5a1 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Tue, 19 Oct 2021 14:45:22 +0200 Subject: [PATCH 1/7] improved chip select decoding --- bsp_q7s/callbacks/rwSpiCallback.cpp | 30 +- bsp_q7s/core/ObjectFactory.cpp | 149 ++-- bsp_q7s/gpio/gpioCallbacks.cpp | 247 +++++- bsp_q7s/gpio/gpioCallbacks.h | 6 + .../pollingSequenceFactory.cpp | 30 +- mission/devices/Max31865PT1000Handler.cpp | 793 +++++++++--------- mission/devices/Max31865PT1000Handler.h | 2 +- mission/devices/RwHandler.cpp | 1 + 8 files changed, 720 insertions(+), 538 deletions(-) diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 73516fb4..f15e9a55 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -23,6 +23,16 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen uint8_t writeBuffer[2]; uint8_t writeSize = 0; + gpioId_t gpioId = cookie->getChipSelectPin(); + GpioIF* gpioIF = comIf->getGpioInterface(); + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; + uint32_t timeoutMs = 0; + MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); + if(mutex == nullptr or gpioIF == nullptr) { + sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + int fileDescriptor = 0; std::string device = cookie->getSpiDevice(); UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback"); @@ -30,20 +40,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl; return SpiComIF::OPENING_FILE_FAILED; } - spi::SpiModes spiMode = spi::SpiModes::MODE_0; - uint32_t spiSpeed = 0; - cookie->getSpiParameters(spiMode, spiSpeed, nullptr); - comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); - - gpioId_t gpioId = cookie->getChipSelectPin(); - GpioIF* gpioIF = comIf->getGpioInterface(); - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; - uint32_t timeoutMs = 0; - MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); - if(mutex == nullptr or gpioIF == nullptr) { - sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } +// spi::SpiModes spiMode = spi::SpiModes::MODE_0; +// uint32_t spiSpeed = 0; +// cookie->getSpiParameters(spiMode, spiSpeed, nullptr); +// comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); result = mutex->lockMutex(timeoutType, timeoutMs); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -119,7 +119,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen size_t replyBufferSize = cookie->getMaxBufferSize(); - /** There must be a delay of 20 ms after sending the command */ + /** There must be a delay of at least 20 ms after sending the command */ usleep(RwDefinitions::SPI_REPLY_DELAY); /** diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 66357373..b82ba2c5 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -268,7 +268,8 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); - new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); + RadiationSensorHandler* radsensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); + radsensor->setStartUpImmediately(); } void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComIF* spiComIF) { @@ -641,139 +642,149 @@ void ObjectFactory::createSyrlinksComponents() { void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) { GpioCookie* rtdGpioCookie = new GpioCookie; - GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", gpio::OUT, gpio::HIGH, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0); - GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", gpio::OUT, gpio::HIGH, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1); - GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", gpio::OUT, gpio::HIGH, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2); GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc3); GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc4); GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc5); GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc6); GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc7); GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc8); GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc9); GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc10); GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc11); GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc12); GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc13); GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc14); GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::OUT, gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc15); + GpioCallback* gpioRtdIc16 = new GpioCallback("Chip select RTD IC16", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc16); + GpioCallback* gpioRtdIc17 = new GpioCallback("Chip select RTD IC17", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc17); + GpioCallback* gpioRtdIc18 = new GpioCallback("Chip select RTD IC18", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc18); gpioComIF->addGpios(rtdGpioCookie); - SpiCookie* spiRtdIc0 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc1 = new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc2 = new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV, + SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10, + SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11, + SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12, + SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13, + SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14, + SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15, + SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16, + SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16, std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17, + SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18, + SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); - Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF, - spiRtdIc0); - Max31865PT1000Handler* rtdIc1 = new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF, - spiRtdIc1); - Max31865PT1000Handler* rtdIc2 = new Max31865PT1000Handler(objects::RTD_IC_5, objects::SPI_COM_IF, - spiRtdIc2); - Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF, + Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF, spiRtdIc3); - Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC_7, objects::SPI_COM_IF, + Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF, spiRtdIc4); - Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC_8, objects::SPI_COM_IF, + Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC_5, objects::SPI_COM_IF, spiRtdIc5); - Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC_9, objects::SPI_COM_IF, + Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF, spiRtdIc6); - Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC_10, - objects::SPI_COM_IF, spiRtdIc7); - Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC_11, - objects::SPI_COM_IF, spiRtdIc8); - Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC_12, - objects::SPI_COM_IF, spiRtdIc9); - Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC_13, + Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC_7, objects::SPI_COM_IF, + spiRtdIc7); + Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC_8, objects::SPI_COM_IF, + spiRtdIc8); + Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC_9, objects::SPI_COM_IF, + spiRtdIc9); + Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC_10, objects::SPI_COM_IF, spiRtdIc10); - Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC_14, + Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC_11, objects::SPI_COM_IF, spiRtdIc11); - Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC_15, + Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC_12, objects::SPI_COM_IF, spiRtdIc12); - Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC_16, + Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC_13, objects::SPI_COM_IF, spiRtdIc13); - Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC_17, + Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC_14, objects::SPI_COM_IF, spiRtdIc14); - Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC_18, + Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC_15, objects::SPI_COM_IF, spiRtdIc15); + Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC_16, + objects::SPI_COM_IF, spiRtdIc16); + Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC_17, + objects::SPI_COM_IF, spiRtdIc17); + Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC_18, + objects::SPI_COM_IF, spiRtdIc18); - rtdIc0->setStartUpImmediately(); - rtdIc1->setStartUpImmediately(); - rtdIc2->setStartUpImmediately(); + rtdIc3->setStartUpImmediately(); + rtdIc4->setStartUpImmediately(); + rtdIc5->setStartUpImmediately(); + rtdIc6->setStartUpImmediately(); + rtdIc7->setStartUpImmediately(); + rtdIc8->setStartUpImmediately(); + rtdIc9->setStartUpImmediately(); + rtdIc10->setStartUpImmediately(); + rtdIc11->setStartUpImmediately(); + rtdIc12->setStartUpImmediately(); + rtdIc13->setStartUpImmediately(); + rtdIc14->setStartUpImmediately(); + rtdIc15->setStartUpImmediately(); + rtdIc16->setStartUpImmediately(); + rtdIc17->setStartUpImmediately(); + rtdIc18->setStartUpImmediately(); - static_cast(rtdIc0); - static_cast(rtdIc1); - static_cast(rtdIc2); static_cast(rtdIc3); static_cast(rtdIc4); static_cast(rtdIc5); @@ -787,6 +798,9 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) { static_cast(rtdIc13); static_cast(rtdIc14); static_cast(rtdIc15); + static_cast(rtdIc16); + static_cast(rtdIc17); + static_cast(rtdIc18); } void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { @@ -856,7 +870,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler1->setStartUpImmediately(); #endif rw1SpiCookie->setCallbackArgs(rwHandler1); - rwHandler1->setStartUpImmediately(); auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index b1eefac7..6d3dca93 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -27,10 +27,10 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpiodRegularByLineName* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", - gpio::OUT, gpio::LOW); + gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); @@ -68,173 +68,308 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev } if (value == gpio::HIGH) { - disableAllDecoder(); + switch (gpioId) { + case(gpioIds::RTD_IC_3): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_4): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_5): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_6): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_7): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_8): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_9): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_10): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_11): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_12): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_13): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_14): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_15): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_16): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_17): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_18): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::CS_SUS_1): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_2): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_3): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_4): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_5): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_6): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_7): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_8): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_9): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_10): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_11): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_12): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_13): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_RW1): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW2): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW3): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW4): { + disableRwDecoder(); + break; + } + default: + sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl; + } } else if (value == gpio::LOW) { switch (gpioId) { case(gpioIds::RTD_IC_3): { + selectY7(); enableDecoderTcsIc1(); - selectY7(); break; } case(gpioIds::RTD_IC_4): { + selectY6(); enableDecoderTcsIc1(); - selectY6(); break; } case(gpioIds::RTD_IC_5): { + selectY5(); enableDecoderTcsIc1(); - selectY5(); break; } case(gpioIds::RTD_IC_6): { + selectY4(); enableDecoderTcsIc1(); - selectY4(); break; } case(gpioIds::RTD_IC_7): { + selectY3(); enableDecoderTcsIc1(); - selectY3(); break; } case(gpioIds::RTD_IC_8): { + selectY2(); enableDecoderTcsIc1(); - selectY2(); break; } case(gpioIds::RTD_IC_9): { + selectY1(); enableDecoderTcsIc1(); - selectY1(); break; } case(gpioIds::RTD_IC_10): { + selectY0(); enableDecoderTcsIc1(); - selectY0(); break; } case(gpioIds::RTD_IC_11): { + selectY7(); enableDecoderTcsIc2(); - selectY7(); break; } case(gpioIds::RTD_IC_12): { + selectY6(); enableDecoderTcsIc2(); - selectY6(); break; } case(gpioIds::RTD_IC_13): { + selectY5(); enableDecoderTcsIc2(); - selectY5(); break; } case(gpioIds::RTD_IC_14): { + selectY4(); enableDecoderTcsIc2(); - selectY4(); break; } case(gpioIds::RTD_IC_15): { + selectY3(); enableDecoderTcsIc2(); - selectY3(); break; } case(gpioIds::RTD_IC_16): { + selectY2(); enableDecoderTcsIc2(); - selectY2(); break; } case(gpioIds::RTD_IC_17): { + selectY1(); enableDecoderTcsIc2(); - selectY1(); break; } case(gpioIds::RTD_IC_18): { + selectY0(); enableDecoderTcsIc2(); - selectY0(); break; } case(gpioIds::CS_SUS_1): { + selectY0(); enableDecoderInterfaceBoardIc1(); - selectY0(); break; } case(gpioIds::CS_SUS_2): { + selectY1(); enableDecoderInterfaceBoardIc1(); - selectY1(); break; } case(gpioIds::CS_SUS_3): { + selectY0(); enableDecoderInterfaceBoardIc2(); - selectY0(); break; } case(gpioIds::CS_SUS_4): { + selectY1(); enableDecoderInterfaceBoardIc2(); - selectY1(); break; } case(gpioIds::CS_SUS_5): { + selectY2(); enableDecoderInterfaceBoardIc2(); - selectY2(); break; } case(gpioIds::CS_SUS_6): { + selectY2(); enableDecoderInterfaceBoardIc1(); - selectY2(); break; } case(gpioIds::CS_SUS_7): { + selectY3(); enableDecoderInterfaceBoardIc1(); - selectY3(); break; } case(gpioIds::CS_SUS_8): { + selectY3(); enableDecoderInterfaceBoardIc2(); - selectY3(); break; } case(gpioIds::CS_SUS_9): { + selectY4(); enableDecoderInterfaceBoardIc1(); - selectY4(); break; } case(gpioIds::CS_SUS_10): { + selectY5(); enableDecoderInterfaceBoardIc1(); - selectY5(); break; } case(gpioIds::CS_SUS_11): { + selectY4(); enableDecoderInterfaceBoardIc2(); - selectY4(); break; } case(gpioIds::CS_SUS_12): { + selectY5(); enableDecoderInterfaceBoardIc2(); - selectY5(); break; } case(gpioIds::CS_SUS_13): { + selectY6(); enableDecoderInterfaceBoardIc1(); - selectY6(); break; } case(gpioIds::CS_RW1): { + selectY0(); enableRwDecoder(); - selectY0(); break; } case(gpioIds::CS_RW2): { + selectY1(); enableRwDecoder(); - selectY1(); break; } case(gpioIds::CS_RW3): { + selectY2(); enableRwDecoder(); - selectY2(); break; } case(gpioIds::CS_RW4): { + selectY3(); enableRwDecoder(); - selectY3(); break; } default: @@ -253,9 +388,9 @@ void enableDecoderTcsIc1() { } void enableDecoderTcsIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); } void enableDecoderInterfaceBoardIc1() { @@ -266,15 +401,41 @@ void enableDecoderInterfaceBoardIc1() { void enableDecoderInterfaceBoardIc2() { gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); +} + +void disableDecoderTcsIc1() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); +} + +void disableDecoderTcsIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); +} + +void disableDecoderInterfaceBoardIc1() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); +} + +void disableDecoderInterfaceBoardIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); } void enableRwDecoder() { - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); - gpioComInterface->pullHigh(gpioIds::EN_RW_CS); + gpioComInterface->pullHigh(gpioIds::EN_RW_CS); +} + +void disableRwDecoder() { + gpioComInterface->pullLow(gpioIds::EN_RW_CS); } void selectY0() { @@ -326,9 +487,9 @@ void selectY7() { } void disableAllDecoder() { + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::EN_RW_CS); } diff --git a/bsp_q7s/gpio/gpioCallbacks.h b/bsp_q7s/gpio/gpioCallbacks.h index 13a51df2..18adb52b 100644 --- a/bsp_q7s/gpio/gpioCallbacks.h +++ b/bsp_q7s/gpio/gpioCallbacks.h @@ -44,10 +44,16 @@ namespace gpioCallbacks { */ void enableDecoderInterfaceBoardIc2(); + void disableDecoderTcsIc1(); + void disableDecoderTcsIc2(); + void disableDecoderInterfaceBoardIc1(); + void disableDecoderInterfaceBoardIc2(); + /** * @brief Enables the reaction wheel chip select decoder (IC3). */ void enableRwDecoder(); + void disableRwDecoder(); /** * @brief This function disables all decoder. diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 225fffd8..257dd650 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -36,9 +36,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::RTD_IC_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::RTD_IC_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -52,6 +49,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_14, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_15, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -59,9 +59,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_5, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -75,6 +72,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_14, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_15, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.2, DeviceHandlerIF::SEND_WRITE); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -82,9 +82,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_5, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -98,6 +95,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_14, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_15, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.4, DeviceHandlerIF::GET_WRITE); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -105,9 +105,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_5, length * 0.6, DeviceHandlerIF::SEND_READ); @@ -121,6 +118,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_14, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_15, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.6, DeviceHandlerIF::SEND_READ); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -128,9 +128,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_5, length * 0.8, DeviceHandlerIF::GET_READ); @@ -144,6 +141,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_14, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_15, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.8, DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_RAD_SENSORS == 1 diff --git a/mission/devices/Max31865PT1000Handler.cpp b/mission/devices/Max31865PT1000Handler.cpp index 450d34f3..74c21fc0 100644 --- a/mission/devices/Max31865PT1000Handler.cpp +++ b/mission/devices/Max31865PT1000Handler.cpp @@ -6,11 +6,11 @@ #include Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId, object_id_t comIF, - CookieIF *comCookie): - DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this), - sensorDatasetSid(sensorDataset.getSid()) { + CookieIF *comCookie) : + DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this), sensorDatasetSid( + sensorDataset.getSid()) { #if OBSW_VERBOSE_LEVEL >= 1 - debugDivider = new PeriodicOperationDivider(0); + debugDivider = new PeriodicOperationDivider(0); #endif } @@ -18,476 +18,477 @@ Max31865PT1000Handler::~Max31865PT1000Handler() { } void Max31865PT1000Handler::doStartUp() { - if(internalState == InternalState::NONE) { - internalState = InternalState::WARMUP; - Clock::getUptime(&startTime); - } - - if(internalState == InternalState::WARMUP) { - dur_millis_t timeNow = 0; - Clock::getUptime(&timeNow); - if(timeNow - startTime >= 100) { - internalState = InternalState::CONFIGURE; - } - } - - if(internalState == InternalState::CONFIGURE) { - if(commandExecuted) { - commandExecuted = false; - internalState = InternalState::REQUEST_CONFIG; - } - } - - if(internalState == InternalState::REQUEST_CONFIG) { - if (commandExecuted) { - commandExecuted = false; - internalState = InternalState::CONFIG_HIGH_THRESHOLD; - } - } - - if(internalState == InternalState::CONFIG_HIGH_THRESHOLD) { - if(commandExecuted) { - internalState = InternalState::REQUEST_HIGH_THRESHOLD; - commandExecuted = false; - } - } - - if(internalState == InternalState::REQUEST_HIGH_THRESHOLD) { - if(commandExecuted) { - internalState = InternalState::CONFIG_LOW_THRESHOLD; - commandExecuted = false; - } - } - - if(internalState == InternalState::CONFIG_LOW_THRESHOLD) { - if(commandExecuted) { - internalState = InternalState::REQUEST_LOW_THRESHOLD; - commandExecuted = false; - } - } - - if(internalState == InternalState::REQUEST_LOW_THRESHOLD) { - if(commandExecuted) { - setMode(MODE_ON); - setMode(MODE_NORMAL); - internalState = InternalState::RUNNING; - commandExecuted = false; - } - } +// if (internalState == InternalState::NONE) { +// internalState = InternalState::WARMUP; +// Clock::getUptime(&startTime); +// } +// +// if (internalState == InternalState::WARMUP) { +// dur_millis_t timeNow = 0; +// Clock::getUptime(&timeNow); +// if (timeNow - startTime >= 100) { +// internalState = InternalState::CONFIGURE; +// } +// } +// +// if (internalState == InternalState::CONFIGURE) { +// if (commandExecuted) { +// commandExecuted = false; +// internalState = InternalState::REQUEST_CONFIG; +// } +// } +// +// if (internalState == InternalState::REQUEST_CONFIG) { +// if (commandExecuted) { +// commandExecuted = false; +// internalState = InternalState::CONFIG_HIGH_THRESHOLD; +// } +// } +// +// if (internalState == InternalState::CONFIG_HIGH_THRESHOLD) { +// if (commandExecuted) { +// internalState = InternalState::REQUEST_HIGH_THRESHOLD; +// commandExecuted = false; +// } +// } +// +// if (internalState == InternalState::REQUEST_HIGH_THRESHOLD) { +// if (commandExecuted) { +// internalState = InternalState::CONFIG_LOW_THRESHOLD; +// commandExecuted = false; +// } +// } +// +// if (internalState == InternalState::CONFIG_LOW_THRESHOLD) { +// if (commandExecuted) { +// internalState = InternalState::REQUEST_LOW_THRESHOLD; +// commandExecuted = false; +// } +// } +// +// if (internalState == InternalState::REQUEST_LOW_THRESHOLD) { +// if (commandExecuted) { +// setMode(MODE_ON); +// setMode(MODE_NORMAL); +// internalState = InternalState::RUNNING; +// commandExecuted = false; +// } +// } + setMode(MODE_NORMAL); } void Max31865PT1000Handler::doShutDown() { - commandExecuted = false; - setMode(_MODE_POWER_DOWN); + commandExecuted = false; + setMode(_MODE_POWER_DOWN); } -ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand( - DeviceCommandId_t *id) { - if(internalState == InternalState::RUNNING) { - *id = Max31865Definitions::REQUEST_RTD; - return buildCommandFromCommand(*id, nullptr, 0); - } - else if(internalState == InternalState::REQUEST_FAULT_BYTE) { - *id = Max31865Definitions::REQUEST_FAULT_BYTE; - return buildCommandFromCommand(*id, nullptr, 0); - } - else { - return DeviceHandlerBase::NOTHING_TO_SEND; - } +ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { +// if (internalState == InternalState::RUNNING) { +// *id = Max31865Definitions::REQUEST_RTD; +// return buildCommandFromCommand(*id, nullptr, 0); +// } else if (internalState == InternalState::REQUEST_FAULT_BYTE) { +// *id = Max31865Definitions::REQUEST_FAULT_BYTE; +// return buildCommandFromCommand(*id, nullptr, 0); +// } else { +// return DeviceHandlerBase::NOTHING_TO_SEND; +// } + + if (internalState == InternalState::CONFIGURE) { + *id = Max31865Definitions::CONFIG_CMD; + uint8_t config[1] = { DEFAULT_CONFIG }; + return buildCommandFromCommand(*id, config, 1); + } else if (internalState == InternalState::REQUEST_CONFIG) { + *id = Max31865Definitions::REQUEST_CONFIG; + //internalState = InternalState::NONE; + return buildCommandFromCommand(*id, nullptr, 0); + } else { + return DeviceHandlerBase::NOTHING_TO_SEND; + } } -ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand( - DeviceCommandId_t *id) { - switch(internalState) { - case(InternalState::NONE): - case(InternalState::WARMUP): - case(InternalState::RUNNING): - return DeviceHandlerBase::NOTHING_TO_SEND; - case(InternalState::CONFIGURE): { - *id = Max31865Definitions::CONFIG_CMD; - uint8_t config[1] = {DEFAULT_CONFIG}; - return buildCommandFromCommand(*id, config, 1); - } - case(InternalState::REQUEST_CONFIG): { - *id = Max31865Definitions::REQUEST_CONFIG; - return buildCommandFromCommand(*id, nullptr, 0); - } - case(InternalState::CONFIG_HIGH_THRESHOLD): { - *id = Max31865Definitions::WRITE_HIGH_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case(InternalState::REQUEST_HIGH_THRESHOLD): { - *id = Max31865Definitions::REQUEST_HIGH_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case(InternalState::CONFIG_LOW_THRESHOLD): { - *id = Max31865Definitions::WRITE_LOW_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case(InternalState::REQUEST_LOW_THRESHOLD): { - *id = Max31865Definitions::REQUEST_LOW_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } +ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + switch (internalState) { + case (InternalState::NONE): + case (InternalState::WARMUP): + case (InternalState::RUNNING): + return DeviceHandlerBase::NOTHING_TO_SEND; + case (InternalState::CONFIGURE): { + *id = Max31865Definitions::CONFIG_CMD; + uint8_t config[1] = { DEFAULT_CONFIG }; + return buildCommandFromCommand(*id, config, 1); + } + case (InternalState::REQUEST_CONFIG): { + *id = Max31865Definitions::REQUEST_CONFIG; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (InternalState::CONFIG_HIGH_THRESHOLD): { + *id = Max31865Definitions::WRITE_HIGH_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (InternalState::REQUEST_HIGH_THRESHOLD): { + *id = Max31865Definitions::REQUEST_HIGH_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (InternalState::CONFIG_LOW_THRESHOLD): { + *id = Max31865Definitions::WRITE_LOW_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (InternalState::REQUEST_LOW_THRESHOLD): { + *id = Max31865Definitions::REQUEST_LOW_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } - default: + default: #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Max31865PT1000Handler: Invalid internal state" << std::endl; + sif::error << "Max31865PT1000Handler: Invalid internal state" << std::endl; #else - sif::printError("Max31865PT1000Handler: Invalid internal state\n"); + sif::printError("Max31865PT1000Handler: Invalid internal state\n"); #endif - return HasReturnvaluesIF::RETURN_FAILED; - } + return HasReturnvaluesIF::RETURN_FAILED; + } } -ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { - switch(deviceCommand) { - case(Max31865Definitions::CONFIG_CMD) : { - commandBuffer[0] = static_cast(Max31865Definitions::CONFIG_CMD); - if(commandDataLen == 1) { - commandBuffer[1] = commandData[0]; - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - else { - return DeviceHandlerIF::NO_COMMAND_DATA; - } - } - case(Max31865Definitions::REQUEST_CONFIG): { - commandBuffer[0] = static_cast( - Max31865Definitions::REQUEST_CONFIG); - commandBuffer[1] = 0x00; // dummy byte - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::WRITE_HIGH_THRESHOLD): { - commandBuffer[0] = static_cast( - Max31865Definitions::WRITE_HIGH_THRESHOLD); - commandBuffer[1] = static_cast(HIGH_THRESHOLD >> 8); - commandBuffer[2] = static_cast(HIGH_THRESHOLD & 0xFF); - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): { - commandBuffer[0] = static_cast( - Max31865Definitions::REQUEST_HIGH_THRESHOLD); - commandBuffer[1] = 0x00; //dummy byte - commandBuffer[2] = 0x00; //dummy byte - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::WRITE_LOW_THRESHOLD): { - commandBuffer[0] = static_cast( - Max31865Definitions::WRITE_LOW_THRESHOLD); - commandBuffer[1] = static_cast(LOW_THRESHOLD >> 8); - commandBuffer[2] = static_cast(LOW_THRESHOLD & 0xFF); - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::REQUEST_LOW_THRESHOLD): { - commandBuffer[0] = static_cast( - Max31865Definitions::REQUEST_LOW_THRESHOLD); - commandBuffer[1] = 0x00; //dummy byte - commandBuffer[2] = 0x00; //dummy byte - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::REQUEST_RTD): { - commandBuffer[0] = static_cast( - Max31865Definitions::REQUEST_RTD); - // two dummy bytes - commandBuffer[1] = 0x00; - commandBuffer[2] = 0x00; - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case(Max31865Definitions::REQUEST_FAULT_BYTE): { - commandBuffer[0] = static_cast( - Max31865Definitions::REQUEST_FAULT_BYTE); - commandBuffer[1] = 0x00; - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - default: - //Unknown DeviceCommand - return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - } +ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + switch (deviceCommand) { + case (Max31865Definitions::CONFIG_CMD): { + commandBuffer[0] = static_cast(Max31865Definitions::CONFIG_CMD); + if (commandDataLen == 1) { + commandBuffer[1] = commandData[0]; + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } else { + return DeviceHandlerIF::NO_COMMAND_DATA; + } + } + case (Max31865Definitions::REQUEST_CONFIG): { + commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_CONFIG); + commandBuffer[1] = 0x00; // dummy byte + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::WRITE_HIGH_THRESHOLD): { + commandBuffer[0] = static_cast(Max31865Definitions::WRITE_HIGH_THRESHOLD); + commandBuffer[1] = static_cast(HIGH_THRESHOLD >> 8); + commandBuffer[2] = static_cast(HIGH_THRESHOLD & 0xFF); + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::REQUEST_HIGH_THRESHOLD): { + commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_HIGH_THRESHOLD); + commandBuffer[1] = 0x00; //dummy byte + commandBuffer[2] = 0x00; //dummy byte + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::WRITE_LOW_THRESHOLD): { + commandBuffer[0] = static_cast(Max31865Definitions::WRITE_LOW_THRESHOLD); + commandBuffer[1] = static_cast(LOW_THRESHOLD >> 8); + commandBuffer[2] = static_cast(LOW_THRESHOLD & 0xFF); + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::REQUEST_LOW_THRESHOLD): { + commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_LOW_THRESHOLD); + commandBuffer[1] = 0x00; //dummy byte + commandBuffer[2] = 0x00; //dummy byte + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::REQUEST_RTD): { + commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_RTD); + // two dummy bytes + commandBuffer[1] = 0x00; + commandBuffer[2] = 0x00; + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case (Max31865Definitions::REQUEST_FAULT_BYTE): { + commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_FAULT_BYTE); + commandBuffer[1] = 0x00; + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + default: + //Unknown DeviceCommand + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } } void Max31865PT1000Handler::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(Max31865Definitions::CONFIG_CMD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_CONFIG, 3); - insertInCommandAndReplyMap(Max31865Definitions::WRITE_LOW_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_LOW_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::WRITE_HIGH_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_HIGH_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3, - &sensorDataset); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3); + insertInCommandAndReplyMap(Max31865Definitions::CONFIG_CMD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_CONFIG, 3); + insertInCommandAndReplyMap(Max31865Definitions::WRITE_LOW_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_LOW_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::WRITE_HIGH_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_HIGH_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3, &sensorDataset); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3); } -ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, - size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { - size_t rtdReplySize = 3; - size_t configReplySize = 2; +ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t remainingSize, + DeviceCommandId_t *foundId, size_t *foundLen) { + size_t rtdReplySize = 3; + size_t configReplySize = 2; - if(remainingSize == rtdReplySize and - internalState == InternalState::RUNNING) { - *foundId = Max31865Definitions::REQUEST_RTD; - *foundLen = rtdReplySize; - return RETURN_OK; - } + if (remainingSize == rtdReplySize and internalState == InternalState::RUNNING) { + *foundId = Max31865Definitions::REQUEST_RTD; + *foundLen = rtdReplySize; + return RETURN_OK; + } - if(remainingSize == 3) { - switch(internalState) { - case(InternalState::CONFIG_HIGH_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::WRITE_HIGH_THRESHOLD; - commandExecuted = true; - return RETURN_OK; - } - case(InternalState::REQUEST_HIGH_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::REQUEST_HIGH_THRESHOLD; - return RETURN_OK; - } - case(InternalState::CONFIG_LOW_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::WRITE_LOW_THRESHOLD; - commandExecuted = true; - return RETURN_OK; - } - case(InternalState::REQUEST_LOW_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::REQUEST_LOW_THRESHOLD; - return RETURN_OK; - } - default: { - sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state" - << std::endl; - return RETURN_OK; - } - } - } + if (remainingSize == 3) { + switch (internalState) { + case (InternalState::CONFIG_HIGH_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::WRITE_HIGH_THRESHOLD; + commandExecuted = true; + return RETURN_OK; + } + case (InternalState::REQUEST_HIGH_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::REQUEST_HIGH_THRESHOLD; + return RETURN_OK; + } + case (InternalState::CONFIG_LOW_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::WRITE_LOW_THRESHOLD; + commandExecuted = true; + return RETURN_OK; + } + case (InternalState::REQUEST_LOW_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::REQUEST_LOW_THRESHOLD; + return RETURN_OK; + } + default: { + sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state" + << std::endl; + return RETURN_OK; + } + } + } - if(remainingSize == configReplySize) { - if(internalState == InternalState::CONFIGURE) { - commandExecuted = true; - *foundLen = configReplySize; - *foundId = Max31865Definitions::CONFIG_CMD; - } - else if(internalState == InternalState::REQUEST_FAULT_BYTE) { - *foundId = Max31865Definitions::REQUEST_FAULT_BYTE; - *foundLen = 2; - internalState = InternalState::RUNNING; - } - else { - *foundId = Max31865Definitions::REQUEST_CONFIG; - *foundLen = configReplySize; - } - } + if (remainingSize == configReplySize) { + if (internalState == InternalState::CONFIGURE) { + commandExecuted = true; + *foundLen = configReplySize; + *foundId = Max31865Definitions::CONFIG_CMD; + internalState = InternalState::REQUEST_CONFIG; + } else if (internalState == InternalState::REQUEST_FAULT_BYTE) { + *foundId = Max31865Definitions::REQUEST_FAULT_BYTE; + *foundLen = 2; +// internalState = InternalState::RUNNING; + } else { + *foundId = Max31865Definitions::REQUEST_CONFIG; + *foundLen = configReplySize; + internalState = InternalState::CONFIGURE; + } + } - return RETURN_OK; + return RETURN_OK; } -ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( - DeviceCommandId_t id, const uint8_t *packet) { - switch(id) { - case(Max31865Definitions::REQUEST_CONFIG): { - if(packet[1] != DEFAULT_CONFIG) { +ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) { + switch (id) { + case (Max31865Definitions::REQUEST_CONFIG): { + if (packet[1] != DEFAULT_CONFIG) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - // it propably would be better if we at least try one restart.. - sif::error << "Max31865PT1000Handler: Invalid configuration reply!" << std::endl; + // it propably would be better if we at least try one restart.. + sif::error << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() + << ": Invalid configuration reply!" << std::endl; #else - sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); + sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); #endif - return HasReturnvaluesIF::RETURN_OK; - } - // set to true for invalid configs too for now. - if(internalState == InternalState::REQUEST_CONFIG) { - commandExecuted = true; - } - else if(internalState == InternalState::RUNNING) { - // we should propably generate a telemetry with the config byte - // as payload here. - } - break; - } - case(Max31865Definitions::REQUEST_LOW_THRESHOLD): { - uint16_t readLowThreshold = packet[1] << 8 | packet[2]; - if(readLowThreshold != LOW_THRESHOLD) { + return HasReturnvaluesIF::RETURN_OK; + } + else { + sif::debug << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() + << ": Config readback successful!" << std::endl; + } + // set to true for invalid configs too for now. + if (internalState == InternalState::REQUEST_CONFIG) { + commandExecuted = true; + } else if (internalState == InternalState::RUNNING) { + // we should propably generate a telemetry with the config byte + // as payload here. + } + break; + } + case (Max31865Definitions::REQUEST_LOW_THRESHOLD): { + uint16_t readLowThreshold = packet[1] << 8 | packet[2]; + if (readLowThreshold != LOW_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " << - "written and readback value of low threshold register" << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + << "written and readback value of low threshold register" << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - "written and readback value of low threshold register\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + "written and readback value of low threshold register\n"); #endif #endif - } - commandExecuted = true; - break; - } - case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): { - uint16_t readHighThreshold = packet[1] << 8 | packet[2]; - if(readHighThreshold != HIGH_THRESHOLD) { + } + commandExecuted = true; + break; + } + case (Max31865Definitions::REQUEST_HIGH_THRESHOLD): { + uint16_t readHighThreshold = packet[1] << 8 | packet[2]; + if (readHighThreshold != HIGH_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " << - "written and readback value of high threshold register" << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + << "written and readback value of high threshold register" << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - "written and readback value of high threshold register\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + "written and readback value of high threshold register\n"); #endif #endif - } - commandExecuted = true; - break; - } - case(Max31865Definitions::REQUEST_RTD): { - // first bit of LSB reply byte is the fault bit - uint8_t faultBit = packet[2] & 0b0000'0001; - if(faultBit == 1) { - // Maybe we should attempt to restart it? - internalState = InternalState::REQUEST_FAULT_BYTE; - } + } + commandExecuted = true; + break; + } + case (Max31865Definitions::REQUEST_RTD): { + // first bit of LSB reply byte is the fault bit + uint8_t faultBit = packet[2] & 0b0000'0001; + if (faultBit == 1) { + // Maybe we should attempt to restart it? + internalState = InternalState::REQUEST_FAULT_BYTE; + } - // RTD value consists of last seven bits of the LSB reply byte and - // the MSB reply byte - uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1; - // do something with rtd value, will propably be stored in - // dataset. - float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX; - // calculate approximation - float approxTemp = adcCode / 32.0 - 256.0; + // RTD value consists of last seven bits of the LSB reply byte and + // the MSB reply byte + uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1; + // do something with rtd value, will propably be stored in + // dataset. + float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX; + // calculate approximation + float approxTemp = adcCode / 32.0 - 256.0; #if OBSW_DEBUG_RTD == 1 #if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->checkAndIncrement()) { + if (debugDivider->checkAndIncrement()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Max31865: Measured resistance is " << rtdValue << " Ohms." << std::endl; - sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; + sif::info << "Max31865: Object ID: " << std::hex << this->getObjectId() + << "Measured resistance is " << rtdValue << " Ohms." << std::endl; + sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; #else - sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); - sif::printInfo("Approximated temperature is %f C\n", approxTemp); + sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); + sif::printInfo("Approximated temperature is %f C\n", approxTemp); #endif - } + } #endif #endif - PoolReadGuard pg(&sensorDataset); - if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + PoolReadGuard pg(&sensorDataset); + if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!" - << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!" + << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: " + "Error reading dataset!\n"); #endif - return pg.getReadResult(); - } + return pg.getReadResult(); + } - if(not sensorDataset.isValid()) { - sensorDataset.setValidity(true, false); - sensorDataset.rtdValue.setValid(true); - sensorDataset.temperatureCelcius.setValid(true); - } + if (not sensorDataset.isValid()) { + sensorDataset.setValidity(true, false); + sensorDataset.rtdValue.setValid(true); + sensorDataset.temperatureCelcius.setValid(true); + } - sensorDataset.rtdValue = rtdValue; - sensorDataset.temperatureCelcius = approxTemp; - break; - } - case(Max31865Definitions::REQUEST_FAULT_BYTE): { - faultByte = packet[1]; + sensorDataset.rtdValue = rtdValue; + sensorDataset.temperatureCelcius = approxTemp; + break; + } + case (Max31865Definitions::REQUEST_FAULT_BYTE): { + faultByte = packet[1]; #if OBSW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Fault byte" - " is: 0b" << std::bitset<8>(faultByte) << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Fault byte" + " is: 0b" << std::bitset < 8 > (faultByte) << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte" - " is: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(faultByte)); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte" + " is: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(faultByte)); #endif #endif - ReturnValue_t result = sensorDataset.read(); - if(result != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + ReturnValue_t result = sensorDataset.read(); + if (result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!" << std::endl; + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " + "Error reading dataset!" << std::endl; #else - sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!\n"); + sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " + "Error reading dataset!\n"); #endif - return result; - } - sensorDataset.errorByte.setValid(true); - sensorDataset.errorByte = faultByte; - if(faultByte != 0) { - sensorDataset.temperatureCelcius.setValid(false); - } + return result; + } + sensorDataset.errorByte.setValid(true); + sensorDataset.errorByte = faultByte; + if (faultByte != 0) { + sensorDataset.temperatureCelcius.setValid(false); + } - result = sensorDataset.commit(); - if(result != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + result = sensorDataset.commit(); + if (result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " - "Error commiting dataset!" << std::endl; + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " + "Error commiting dataset!" << std::endl; #else - sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " - "Error commiting dataset!\n"); + sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " + "Error commiting dataset!\n"); #endif - return result; - } + return result; + } - break; - } - default: - break; - } - return HasReturnvaluesIF::RETURN_OK; + break; + } + default: + break; + } + return HasReturnvaluesIF::RETURN_OK; } -void Max31865PT1000Handler::debugInterface(uint8_t positionTracker, - object_id_t objectId, uint32_t parameter) { +void Max31865PT1000Handler::debugInterface(uint8_t positionTracker, object_id_t objectId, + uint32_t parameter) { } -uint32_t Max31865PT1000Handler::getTransitionDelayMs( - Mode_t modeFrom, Mode_t modeTo) { - return 25000; +uint32_t Max31865PT1000Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { + return 25000; } -ReturnValue_t Max31865PT1000Handler::getSwitches( - const uint8_t **switches, uint8_t *numberOfSwitches) { - return DeviceHandlerBase::NO_SWITCH; +ReturnValue_t Max31865PT1000Handler::getSwitches(const uint8_t **switches, + uint8_t *numberOfSwitches) { + return DeviceHandlerBase::NO_SWITCH; } -void Max31865PT1000Handler::doTransition(Mode_t modeFrom, - Submode_t subModeFrom) { - DeviceHandlerBase::doTransition(modeFrom, subModeFrom); +void Max31865PT1000Handler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { + DeviceHandlerBase::doTransition(modeFrom, subModeFrom); } ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry({0})); - localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C, - new PoolEntry({0}, 1, true)); - localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, - new PoolEntry({0})); + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry( { 0 })); + localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C, + new PoolEntry( { 0 }, 1, true)); + localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, + new PoolEntry( { 0 })); // poolManager.subscribeForPeriodicPacket(sensorDatasetSid, // false, 4.0, false); - return HasReturnvaluesIF::RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } void Max31865PT1000Handler::modeChanged() { - internalState = InternalState::NONE; +// internalState = InternalState::NONE; } diff --git a/mission/devices/Max31865PT1000Handler.h b/mission/devices/Max31865PT1000Handler.h index ad412ef1..51cc04eb 100644 --- a/mission/devices/Max31865PT1000Handler.h +++ b/mission/devices/Max31865PT1000Handler.h @@ -99,7 +99,7 @@ private: REQUEST_FAULT_BYTE }; - InternalState internalState = InternalState::NONE; + InternalState internalState = InternalState::CONFIGURE; bool commandExecuted = false; dur_millis_t startTime = 0; diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 91188d87..397e477e 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -185,6 +185,7 @@ ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; *foundLen = remainingSize; +// *foundLen = 1; return RETURN_FAILED; } } -- 2.43.0 From 811fe96557652f367094e8de12a002eb09ce7fe7 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Tue, 19 Oct 2021 16:13:56 +0200 Subject: [PATCH 2/7] added object id in printouts of rtds --- mission/devices/Max31865PT1000Handler.cpp | 800 +++++++++++----------- mission/devices/Max31865PT1000Handler.h | 4 +- 2 files changed, 405 insertions(+), 399 deletions(-) diff --git a/mission/devices/Max31865PT1000Handler.cpp b/mission/devices/Max31865PT1000Handler.cpp index 74c21fc0..ba9c8e08 100644 --- a/mission/devices/Max31865PT1000Handler.cpp +++ b/mission/devices/Max31865PT1000Handler.cpp @@ -6,11 +6,11 @@ #include Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId, object_id_t comIF, - CookieIF *comCookie) : - DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this), sensorDatasetSid( - sensorDataset.getSid()) { + CookieIF *comCookie): + DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this), + sensorDatasetSid(sensorDataset.getSid()) { #if OBSW_VERBOSE_LEVEL >= 1 - debugDivider = new PeriodicOperationDivider(0); + debugDivider = new PeriodicOperationDivider(0); #endif } @@ -18,477 +18,483 @@ Max31865PT1000Handler::~Max31865PT1000Handler() { } void Max31865PT1000Handler::doStartUp() { -// if (internalState == InternalState::NONE) { -// internalState = InternalState::WARMUP; -// Clock::getUptime(&startTime); -// } -// -// if (internalState == InternalState::WARMUP) { -// dur_millis_t timeNow = 0; -// Clock::getUptime(&timeNow); -// if (timeNow - startTime >= 100) { -// internalState = InternalState::CONFIGURE; -// } -// } -// -// if (internalState == InternalState::CONFIGURE) { -// if (commandExecuted) { -// commandExecuted = false; -// internalState = InternalState::REQUEST_CONFIG; -// } -// } -// -// if (internalState == InternalState::REQUEST_CONFIG) { -// if (commandExecuted) { -// commandExecuted = false; -// internalState = InternalState::CONFIG_HIGH_THRESHOLD; -// } -// } -// -// if (internalState == InternalState::CONFIG_HIGH_THRESHOLD) { -// if (commandExecuted) { -// internalState = InternalState::REQUEST_HIGH_THRESHOLD; -// commandExecuted = false; -// } -// } -// -// if (internalState == InternalState::REQUEST_HIGH_THRESHOLD) { -// if (commandExecuted) { -// internalState = InternalState::CONFIG_LOW_THRESHOLD; -// commandExecuted = false; -// } -// } -// -// if (internalState == InternalState::CONFIG_LOW_THRESHOLD) { -// if (commandExecuted) { -// internalState = InternalState::REQUEST_LOW_THRESHOLD; -// commandExecuted = false; -// } -// } -// -// if (internalState == InternalState::REQUEST_LOW_THRESHOLD) { -// if (commandExecuted) { -// setMode(MODE_ON); -// setMode(MODE_NORMAL); -// internalState = InternalState::RUNNING; -// commandExecuted = false; -// } -// } - setMode(MODE_NORMAL); + if(internalState == InternalState::NONE) { + internalState = InternalState::WARMUP; + Clock::getUptime(&startTime); + } + + if(internalState == InternalState::WARMUP) { + dur_millis_t timeNow = 0; + Clock::getUptime(&timeNow); + if(timeNow - startTime >= 100) { + internalState = InternalState::CONFIGURE; + } + } + + if(internalState == InternalState::CONFIGURE) { + if(commandExecuted) { + commandExecuted = false; + internalState = InternalState::REQUEST_CONFIG; + } + } + + if(internalState == InternalState::REQUEST_CONFIG) { + if (commandExecuted) { + commandExecuted = false; + internalState = InternalState::CONFIG_HIGH_THRESHOLD; + } + } + + if(internalState == InternalState::CONFIG_HIGH_THRESHOLD) { + if(commandExecuted) { + internalState = InternalState::REQUEST_HIGH_THRESHOLD; + commandExecuted = false; + } + } + + if(internalState == InternalState::REQUEST_HIGH_THRESHOLD) { + if(commandExecuted) { + internalState = InternalState::CONFIG_LOW_THRESHOLD; + commandExecuted = false; + } + } + + if(internalState == InternalState::CONFIG_LOW_THRESHOLD) { + if(commandExecuted) { + internalState = InternalState::REQUEST_LOW_THRESHOLD; + commandExecuted = false; + } + } + + if(internalState == InternalState::REQUEST_LOW_THRESHOLD) { + if(commandExecuted) { + setMode(MODE_ON); + setMode(MODE_NORMAL); + internalState = InternalState::RUNNING; + commandExecuted = false; + } + } } void Max31865PT1000Handler::doShutDown() { - commandExecuted = false; - setMode(_MODE_POWER_DOWN); + commandExecuted = false; + setMode(_MODE_POWER_DOWN); } -ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { -// if (internalState == InternalState::RUNNING) { -// *id = Max31865Definitions::REQUEST_RTD; -// return buildCommandFromCommand(*id, nullptr, 0); -// } else if (internalState == InternalState::REQUEST_FAULT_BYTE) { -// *id = Max31865Definitions::REQUEST_FAULT_BYTE; -// return buildCommandFromCommand(*id, nullptr, 0); -// } else { -// return DeviceHandlerBase::NOTHING_TO_SEND; -// } - - if (internalState == InternalState::CONFIGURE) { - *id = Max31865Definitions::CONFIG_CMD; - uint8_t config[1] = { DEFAULT_CONFIG }; - return buildCommandFromCommand(*id, config, 1); - } else if (internalState == InternalState::REQUEST_CONFIG) { - *id = Max31865Definitions::REQUEST_CONFIG; - //internalState = InternalState::NONE; - return buildCommandFromCommand(*id, nullptr, 0); - } else { - return DeviceHandlerBase::NOTHING_TO_SEND; - } +ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand( + DeviceCommandId_t *id) { + if(internalState == InternalState::RUNNING) { + *id = Max31865Definitions::REQUEST_RTD; + return buildCommandFromCommand(*id, nullptr, 0); + } + else if(internalState == InternalState::REQUEST_FAULT_BYTE) { + *id = Max31865Definitions::REQUEST_FAULT_BYTE; + return buildCommandFromCommand(*id, nullptr, 0); + } + else { + return DeviceHandlerBase::NOTHING_TO_SEND; + } } -ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { - switch (internalState) { - case (InternalState::NONE): - case (InternalState::WARMUP): - case (InternalState::RUNNING): - return DeviceHandlerBase::NOTHING_TO_SEND; - case (InternalState::CONFIGURE): { - *id = Max31865Definitions::CONFIG_CMD; - uint8_t config[1] = { DEFAULT_CONFIG }; - return buildCommandFromCommand(*id, config, 1); - } - case (InternalState::REQUEST_CONFIG): { - *id = Max31865Definitions::REQUEST_CONFIG; - return buildCommandFromCommand(*id, nullptr, 0); - } - case (InternalState::CONFIG_HIGH_THRESHOLD): { - *id = Max31865Definitions::WRITE_HIGH_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case (InternalState::REQUEST_HIGH_THRESHOLD): { - *id = Max31865Definitions::REQUEST_HIGH_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case (InternalState::CONFIG_LOW_THRESHOLD): { - *id = Max31865Definitions::WRITE_LOW_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } - case (InternalState::REQUEST_LOW_THRESHOLD): { - *id = Max31865Definitions::REQUEST_LOW_THRESHOLD; - return buildCommandFromCommand(*id, nullptr, 0); - } +ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand( + DeviceCommandId_t *id) { + switch(internalState) { + case(InternalState::NONE): + case(InternalState::WARMUP): + case(InternalState::RUNNING): + return DeviceHandlerBase::NOTHING_TO_SEND; + case(InternalState::CONFIGURE): { + *id = Max31865Definitions::CONFIG_CMD; + uint8_t config[1] = {DEFAULT_CONFIG}; + return buildCommandFromCommand(*id, config, 1); + } + case(InternalState::REQUEST_CONFIG): { + *id = Max31865Definitions::REQUEST_CONFIG; + return buildCommandFromCommand(*id, nullptr, 0); + } + case(InternalState::CONFIG_HIGH_THRESHOLD): { + *id = Max31865Definitions::WRITE_HIGH_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case(InternalState::REQUEST_HIGH_THRESHOLD): { + *id = Max31865Definitions::REQUEST_HIGH_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case(InternalState::CONFIG_LOW_THRESHOLD): { + *id = Max31865Definitions::WRITE_LOW_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } + case(InternalState::REQUEST_LOW_THRESHOLD): { + *id = Max31865Definitions::REQUEST_LOW_THRESHOLD; + return buildCommandFromCommand(*id, nullptr, 0); + } - default: + default: #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Max31865PT1000Handler: Invalid internal state" << std::endl; + sif::error << "Max31865PT1000Handler: Invalid internal state" << std::endl; #else - sif::printError("Max31865PT1000Handler: Invalid internal state\n"); + sif::printError("Max31865PT1000Handler: Invalid internal state\n"); #endif - return HasReturnvaluesIF::RETURN_FAILED; - } + return HasReturnvaluesIF::RETURN_FAILED; + } } -ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, size_t commandDataLen) { - switch (deviceCommand) { - case (Max31865Definitions::CONFIG_CMD): { - commandBuffer[0] = static_cast(Max31865Definitions::CONFIG_CMD); - if (commandDataLen == 1) { - commandBuffer[1] = commandData[0]; - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } else { - return DeviceHandlerIF::NO_COMMAND_DATA; - } - } - case (Max31865Definitions::REQUEST_CONFIG): { - commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_CONFIG); - commandBuffer[1] = 0x00; // dummy byte - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::WRITE_HIGH_THRESHOLD): { - commandBuffer[0] = static_cast(Max31865Definitions::WRITE_HIGH_THRESHOLD); - commandBuffer[1] = static_cast(HIGH_THRESHOLD >> 8); - commandBuffer[2] = static_cast(HIGH_THRESHOLD & 0xFF); - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::REQUEST_HIGH_THRESHOLD): { - commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_HIGH_THRESHOLD); - commandBuffer[1] = 0x00; //dummy byte - commandBuffer[2] = 0x00; //dummy byte - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::WRITE_LOW_THRESHOLD): { - commandBuffer[0] = static_cast(Max31865Definitions::WRITE_LOW_THRESHOLD); - commandBuffer[1] = static_cast(LOW_THRESHOLD >> 8); - commandBuffer[2] = static_cast(LOW_THRESHOLD & 0xFF); - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::REQUEST_LOW_THRESHOLD): { - commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_LOW_THRESHOLD); - commandBuffer[1] = 0x00; //dummy byte - commandBuffer[2] = 0x00; //dummy byte - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::REQUEST_RTD): { - commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_RTD); - // two dummy bytes - commandBuffer[1] = 0x00; - commandBuffer[2] = 0x00; - DeviceHandlerBase::rawPacketLen = 3; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - case (Max31865Definitions::REQUEST_FAULT_BYTE): { - commandBuffer[0] = static_cast(Max31865Definitions::REQUEST_FAULT_BYTE); - commandBuffer[1] = 0x00; - DeviceHandlerBase::rawPacketLen = 2; - DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; - } - default: - //Unknown DeviceCommand - return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - } +ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) { + switch(deviceCommand) { + case(Max31865Definitions::CONFIG_CMD) : { + commandBuffer[0] = static_cast(Max31865Definitions::CONFIG_CMD); + if(commandDataLen == 1) { + commandBuffer[1] = commandData[0]; + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + else { + return DeviceHandlerIF::NO_COMMAND_DATA; + } + } + case(Max31865Definitions::REQUEST_CONFIG): { + commandBuffer[0] = static_cast( + Max31865Definitions::REQUEST_CONFIG); + commandBuffer[1] = 0x00; // dummy byte + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::WRITE_HIGH_THRESHOLD): { + commandBuffer[0] = static_cast( + Max31865Definitions::WRITE_HIGH_THRESHOLD); + commandBuffer[1] = static_cast(HIGH_THRESHOLD >> 8); + commandBuffer[2] = static_cast(HIGH_THRESHOLD & 0xFF); + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): { + commandBuffer[0] = static_cast( + Max31865Definitions::REQUEST_HIGH_THRESHOLD); + commandBuffer[1] = 0x00; //dummy byte + commandBuffer[2] = 0x00; //dummy byte + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::WRITE_LOW_THRESHOLD): { + commandBuffer[0] = static_cast( + Max31865Definitions::WRITE_LOW_THRESHOLD); + commandBuffer[1] = static_cast(LOW_THRESHOLD >> 8); + commandBuffer[2] = static_cast(LOW_THRESHOLD & 0xFF); + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::REQUEST_LOW_THRESHOLD): { + commandBuffer[0] = static_cast( + Max31865Definitions::REQUEST_LOW_THRESHOLD); + commandBuffer[1] = 0x00; //dummy byte + commandBuffer[2] = 0x00; //dummy byte + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::REQUEST_RTD): { + commandBuffer[0] = static_cast( + Max31865Definitions::REQUEST_RTD); + // two dummy bytes + commandBuffer[1] = 0x00; + commandBuffer[2] = 0x00; + DeviceHandlerBase::rawPacketLen = 3; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + case(Max31865Definitions::REQUEST_FAULT_BYTE): { + commandBuffer[0] = static_cast( + Max31865Definitions::REQUEST_FAULT_BYTE); + commandBuffer[1] = 0x00; + DeviceHandlerBase::rawPacketLen = 2; + DeviceHandlerBase::rawPacket = commandBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; + } + default: + //Unknown DeviceCommand + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } } void Max31865PT1000Handler::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(Max31865Definitions::CONFIG_CMD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_CONFIG, 3); - insertInCommandAndReplyMap(Max31865Definitions::WRITE_LOW_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_LOW_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::WRITE_HIGH_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_HIGH_THRESHOLD, 3); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3, &sensorDataset); - insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3); + insertInCommandAndReplyMap(Max31865Definitions::CONFIG_CMD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_CONFIG, 3); + insertInCommandAndReplyMap(Max31865Definitions::WRITE_LOW_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_LOW_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::WRITE_HIGH_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_HIGH_THRESHOLD, 3); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3, + &sensorDataset); + insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3); } -ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t remainingSize, - DeviceCommandId_t *foundId, size_t *foundLen) { - size_t rtdReplySize = 3; - size_t configReplySize = 2; +ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, + size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { + size_t rtdReplySize = 3; + size_t configReplySize = 2; - if (remainingSize == rtdReplySize and internalState == InternalState::RUNNING) { - *foundId = Max31865Definitions::REQUEST_RTD; - *foundLen = rtdReplySize; - return RETURN_OK; - } + if(remainingSize == rtdReplySize and + internalState == InternalState::RUNNING) { + *foundId = Max31865Definitions::REQUEST_RTD; + *foundLen = rtdReplySize; + return RETURN_OK; + } - if (remainingSize == 3) { - switch (internalState) { - case (InternalState::CONFIG_HIGH_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::WRITE_HIGH_THRESHOLD; - commandExecuted = true; - return RETURN_OK; - } - case (InternalState::REQUEST_HIGH_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::REQUEST_HIGH_THRESHOLD; - return RETURN_OK; - } - case (InternalState::CONFIG_LOW_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::WRITE_LOW_THRESHOLD; - commandExecuted = true; - return RETURN_OK; - } - case (InternalState::REQUEST_LOW_THRESHOLD): { - *foundLen = 3; - *foundId = Max31865Definitions::REQUEST_LOW_THRESHOLD; - return RETURN_OK; - } - default: { - sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state" - << std::endl; - return RETURN_OK; - } - } - } + if(remainingSize == 3) { + switch(internalState) { + case(InternalState::CONFIG_HIGH_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::WRITE_HIGH_THRESHOLD; + commandExecuted = true; + return RETURN_OK; + } + case(InternalState::REQUEST_HIGH_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::REQUEST_HIGH_THRESHOLD; + return RETURN_OK; + } + case(InternalState::CONFIG_LOW_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::WRITE_LOW_THRESHOLD; + commandExecuted = true; + return RETURN_OK; + } + case(InternalState::REQUEST_LOW_THRESHOLD): { + *foundLen = 3; + *foundId = Max31865Definitions::REQUEST_LOW_THRESHOLD; + return RETURN_OK; + } + default: { + sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state" + << std::endl; + return RETURN_OK; + } + } + } - if (remainingSize == configReplySize) { - if (internalState == InternalState::CONFIGURE) { - commandExecuted = true; - *foundLen = configReplySize; - *foundId = Max31865Definitions::CONFIG_CMD; - internalState = InternalState::REQUEST_CONFIG; - } else if (internalState == InternalState::REQUEST_FAULT_BYTE) { - *foundId = Max31865Definitions::REQUEST_FAULT_BYTE; - *foundLen = 2; -// internalState = InternalState::RUNNING; - } else { - *foundId = Max31865Definitions::REQUEST_CONFIG; - *foundLen = configReplySize; - internalState = InternalState::CONFIGURE; - } - } + if(remainingSize == configReplySize) { + if(internalState == InternalState::CONFIGURE) { + commandExecuted = true; + *foundLen = configReplySize; + *foundId = Max31865Definitions::CONFIG_CMD; + } + else if(internalState == InternalState::REQUEST_FAULT_BYTE) { + *foundId = Max31865Definitions::REQUEST_FAULT_BYTE; + *foundLen = 2; + internalState = InternalState::RUNNING; + } + else { + *foundId = Max31865Definitions::REQUEST_CONFIG; + *foundLen = configReplySize; + } + } - return RETURN_OK; + return RETURN_OK; } -ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) { - switch (id) { - case (Max31865Definitions::REQUEST_CONFIG): { - if (packet[1] != DEFAULT_CONFIG) { +ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( + DeviceCommandId_t id, const uint8_t *packet) { + switch(id) { + case(Max31865Definitions::REQUEST_CONFIG): { + if(packet[1] != DEFAULT_CONFIG) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - // it propably would be better if we at least try one restart.. - sif::error << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() - << ": Invalid configuration reply!" << std::endl; + // it propably would be better if we at least try one restart.. + sif::error << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() + << ": Invalid configuration reply!" << std::endl; #else - sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); + sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); #endif - return HasReturnvaluesIF::RETURN_OK; - } - else { - sif::debug << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() - << ": Config readback successful!" << std::endl; - } - // set to true for invalid configs too for now. - if (internalState == InternalState::REQUEST_CONFIG) { - commandExecuted = true; - } else if (internalState == InternalState::RUNNING) { - // we should propably generate a telemetry with the config byte - // as payload here. - } - break; - } - case (Max31865Definitions::REQUEST_LOW_THRESHOLD): { - uint16_t readLowThreshold = packet[1] << 8 | packet[2]; - if (readLowThreshold != LOW_THRESHOLD) { + return HasReturnvaluesIF::RETURN_OK; + } + // set to true for invalid configs too for now. + if(internalState == InternalState::REQUEST_CONFIG) { + commandExecuted = true; + } + else if(internalState == InternalState::RUNNING) { + // we should propably generate a telemetry with the config byte + // as payload here. + } + break; + } + case(Max31865Definitions::REQUEST_LOW_THRESHOLD): { + uint16_t readLowThreshold = packet[1] << 8 | packet[2]; + if(readLowThreshold != LOW_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - << "written and readback value of low threshold register" << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << + std::hex << this->getObjectId() << ": Missmatch between " << + "written and readback value of low threshold register" << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - "written and readback value of low threshold register\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + "written and readback value of low threshold register\n"); #endif #endif - } - commandExecuted = true; - break; - } - case (Max31865Definitions::REQUEST_HIGH_THRESHOLD): { - uint16_t readHighThreshold = packet[1] << 8 | packet[2]; - if (readHighThreshold != HIGH_THRESHOLD) { + } + commandExecuted = true; + break; + } + case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): { + uint16_t readHighThreshold = packet[1] << 8 | packet[2]; + if(readHighThreshold != HIGH_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - << "written and readback value of high threshold register" << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Missmatch between " << + "written and readback value of high threshold register" << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " - "written and readback value of high threshold register\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " + "written and readback value of high threshold register\n"); #endif #endif - } - commandExecuted = true; - break; - } - case (Max31865Definitions::REQUEST_RTD): { - // first bit of LSB reply byte is the fault bit - uint8_t faultBit = packet[2] & 0b0000'0001; - if (faultBit == 1) { - // Maybe we should attempt to restart it? - internalState = InternalState::REQUEST_FAULT_BYTE; - } + } + commandExecuted = true; + break; + } + case(Max31865Definitions::REQUEST_RTD): { + // first bit of LSB reply byte is the fault bit + uint8_t faultBit = packet[2] & 0b0000'0001; + if(faultBit == 1) { + // Maybe we should attempt to restart it? + internalState = InternalState::REQUEST_FAULT_BYTE; + } - // RTD value consists of last seven bits of the LSB reply byte and - // the MSB reply byte - uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1; - // do something with rtd value, will propably be stored in - // dataset. - float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX; - // calculate approximation - float approxTemp = adcCode / 32.0 - 256.0; + // RTD value consists of last seven bits of the LSB reply byte and + // the MSB reply byte + uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1; + // do something with rtd value, will propably be stored in + // dataset. + float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX; + // calculate approximation + float approxTemp = adcCode / 32.0 - 256.0; #if OBSW_DEBUG_RTD == 1 #if OBSW_VERBOSE_LEVEL >= 1 - if (debugDivider->checkAndIncrement()) { + if(debugDivider->checkAndIncrement()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Max31865: Object ID: " << std::hex << this->getObjectId() - << "Measured resistance is " << rtdValue << " Ohms." << std::endl; - sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; + sif::info << "Max31865: Object ID: " << std::hex << this->getObjectId() + << ": Measured resistance is " << rtdValue << " Ohms." << std::endl; + sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; #else - sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); - sif::printInfo("Approximated temperature is %f C\n", approxTemp); + sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); + sif::printInfo("Approximated temperature is %f C\n", approxTemp); #endif - } + } #endif #endif - PoolReadGuard pg(&sensorDataset); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + PoolReadGuard pg(&sensorDataset); + if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!" - << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Error reading dataset!" + << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!\n"); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: " + "Error reading dataset!\n"); #endif - return pg.getReadResult(); - } + return pg.getReadResult(); + } - if (not sensorDataset.isValid()) { - sensorDataset.setValidity(true, false); - sensorDataset.rtdValue.setValid(true); - sensorDataset.temperatureCelcius.setValid(true); - } + if(not sensorDataset.isValid()) { + sensorDataset.setValidity(true, false); + sensorDataset.rtdValue.setValid(true); + sensorDataset.temperatureCelcius.setValid(true); + } - sensorDataset.rtdValue = rtdValue; - sensorDataset.temperatureCelcius = approxTemp; - break; - } - case (Max31865Definitions::REQUEST_FAULT_BYTE): { - faultByte = packet[1]; + sensorDataset.rtdValue = rtdValue; + sensorDataset.temperatureCelcius = approxTemp; + break; + } + case(Max31865Definitions::REQUEST_FAULT_BYTE): { + faultByte = packet[1]; #if OBSW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Fault byte" - " is: 0b" << std::bitset < 8 > (faultByte) << std::endl; + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Fault byte" + " is: 0b" << std::bitset<8>(faultByte) << std::endl; #else - sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte" - " is: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(faultByte)); + sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte" + " is: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(faultByte)); #endif #endif - ReturnValue_t result = sensorDataset.read(); - if (result != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + ReturnValue_t result = sensorDataset.read(); + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!" << std::endl; + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex + << this->getObjectId() << ":" + "Error reading dataset!" << std::endl; #else - sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!\n"); + sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " + "Error reading dataset!\n"); #endif - return result; - } - sensorDataset.errorByte.setValid(true); - sensorDataset.errorByte = faultByte; - if (faultByte != 0) { - sensorDataset.temperatureCelcius.setValid(false); - } + return result; + } + sensorDataset.errorByte.setValid(true); + sensorDataset.errorByte = faultByte; + if(faultByte != 0) { + sensorDataset.temperatureCelcius.setValid(false); + } - result = sensorDataset.commit(); - if (result != HasReturnvaluesIF::RETURN_OK) { - // Configuration error + result = sensorDataset.commit(); + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " - "Error commiting dataset!" << std::endl; + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex + << this->getObjectId() << ": Error commiting dataset!" << std::endl; #else - sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " - "Error commiting dataset!\n"); + sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " + "Error commiting dataset!\n"); #endif - return result; - } + return result; + } - break; - } - default: - break; - } - return HasReturnvaluesIF::RETURN_OK; + break; + } + default: + break; + } + return HasReturnvaluesIF::RETURN_OK; } -void Max31865PT1000Handler::debugInterface(uint8_t positionTracker, object_id_t objectId, - uint32_t parameter) { +void Max31865PT1000Handler::debugInterface(uint8_t positionTracker, + object_id_t objectId, uint32_t parameter) { } -uint32_t Max31865PT1000Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { - return 25000; +uint32_t Max31865PT1000Handler::getTransitionDelayMs( + Mode_t modeFrom, Mode_t modeTo) { + return 25000; } -ReturnValue_t Max31865PT1000Handler::getSwitches(const uint8_t **switches, - uint8_t *numberOfSwitches) { - return DeviceHandlerBase::NO_SWITCH; +ReturnValue_t Max31865PT1000Handler::getSwitches( + const uint8_t **switches, uint8_t *numberOfSwitches) { + return DeviceHandlerBase::NO_SWITCH; } -void Max31865PT1000Handler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { - DeviceHandlerBase::doTransition(modeFrom, subModeFrom); +void Max31865PT1000Handler::doTransition(Mode_t modeFrom, + Submode_t subModeFrom) { + DeviceHandlerBase::doTransition(modeFrom, subModeFrom); } ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry( { 0 })); - localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C, - new PoolEntry( { 0 }, 1, true)); - localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, - new PoolEntry( { 0 })); + LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry({0})); + localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C, + new PoolEntry({0}, 1, true)); + localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, + new PoolEntry({0})); // poolManager.subscribeForPeriodicPacket(sensorDatasetSid, // false, 4.0, false); - return HasReturnvaluesIF::RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } void Max31865PT1000Handler::modeChanged() { -// internalState = InternalState::NONE; + internalState = InternalState::NONE; } diff --git a/mission/devices/Max31865PT1000Handler.h b/mission/devices/Max31865PT1000Handler.h index 51cc04eb..b33ddbe0 100644 --- a/mission/devices/Max31865PT1000Handler.h +++ b/mission/devices/Max31865PT1000Handler.h @@ -37,7 +37,7 @@ public: // 1. 1 for V_BIAS enabled, 0 for disabled // 2. 1 for Auto-conversion, 0 for off // 3. 1 for 1-shot enabled, 0 for disabled (self-clearing bit) - // 4. 1 for 3-wire disabled, 0 for disabled + // 4. 1 for 3-wire enabled, 0 for disabled (two and four wired RTD) // 5./6. Fault detection: 00 for no action, 01 for automatic delay, 1 // 0 for run fault detection with manual delay, // 11 for finish fault detection with manual delay @@ -99,7 +99,7 @@ private: REQUEST_FAULT_BYTE }; - InternalState internalState = InternalState::CONFIGURE; + InternalState internalState = InternalState::NONE; bool commandExecuted = false; dur_millis_t startTime = 0; -- 2.43.0 From 3144514338be6326ffbaafafa955242b5bd9b274 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Tue, 19 Oct 2021 19:19:57 +0200 Subject: [PATCH 3/7] rtd debugging, changed spi modes --- bsp_q7s/core/ObjectFactory.cpp | 33 ++++----- bsp_q7s/gpio/gpioCallbacks.cpp | 11 +++ common/config/devConf.h | 1 + .../pollingSequenceFactory.cpp | 68 +++++++++---------- 4 files changed, 63 insertions(+), 50 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index b82ba2c5..3fbba3d3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -270,6 +270,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { spi::DEFAULT_MAX_1227_SPEED); RadiationSensorHandler* radsensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); radsensor->setStartUpImmediately(); + static_cast(radsensor); } void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComIF* spiComIF) { @@ -694,45 +695,45 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) { gpioComIF->addGpios(rtdGpioCookie); SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV, - Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16, std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF, diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index 6d3dca93..38c5b46e 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -35,6 +35,17 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); + +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", +// gpio::OUT, gpio::LOW); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); +// /** Setting mux bit 2 to low disables IC1 on the TCS board */ +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); +// /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); + /** The following gpios can take arbitrary initial values */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); diff --git a/common/config/devConf.h b/common/config/devConf.h index fbd9763b..3fbded81 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -33,6 +33,7 @@ static constexpr uint32_t RW_SPEED = 300'000; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; static constexpr uint32_t RTD_SPEED = 2'000'000; +static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3; } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 257dd650..9af2293a 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, @@ -500,39 +500,39 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ -- 2.43.0 From 608644f5f12ccb7dc359d1943a1bc0756837a5d3 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 18:43:01 +0200 Subject: [PATCH 4/7] fixed merge conflicts --- bsp_hosted/fsfwconfig/fsfwconfig.mk | 7 ++ bsp_q7s/callbacks/rwSpiCallback.cpp | 8 +- linux/fsfwconfig/tmtc/apid.h | 19 +++++ tmtc | 2 +- unittest/testcfg/CMakeLists.txt | 9 +++ unittest/testcfg/FSFWConfig.h.in | 81 +++++++++++++++++++ unittest/testcfg/OBSWConfig.h.in | 8 ++ unittest/testcfg/TestsConfig.h.in | 21 +++++ unittest/testcfg/devices/logicalAddresses.cpp | 5 ++ unittest/testcfg/devices/logicalAddresses.h | 15 ++++ .../testcfg/devices/powerSwitcherList.cpp | 4 + unittest/testcfg/devices/powerSwitcherList.h | 12 +++ unittest/testcfg/events/subsystemIdRanges.h | 19 +++++ unittest/testcfg/ipc/MissionMessageTypes.cpp | 12 +++ unittest/testcfg/ipc/MissionMessageTypes.h | 22 +++++ unittest/testcfg/objects/systemObjectList.h | 33 ++++++++ .../PollingSequenceFactory.cpp | 39 +++++++++ .../pollingsequence/PollingSequenceFactory.h | 32 ++++++++ unittest/testcfg/returnvalues/classIds.h | 17 ++++ unittest/testcfg/tmtc/apid.h | 18 +++++ unittest/testcfg/tmtc/pusIds.h | 25 ++++++ unittest/unittest.mk | 0 22 files changed, 403 insertions(+), 5 deletions(-) create mode 100644 bsp_hosted/fsfwconfig/fsfwconfig.mk create mode 100644 linux/fsfwconfig/tmtc/apid.h create mode 100644 unittest/testcfg/CMakeLists.txt create mode 100644 unittest/testcfg/FSFWConfig.h.in create mode 100644 unittest/testcfg/OBSWConfig.h.in create mode 100644 unittest/testcfg/TestsConfig.h.in create mode 100644 unittest/testcfg/devices/logicalAddresses.cpp create mode 100644 unittest/testcfg/devices/logicalAddresses.h create mode 100644 unittest/testcfg/devices/powerSwitcherList.cpp create mode 100644 unittest/testcfg/devices/powerSwitcherList.h create mode 100644 unittest/testcfg/events/subsystemIdRanges.h create mode 100644 unittest/testcfg/ipc/MissionMessageTypes.cpp create mode 100644 unittest/testcfg/ipc/MissionMessageTypes.h create mode 100644 unittest/testcfg/objects/systemObjectList.h create mode 100644 unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp create mode 100644 unittest/testcfg/pollingsequence/PollingSequenceFactory.h create mode 100644 unittest/testcfg/returnvalues/classIds.h create mode 100644 unittest/testcfg/tmtc/apid.h create mode 100644 unittest/testcfg/tmtc/pusIds.h create mode 100644 unittest/unittest.mk diff --git a/bsp_hosted/fsfwconfig/fsfwconfig.mk b/bsp_hosted/fsfwconfig/fsfwconfig.mk new file mode 100644 index 00000000..53cb0fc7 --- /dev/null +++ b/bsp_hosted/fsfwconfig/fsfwconfig.mk @@ -0,0 +1,7 @@ +CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp) +CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp) +CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) +CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) +CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) + +INCLUDES += $(CURRENTPATH) \ No newline at end of file diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index f15e9a55..620f63f7 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -40,10 +40,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl; return SpiComIF::OPENING_FILE_FAILED; } -// spi::SpiModes spiMode = spi::SpiModes::MODE_0; -// uint32_t spiSpeed = 0; -// cookie->getSpiParameters(spiMode, spiSpeed, nullptr); -// comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); + spi::SpiModes spiMode = spi::SpiModes::MODE_0; + uint32_t spiSpeed = 0; + cookie->getSpiParameters(spiMode, spiSpeed, nullptr); + comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); result = mutex->lockMutex(timeoutType, timeoutMs); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/linux/fsfwconfig/tmtc/apid.h b/linux/fsfwconfig/tmtc/apid.h new file mode 100644 index 00000000..00aabee1 --- /dev/null +++ b/linux/fsfwconfig/tmtc/apid.h @@ -0,0 +1,19 @@ +#ifndef FSFWCONFIG_TMTC_APID_H_ +#define FSFWCONFIG_TMTC_APID_H_ + +#include + +/** + * Application Process Definition: entity, uniquely identified by an + * application process ID (APID), capable of generating telemetry source + * packets and receiving telecommand packets + * + * EIVE APID: 0x65 / 101 / e + * APID is a 11 bit number + */ +namespace apid { + static const uint16_t EIVE_OBSW = 0x65; +} + + +#endif /* FSFWCONFIG_TMTC_APID_H_ */ diff --git a/tmtc b/tmtc index b2cc2354..223ef1b8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b2cc2354d410b0bc0d80c481bfd37afc580e63cf +Subproject commit 223ef1b833953960f751b73f011d71ad5ca988e7 diff --git a/unittest/testcfg/CMakeLists.txt b/unittest/testcfg/CMakeLists.txt new file mode 100644 index 00000000..50d13663 --- /dev/null +++ b/unittest/testcfg/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${TARGET_NAME} PRIVATE + ipc/MissionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp +) + +# Add include paths for the executable +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/unittest/testcfg/FSFWConfig.h.in b/unittest/testcfg/FSFWConfig.h.in new file mode 100644 index 00000000..d2ed901d --- /dev/null +++ b/unittest/testcfg/FSFWConfig.h.in @@ -0,0 +1,81 @@ +#ifndef CONFIG_FSFWCONFIG_H_ +#define CONFIG_FSFWCONFIG_H_ + +#include +#include + +//! Used to determine whether C++ ostreams are used which can increase +//! the binary size significantly. If this is disabled, +//! the C stdio functions can be used alternatively +#define FSFW_CPP_OSTREAM_ENABLED 1 + +//! More FSFW related printouts. Useful for development. +#define FSFW_ENHANCED_PRINTOUT 0 + +//! Can be used to completely disable printouts, even the C stdio ones. +//! By default, printouts will be disabled for the unit tests. +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 + #ifndef FSFW_DISABLE_PRINTOUT + #define FSFW_DISABLE_PRINTOUT 1 + #endif +#endif + +#define FSFW_USE_PUS_C_TELEMETRY 1 +#define FSFW_USE_PUS_C_TELECOMMANDS 1 + +//! Can be used to enable additional debugging printouts for developing the FSFW +#define FSFW_PRINT_VERBOSITY_LEVEL 0 + +//! Can be used to disable the ANSI color sequences for C stdio. +#define FSFW_COLORED_OUTPUT 0 + +//! If FSFW_OBJ_EVENT_TRANSLATION is set to one, +//! additional output which requires the translation files translateObjects +//! and translateEvents (and their compiled source files) +#define FSFW_OBJ_EVENT_TRANSLATION 0 + +#if FSFW_OBJ_EVENT_TRANSLATION == 1 +//! Specify whether info events are printed too. +#define FSFW_DEBUG_INFO 1 +#include "objects/translateObjects.h" +#include "events/translateEvents.h" +#else +#endif + +//! When using the newlib nano library, C99 support for stdio facilities +//! will not be provided. This define should be set to 1 if this is the case. +#define FSFW_NO_C99_IO 1 + +//! Specify whether a special mode store is used for Subsystem components. +#define FSFW_USE_MODESTORE 0 + +//! Defines if the real time scheduler for linux should be used. +//! If set to 0, this will also disable priority settings for linux +//! as most systems will not allow to set nice values without privileges +//! For embedded linux system set this to 1. +//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run +#define FSFW_USE_REALTIME_FOR_LINUX 1 + +namespace fsfwconfig { +//! Default timestamp size. The default timestamp will be an eight byte CDC +//! short timestamp. +static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8; + +//! Configure the allocated pool sizes for the event manager. +static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; +static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; +static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; + +//! Defines the FIFO depth of each commanding service base which +//! also determines how many commands a CSB service can handle in one cycle +//! simulataneously. This will increase the required RAM for +//! each CSB service ! +static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; + +static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; + +static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500; + +} + +#endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/unittest/testcfg/OBSWConfig.h.in b/unittest/testcfg/OBSWConfig.h.in new file mode 100644 index 00000000..34eda31f --- /dev/null +++ b/unittest/testcfg/OBSWConfig.h.in @@ -0,0 +1,8 @@ +#ifndef TESTCFG_OBSWCONFIG_H_ +#define TESTCFG_OBSWCONFIG_H_ + + + + + +#endif /* TESTCFG_OBSWCONFIG_H_ */ diff --git a/unittest/testcfg/TestsConfig.h.in b/unittest/testcfg/TestsConfig.h.in new file mode 100644 index 00000000..7d950070 --- /dev/null +++ b/unittest/testcfg/TestsConfig.h.in @@ -0,0 +1,21 @@ +#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ +#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ + +#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1 + +#ifdef __cplusplus + +#include "objects/systemObjectList.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + +namespace config { +#endif + +/* Add mission configuration flags here */ + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */ diff --git a/unittest/testcfg/devices/logicalAddresses.cpp b/unittest/testcfg/devices/logicalAddresses.cpp new file mode 100644 index 00000000..c7ce314d --- /dev/null +++ b/unittest/testcfg/devices/logicalAddresses.cpp @@ -0,0 +1,5 @@ +#include "logicalAddresses.h" + + + + diff --git a/unittest/testcfg/devices/logicalAddresses.h b/unittest/testcfg/devices/logicalAddresses.h new file mode 100644 index 00000000..cdf87025 --- /dev/null +++ b/unittest/testcfg/devices/logicalAddresses.h @@ -0,0 +1,15 @@ +#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_ +#define CONFIG_DEVICES_LOGICALADDRESSES_H_ + +#include +#include +#include + +namespace addresses { + /* Logical addresses have uint32_t datatype */ + enum logicalAddresses: address_t { + }; +} + + +#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */ diff --git a/unittest/testcfg/devices/powerSwitcherList.cpp b/unittest/testcfg/devices/powerSwitcherList.cpp new file mode 100644 index 00000000..343f78d0 --- /dev/null +++ b/unittest/testcfg/devices/powerSwitcherList.cpp @@ -0,0 +1,4 @@ +#include "powerSwitcherList.h" + + + diff --git a/unittest/testcfg/devices/powerSwitcherList.h b/unittest/testcfg/devices/powerSwitcherList.h new file mode 100644 index 00000000..86ddea57 --- /dev/null +++ b/unittest/testcfg/devices/powerSwitcherList.h @@ -0,0 +1,12 @@ +#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_ +#define CONFIG_DEVICES_POWERSWITCHERLIST_H_ + +namespace switches { + /* Switches are uint8_t datatype and go from 0 to 255 */ + enum switcherList { + }; + +} + + +#endif /* CONFIG_DEVICES_POWERSWITCHERLIST_H_ */ diff --git a/unittest/testcfg/events/subsystemIdRanges.h b/unittest/testcfg/events/subsystemIdRanges.h new file mode 100644 index 00000000..26af041e --- /dev/null +++ b/unittest/testcfg/events/subsystemIdRanges.h @@ -0,0 +1,19 @@ +#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ +#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ + +#include +#include "commonSubsystemIds.h" +#include + +/** + * @brief Custom subsystem IDs can be added here + * @details + * Subsystem IDs are used to create unique events. + */ +namespace SUBSYSTEM_ID { +enum: uint8_t { + SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE, +}; +} + +#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */ diff --git a/unittest/testcfg/ipc/MissionMessageTypes.cpp b/unittest/testcfg/ipc/MissionMessageTypes.cpp new file mode 100644 index 00000000..d68cb58c --- /dev/null +++ b/unittest/testcfg/ipc/MissionMessageTypes.cpp @@ -0,0 +1,12 @@ +#include "MissionMessageTypes.h" + +#include + +void messagetypes::clearMissionMessage(CommandMessage* message) { + switch(message->getMessageType()) { + default: + break; + } +} + + diff --git a/unittest/testcfg/ipc/MissionMessageTypes.h b/unittest/testcfg/ipc/MissionMessageTypes.h new file mode 100644 index 00000000..832d8e58 --- /dev/null +++ b/unittest/testcfg/ipc/MissionMessageTypes.h @@ -0,0 +1,22 @@ +#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_ +#define CONFIG_IPC_MISSIONMESSAGETYPES_H_ + +#include + +class CommandMessage; + +/** + * Custom command messages are specified here. + * Most messages needed to use FSFW are already located in + * + * @param message Generic Command Message + */ +namespace messagetypes{ +enum MESSAGE_TYPE { + MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT, +}; + +void clearMissionMessage(CommandMessage* message); +} + +#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */ diff --git a/unittest/testcfg/objects/systemObjectList.h b/unittest/testcfg/objects/systemObjectList.h new file mode 100644 index 00000000..9ed43873 --- /dev/null +++ b/unittest/testcfg/objects/systemObjectList.h @@ -0,0 +1,33 @@ +#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ +#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ + +#include +#include "commonObjects.h" +#include + +// The objects will be instantiated in the ID order +namespace objects { + enum sourceObjects: uint32_t { + /* All addresses between start and end are reserved for the FSFW */ + FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION, + FSFW_CONFIG_RESERVED_END = TM_STORE, + + CCSDS_DISTRIBUTOR = 10, + PUS_DISTRIBUTOR = 11, + TM_FUNNEL = 12, + + UDP_BRIDGE = 15, + UDP_POLLING_TASK = 16, + + TEST_ECHO_COM_IF = 20, + TEST_DEVICE = 21, + + HK_RECEIVER_MOCK = 22, + TEST_LOCAL_POOL_OWNER_BASE = 25, + + SHARED_SET_ID = 26 + + }; +} + +#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ diff --git a/unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp b/unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp new file mode 100644 index 00000000..e3ee874a --- /dev/null +++ b/unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp @@ -0,0 +1,39 @@ +#include "PollingSequenceFactory.h" + +#include + +#include +#include +#include + +ReturnValue_t pst::pollingSequenceInitDefault( + FixedTimeslotTaskIF *thisSequence) { + /* Length of a communication cycle */ + uint32_t length = thisSequence->getPeriodMs(); + + /* Add polling sequence table here */ + thisSequence->addSlot(objects::TEST_DEVICE, 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TEST_DEVICE, 0.3, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length, + DeviceHandlerIF::GET_READ); + + if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { + return HasReturnvaluesIF::RETURN_OK; + } + else { +#if FSFW_CPP_OSTREAM_ENABLED + sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" + << std::endl; +#else + sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!"); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } +} + diff --git a/unittest/testcfg/pollingsequence/PollingSequenceFactory.h b/unittest/testcfg/pollingsequence/PollingSequenceFactory.h new file mode 100644 index 00000000..c5d41b7d --- /dev/null +++ b/unittest/testcfg/pollingsequence/PollingSequenceFactory.h @@ -0,0 +1,32 @@ +#ifndef POLLINGSEQUENCEFACTORY_H_ +#define POLLINGSEQUENCEFACTORY_H_ + +#include + +class FixedTimeslotTaskIF; + +/** + * All device handlers are scheduled by adding them into Polling Sequence Tables (PST) + * to satisfy stricter timing requirements of device communication, + * A device handler has four different communication steps: + * 1. DeviceHandlerIF::SEND_WRITE -> Send write via interface + * 2. DeviceHandlerIF::GET_WRITE -> Get confirmation for write + * 3. DeviceHandlerIF::SEND_READ -> Send read request + * 4. DeviceHandlerIF::GET_READ -> Read from interface + * The PST specifies precisely when the respective ComIF functions are called + * during the communication cycle time. + * The task is created using the FixedTimeslotTaskIF, + * which utilises the underlying Operating System Abstraction Layer (OSAL) + * + * @param thisSequence FixedTimeslotTaskIF * object is passed inside the Factory class when creating the PST + * @return + */ +namespace pst { + +/* Default PST */ +ReturnValue_t pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence); + + +} + +#endif /* POLLINGSEQUENCEINIT_H_ */ diff --git a/unittest/testcfg/returnvalues/classIds.h b/unittest/testcfg/returnvalues/classIds.h new file mode 100644 index 00000000..7a292708 --- /dev/null +++ b/unittest/testcfg/returnvalues/classIds.h @@ -0,0 +1,17 @@ +#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ +#define CONFIG_RETURNVALUES_CLASSIDS_H_ + +#include "commonClassIds.h" +#include + +/** + * @brief CLASS_ID defintions which are required for custom returnvalues. + */ +namespace CLASS_ID { +enum { + MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT, +}; +} + + +#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */ diff --git a/unittest/testcfg/tmtc/apid.h b/unittest/testcfg/tmtc/apid.h new file mode 100644 index 00000000..0172f6e3 --- /dev/null +++ b/unittest/testcfg/tmtc/apid.h @@ -0,0 +1,18 @@ +#ifndef CONFIG_TMTC_APID_H_ +#define CONFIG_TMTC_APID_H_ + +#include + +/** + * Application Process Definition: entity, uniquely identified by an + * application process ID (APID), capable of generating telemetry source + * packets and receiving telecommand packets. + * + * Chose APID(s) for mission and define it here. + */ +namespace apid { + static const uint16_t EIVE_OBSW = 0x65; +} + + +#endif /* CONFIG_TMTC_APID_H_ */ diff --git a/unittest/testcfg/tmtc/pusIds.h b/unittest/testcfg/tmtc/pusIds.h new file mode 100644 index 00000000..821a9982 --- /dev/null +++ b/unittest/testcfg/tmtc/pusIds.h @@ -0,0 +1,25 @@ +#ifndef CONFIG_TMTC_PUSIDS_HPP_ +#define CONFIG_TMTC_PUSIDS_HPP_ + +#include + +namespace pus { +enum Ids: uint8_t { + PUS_SERVICE_1 = 1, + PUS_SERVICE_2 = 2, + PUS_SERVICE_3 = 3, + PUS_SERVICE_5 = 5, + PUS_SERVICE_6 = 6, + PUS_SERVICE_8 = 8, + PUS_SERVICE_9 = 9, + PUS_SERVICE_11 = 11, + PUS_SERVICE_17 = 17, + PUS_SERVICE_19 = 19, + PUS_SERVICE_20 = 20, + PUS_SERVICE_23 = 23, + PUS_SERVICE_200 = 200, + PUS_SERVICE_201 = 201, +}; +}; + +#endif /* CONFIG_TMTC_PUSIDS_HPP_ */ diff --git a/unittest/unittest.mk b/unittest/unittest.mk new file mode 100644 index 00000000..e69de29b -- 2.43.0 From 38d863634493f5bc162acea2df78a2e25d1b0435 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 18:52:36 +0200 Subject: [PATCH 5/7] commented in acs devices --- .../pollingSequenceFactory.cpp | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 9af2293a..73a27116 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -500,39 +500,39 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ -- 2.43.0 From 1725b9821bc84f48d44a6467985450768281fb6a Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 18:54:25 +0200 Subject: [PATCH 6/7] removed inadvertend added fsfwconfig.mk --- bsp_hosted/fsfwconfig/fsfwconfig.mk | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 bsp_hosted/fsfwconfig/fsfwconfig.mk diff --git a/bsp_hosted/fsfwconfig/fsfwconfig.mk b/bsp_hosted/fsfwconfig/fsfwconfig.mk deleted file mode 100644 index 53cb0fc7..00000000 --- a/bsp_hosted/fsfwconfig/fsfwconfig.mk +++ /dev/null @@ -1,7 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) - -INCLUDES += $(CURRENTPATH) \ No newline at end of file -- 2.43.0 From b2f37f8d2ece0b0a4ae7f0dee1e34ecc54145aab Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 18:54:47 +0200 Subject: [PATCH 7/7] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 223ef1b8..b2cc2354 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 223ef1b833953960f751b73f011d71ad5ca988e7 +Subproject commit b2cc2354d410b0bc0d80c481bfd37afc580e63cf -- 2.43.0