From a1409fbcdf724ed8d3b136f0fd6d5933873660ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 17:13:06 +0100 Subject: [PATCH 1/7] update SuS code --- bsp_q7s/core/InitMission.cpp | 2 +- bsp_q7s/core/ObjectFactory.cpp | 25 ++-- fsfw | 2 +- linux/devices/SusHandler.cpp | 154 +++++++++---------------- linux/devices/SusHandler.h | 13 ++- linux/fsfwconfig/OBSWConfig.h.in | 1 - linux/fsfwconfig/devices/addresses.cpp | 6 - 7 files changed, 75 insertions(+), 128 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 81f9f361..c4e3805d 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -266,7 +266,7 @@ void initmission::createPstTasks(TaskFactory& factory, sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl; } taskVec.push_back(gomSpacePstTask); -#else /* BOARD_TE7020 == 0 */ +#else /* BOARD_TE7020 == 0 */ FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask( "PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc); result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e2c5cbf4..2283952f 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -347,17 +347,17 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI gpioComIF->addGpios(gpioCookieSus); SpiCookie* spiCookie = - new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, std::string(q7s::SPI_DEFAULT_DEV), - SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); + new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, + spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler0 = new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_0); - spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_1); - spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_2); @@ -377,34 +377,33 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI SusHandler* susHandler5 = new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_5); - spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler6 = new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_6); - spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler7 = new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_7); - spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_8); - spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler9 = new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_9); - spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_10, std::string(q7s::SPI_DEFAULT_DEV), + spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler10 = new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_10); - spiCookie = - new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, std::string(q7s::SPI_DEFAULT_DEV), - SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); + spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV, + SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ); SusHandler* susHandler11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_11); static_cast(susHandler0); @@ -419,7 +418,7 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI static_cast(susHandler9); static_cast(susHandler10); static_cast(susHandler11); -#if OBSW_TEST_SUS == 1 +#if OBSW_TEST_SUS_HANDLER == 1 susHandler0->setStartUpImmediately(); susHandler1->setStartUpImmediately(); susHandler2->setStartUpImmediately(); diff --git a/fsfw b/fsfw index 32a9e0c7..81f5b0c3 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 32a9e0c7044665f0265c10108c8d62d45c047769 +Subproject commit 81f5b0c3bf3e602f5cc459dc39bc1e8885c932a7 diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index 452d7a25..e1cf4d18 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -9,39 +9,11 @@ SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCoo LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId) : DeviceHandlerBase(objectId, comIF, comCookie), divider(5), - gpioComIF(gpioComIF), - chipSelectId(chipSelectId), dataset(this) { - if (comCookie == nullptr) { - sif::error << "SusHandler: Invalid com cookie" << std::endl; - } - if (gpioComIF == nullptr) { - sif::error << "SusHandler: Invalid GpioComIF" << std::endl; - } } SusHandler::~SusHandler() {} -ReturnValue_t SusHandler::performOperation(uint8_t counter) { - if (counter != FIRST_WRITE) { - DeviceHandlerBase::performOperation(counter); - return RETURN_OK; - } - - if (mode != MODE_NORMAL) { - DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE); - return RETURN_OK; - } - - /* If device is in normale mode the communication sequence is initiated here */ - if (communicationStep == CommunicationStep::IDLE) { - communicationStep = CommunicationStep::WRITE_SETUP; - } - - DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE); - - return RETURN_OK; -} ReturnValue_t SusHandler::initialize() { ReturnValue_t result = RETURN_OK; @@ -49,48 +21,57 @@ ReturnValue_t SusHandler::initialize() { if (result != RETURN_OK) { return result; } - auto spiComIF = dynamic_cast(communicationInterface); - if (spiComIF == nullptr) { - sif::debug << "SusHandler::initialize: Invalid communication interface" << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; - } - spiMutex = spiComIF->getMutex(); - if (spiMutex == nullptr) { - sif::debug << "SusHandler::initialize: Failed to get spi mutex" << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; - } return RETURN_OK; } void SusHandler::doStartUp() { + if (comState == ComStates::IDLE) { + comState = ComStates::WRITE_SETUP; + } + if(comState == ComStates::WRITE_SETUP) { + if (commandExecuted) { #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 - setMode(MODE_NORMAL); + setMode(MODE_NORMAL); #else - setMode(_MODE_TO_ON); + setMode(_MODE_TO_ON); #endif + commandExecuted = false; + comState = ComStates::START_CONVERSIONS; + } + } } void SusHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { - if (communicationStep == CommunicationStep::IDLE) { - return NOTHING_TO_SEND; + switch (comState) { + case (ComStates::IDLE): { + return NOTHING_TO_SEND; + } + case (ComStates::WRITE_SETUP): { + *id = SUS::WRITE_SETUP; + comState = ComStates::START_CONVERSIONS; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (ComStates::START_CONVERSIONS): { + *id = SUS::START_CONVERSIONS; + comState = ComStates::READ_CONVERSIONS; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (ComStates::READ_CONVERSIONS): { + *id = SUS::READ_CONVERSIONS; + comState = ComStates::START_CONVERSIONS; + return buildCommandFromCommand(*id, nullptr, 0); + } } - - if (communicationStep == CommunicationStep::WRITE_SETUP) { - *id = SUS::WRITE_SETUP; - communicationStep = CommunicationStep::START_CONVERSIONS; - } else if (communicationStep == CommunicationStep::START_CONVERSIONS) { - *id = SUS::START_CONVERSIONS; - communicationStep = CommunicationStep::READ_CONVERSIONS; - } else if (communicationStep == CommunicationStep::READ_CONVERSIONS) { - *id = SUS::READ_CONVERSIONS; - communicationStep = CommunicationStep::IDLE; - } - return buildCommandFromCommand(*id, nullptr, 0); + return NOTHING_TO_SEND; } ReturnValue_t SusHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + if (comState == ComStates::WRITE_SETUP) { + *id = SUS::WRITE_SETUP; + return buildCommandFromCommand(*id, nullptr, 0); + } return HasReturnvaluesIF::RETURN_OK; } @@ -99,27 +80,6 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman size_t commandDataLen) { switch (deviceCommand) { case (SUS::WRITE_SETUP): { - /** - * The sun sensor ADC is shutdown when CS is pulled high, so each time requesting a - * measurement the setup has to be rewritten. There must also be a little delay between - * the transmission of the setup byte and the first conversion. Thus the conversion - * will be performed in an extra step. - * Because the chip select is driven manually by the SusHandler the SPI bus must be - * protected with a mutex here. - */ - ReturnValue_t result = spiMutex->lockMutex(timeoutType, timeoutMs); - if (result == MutexIF::MUTEX_TIMEOUT) { - sif::error << "SusHandler::buildCommandFromCommand: Mutex timeout" << std::endl; - return ERROR_LOCK_MUTEX; - } else if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "SusHandler::buildCommandFromCommand: Failed to lock spi mutex" << std::endl; - return ERROR_LOCK_MUTEX; - } - - result = gpioComIF->pullLow(chipSelectId); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } cmdBuffer[0] = SUS::SETUP; rawPacket = cmdBuffer; rawPacketLen = 1; @@ -145,8 +105,8 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman } void SusHandler::fillCommandAndReplyMap() { - this->insertInCommandMap(SUS::WRITE_SETUP); - this->insertInCommandMap(SUS::START_CONVERSIONS); + this->insertInCommandAndReplyMap(SUS::WRITE_SETUP, 1); + this->insertInCommandAndReplyMap(SUS::START_CONVERSIONS, 1); this->insertInCommandAndReplyMap(SUS::READ_CONVERSIONS, 1, &dataset, SUS::SIZE_READ_CONVERSIONS); } @@ -159,6 +119,15 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSiz ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { switch (id) { + case SUS::WRITE_SETUP: { + if (mode == _MODE_START_UP) { + commandExecuted = true; + } + return HasReturnvaluesIF::RETURN_OK; + } + case SUS::START_CONVERSIONS: { + return HasReturnvaluesIF::RETURN_OK; + } case SUS::READ_CONVERSIONS: { PoolReadGuard readSet(&dataset); dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125; @@ -170,29 +139,16 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13)); #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 if (divider.checkAndIncrement()) { - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() - << ", Temperature: " << dataset.temperatureCelcius << " C" << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN0: " << std::dec - << dataset.ain0 << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN1: " << std::dec - << dataset.ain1 << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN2: " << std::dec - << dataset.ain2 << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN3: " << std::dec - << dataset.ain3 << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN4: " << std::dec - << dataset.ain4 << std::endl; - sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN5: " << std::dec - << dataset.ain5 << std::endl; + sif::info << "SUS object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; + sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl; + sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl; + sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl; + sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl; + sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl; + sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl; + sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl; } #endif - /** SUS can now be shutdown and thus the SPI bus released again */ - gpioComIF->pullHigh(chipSelectId); - ReturnValue_t result = spiMutex->unlockMutex(); - if (result != RETURN_OK) { - sif::error << "SusHandler::interpretDeviceReply: Failed to unlock spi mutex" << std::endl; - return ERROR_UNLOCK_MUTEX; - } break; } default: { @@ -203,8 +159,6 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 return HasReturnvaluesIF::RETURN_OK; } -void SusHandler::setNormalDatapoolEntriesInvalid() {} - uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; } ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, diff --git a/linux/devices/SusHandler.h b/linux/devices/SusHandler.h index 22daf2a7..b499e74b 100644 --- a/linux/devices/SusHandler.h +++ b/linux/devices/SusHandler.h @@ -28,7 +28,7 @@ class SusHandler : public DeviceHandlerBase { LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId); virtual ~SusHandler(); - virtual ReturnValue_t performOperation(uint8_t counter) override; + // virtual ReturnValue_t performOperation(uint8_t counter) override; virtual ReturnValue_t initialize() override; void setToGoToNormalMode(bool enable); @@ -44,7 +44,7 @@ class SusHandler : public DeviceHandlerBase { ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override; - void setNormalDatapoolEntriesInvalid() override; + //void setNormalDatapoolEntriesInvalid() override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; @@ -55,17 +55,18 @@ class SusHandler : public DeviceHandlerBase { static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1); - enum class CommunicationStep { IDLE, WRITE_SETUP, START_CONVERSIONS, READ_CONVERSIONS }; + enum class ComStates { IDLE, WRITE_SETUP, START_CONVERSIONS, READ_CONVERSIONS }; PeriodicOperationDivider divider; - LinuxLibgpioIF* gpioComIF = nullptr; + // LinuxLibgpioIF* gpioComIF = nullptr; bool goToNormalModeImmediately = false; - gpioId_t chipSelectId = gpio::NO_GPIO; + bool commandExecuted = false; + // gpioId_t chipSelectId = gpio::NO_GPIO; SUS::SusDataset dataset; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; - CommunicationStep communicationStep = CommunicationStep::IDLE; + ComStates comState = ComStates::IDLE; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; uint32_t timeoutMs = 20; diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index e9b053e5..fd5ae534 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -78,7 +78,6 @@ debugging. */ #define OBSW_TEST_LIBGPIOD 0 #define OBSW_TEST_RADIATION_SENSOR_HANDLER 0 -#define OBSW_TEST_SUS 0 #define OBSW_TEST_SUS_HANDLER 0 #define OBSW_TEST_PLOC_HANDLER 0 #define OBSW_TEST_BPX_BATT 0 diff --git a/linux/fsfwconfig/devices/addresses.cpp b/linux/fsfwconfig/devices/addresses.cpp index 60b1370b..580818e0 100644 --- a/linux/fsfwconfig/devices/addresses.cpp +++ b/linux/fsfwconfig/devices/addresses.cpp @@ -1,7 +1 @@ -/** - * \file logicalAddresses.cpp - * - * \date 06.11.2019 - */ - #include "addresses.h" From 1981be6e2f43de44d649ce862f696e22ba39bba6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 17:19:03 +0100 Subject: [PATCH 2/7] debug output --- linux/devices/SusHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index e1cf4d18..b65207e8 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -139,7 +139,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13)); #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 if (divider.checkAndIncrement()) { - sif::info << "SUS object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; + sif::info << "SUS Object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl; sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl; sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl; From 2a4905a1f7aeb0cec896e3cdf3bf21986c4715d2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 18:38:35 +0100 Subject: [PATCH 3/7] somethings still wrong --- bsp_q7s/boardconfig/busConf.h | 12 +- bsp_q7s/callbacks/gpioCallbacks.cpp | 170 +++++++++--------- linux/devices/SusHandler.cpp | 1 + linux/fsfwconfig/devices/gpioIds.h | 2 +- .../pollingSequenceFactory.cpp | 14 +- 5 files changed, 96 insertions(+), 103 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 2083ac6b..e517894a 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -54,12 +54,12 @@ static constexpr char HEATER_6[] = "heater6"; static constexpr char HEATER_7[] = "heater7"; static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0"; static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1"; -static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1"; -static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2"; -static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3"; -static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4"; -static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5"; -static constexpr char SPI_MUX_BIT_6_PIN[] = "spi_mux_bit_6"; +static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_1"; +static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_2"; +static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_3"; +static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_4"; +static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_5"; +static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_6"; static constexpr char EN_RW_CS[] = "en_rw_cs"; static constexpr char EN_RW_1[] = "enable_rw_1"; static constexpr char EN_RW_2[] = "enable_rw_2"; diff --git a/bsp_q7s/callbacks/gpioCallbacks.cpp b/bsp_q7s/callbacks/gpioCallbacks.cpp index e2dcc05f..8d75fb20 100644 --- a/bsp_q7s/callbacks/gpioCallbacks.cpp +++ b/bsp_q7s/callbacks/gpioCallbacks.cpp @@ -25,38 +25,28 @@ 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", + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1", + gpio::DIR_OUT, gpio::HIGH); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit); + /** Setting mux bit 2 to low disables IC1 on the TCS board */ + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2", gpio::DIR_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::DIR_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", + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3", gpio::DIR_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); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** The following gpios can take arbitrary initial values */ - spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4", + gpio::DIR_OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5", gpio::DIR_OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); - spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5", + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6", gpio::DIR_OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); - spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6", - gpio::DIR_OUT, gpio::LOW); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit); GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS, "EN_RW_CS", gpio::DIR_OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); @@ -307,45 +297,45 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev break; } case (gpioIds::CS_SUS_2): { - selectY0(); - enableDecoderInterfaceBoardIc2(); + selectY2(); + enableDecoderInterfaceBoardIc1(); break; } case (gpioIds::CS_SUS_3): { - selectY1(); - enableDecoderInterfaceBoardIc2(); + selectY3(); + enableDecoderInterfaceBoardIc1(); break; } case (gpioIds::CS_SUS_4): { - selectY2(); - enableDecoderInterfaceBoardIc2(); - break; - } - case (gpioIds::CS_SUS_5): { - selectY2(); - enableDecoderInterfaceBoardIc1(); - break; - } - case (gpioIds::CS_SUS_6): { - selectY3(); - enableDecoderInterfaceBoardIc1(); - break; - } - case (gpioIds::CS_SUS_7): { - selectY3(); - enableDecoderInterfaceBoardIc2(); - break; - } - case (gpioIds::CS_SUS_8): { selectY4(); enableDecoderInterfaceBoardIc1(); break; } - case (gpioIds::CS_SUS_9): { + case (gpioIds::CS_SUS_5): { selectY5(); enableDecoderInterfaceBoardIc1(); break; } + case (gpioIds::CS_SUS_6): { + selectY0(); + enableDecoderInterfaceBoardIc2(); + break; + } + case (gpioIds::CS_SUS_7): { + selectY1(); + enableDecoderInterfaceBoardIc2(); + break; + } + case (gpioIds::CS_SUS_8): { + selectY2(); + enableDecoderInterfaceBoardIc2(); + break; + } + case (gpioIds::CS_SUS_9): { + selectY3(); + enableDecoderInterfaceBoardIc2(); + break; + } case (gpioIds::CS_SUS_10): { selectY4(); enableDecoderInterfaceBoardIc2(); @@ -385,52 +375,52 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev } void enableDecoderTcsIc1() { - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); } void enableDecoderTcsIc2() { - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); +} + +void enableDecoderInterfaceBoardIc1() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); +} + +void enableDecoderInterfaceBoardIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); } -void enableDecoderInterfaceBoardIc1() { - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); -} - -void enableDecoderInterfaceBoardIc2() { - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - 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_0); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); } void disableDecoderTcsIc2() { + // DO NOT CHANGE THE ORDER HERE + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); 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_0); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); } void disableDecoderInterfaceBoardIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); } void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); } @@ -438,57 +428,57 @@ void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); } void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); } void selectY0() { + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6); } void selectY1() { - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6); } void selectY2() { - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); } void selectY3() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); } void selectY4() { + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); } void selectY5() { - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); } void selectY6() { - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); } void selectY7() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); } 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_0); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullLow(gpioIds::EN_RW_CS); } diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index b65207e8..9b529a6a 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -131,6 +131,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 case SUS::READ_CONVERSIONS: { PoolReadGuard readSet(&dataset); dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125; + //dataset.temperatureCelcius = ((packet[1] << 8) | packet[2]) * 0.125; dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3)); dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5)); dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7)); diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index 2556732b..0eaa8c14 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -67,12 +67,12 @@ enum gpioId_t { CS_SUS_10, CS_SUS_11, + SPI_MUX_BIT_0, SPI_MUX_BIT_1, SPI_MUX_BIT_2, SPI_MUX_BIT_3, SPI_MUX_BIT_4, SPI_MUX_BIT_5, - SPI_MUX_BIT_6, CS_RAD_SENSOR, diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 5dcc15a2..ed9a7892 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -162,8 +162,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool addSus5 = false; bool addSus6 = false; bool addSus7 = false; - bool addSus8 = true; - bool addSus9 = false; + bool addSus8 = false; + bool addSus9 = true; bool addSus10 = false; bool addSus11 = false; /** @@ -340,7 +340,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus8) { /* Write setup */ thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); + //thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ); @@ -361,18 +362,19 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus9) { /* Write setup */ thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); + //thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ - thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); + //thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ); /* Read ADC conversions */ - thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); + //thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ); From 84f77642d57645769c63acd5bf1badf7a0788150 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 18:41:46 +0100 Subject: [PATCH 4/7] sus 0 on now --- .../fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index ed9a7892..63658e55 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -154,7 +154,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #if OBSW_ADD_SUN_SENSORS == 1 - bool addSus0 = false; + bool addSus0 = true; bool addSus1 = false; bool addSus2 = false; bool addSus3 = false; @@ -163,7 +163,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool addSus6 = false; bool addSus7 = false; bool addSus8 = false; - bool addSus9 = true; + bool addSus9 = false; bool addSus10 = false; bool addSus11 = false; /** @@ -177,7 +177,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus0) { /* Write setup */ thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE); + //thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::GET_READ); From a38dd52d7bd3e1bf6e0526decda443319605259e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 18:42:46 +0100 Subject: [PATCH 5/7] no perform op --- linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 63658e55..c6ceaa0d 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -183,13 +183,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ - thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); + //thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::GET_READ); /* Read ADC conversions */ - thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); + //thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::SEND_READ); From 1fd7ba18e91c12ab358daa46bda7ab3fcad9c41e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 18:47:44 +0100 Subject: [PATCH 6/7] remove some code --- linux/devices/SusHandler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index 9b529a6a..b65207e8 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -131,7 +131,6 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 case SUS::READ_CONVERSIONS: { PoolReadGuard readSet(&dataset); dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125; - //dataset.temperatureCelcius = ((packet[1] << 8) | packet[2]) * 0.125; dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3)); dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5)); dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7)); From 938c361097dd42cbb17b9cd008d913487886b544 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Feb 2022 19:41:03 +0100 Subject: [PATCH 7/7] some minor fixes --- linux/devices/SusHandler.cpp | 128 ++++++++++++------ linux/devices/SusHandler.h | 25 +++- .../devicedefinitions/SusDefinitions.h | 17 ++- .../pollingSequenceFactory.cpp | 14 +- 4 files changed, 125 insertions(+), 59 deletions(-) diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index b65207e8..ae1663bc 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -1,20 +1,17 @@ #include "SusHandler.h" #include +#include #include #include "OBSWConfig.h" SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId) - : DeviceHandlerBase(objectId, comIF, comCookie), - divider(5), - dataset(this) { -} + : DeviceHandlerBase(objectId, comIF, comCookie), divider(5), dataset(this) {} SusHandler::~SusHandler() {} - ReturnValue_t SusHandler::initialize() { ReturnValue_t result = RETURN_OK; result = DeviceHandlerBase::initialize(); @@ -27,8 +24,9 @@ ReturnValue_t SusHandler::initialize() { void SusHandler::doStartUp() { if (comState == ComStates::IDLE) { comState = ComStates::WRITE_SETUP; + commandExecuted = false; } - if(comState == ComStates::WRITE_SETUP) { + if (comState == ComStates::WRITE_SETUP) { if (commandExecuted) { #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 setMode(MODE_NORMAL); @@ -36,7 +34,11 @@ void SusHandler::doStartUp() { setMode(_MODE_TO_ON); #endif commandExecuted = false; - comState = ComStates::START_CONVERSIONS; + if (clkMode == Modes::INT_CLOCKED) { + comState = ComStates::START_INT_CLOCKED_CONVERSIONS; + } else { + comState = ComStates::EXT_CLOCKED_CONVERSIONS; + } } } } @@ -50,17 +52,20 @@ ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { } case (ComStates::WRITE_SETUP): { *id = SUS::WRITE_SETUP; - comState = ComStates::START_CONVERSIONS; return buildCommandFromCommand(*id, nullptr, 0); } - case (ComStates::START_CONVERSIONS): { - *id = SUS::START_CONVERSIONS; - comState = ComStates::READ_CONVERSIONS; + case (ComStates::EXT_CLOCKED_CONVERSIONS): { + *id = SUS::READ_EXT_TIMED_CONVERSIONS; return buildCommandFromCommand(*id, nullptr, 0); } - case (ComStates::READ_CONVERSIONS): { - *id = SUS::READ_CONVERSIONS; - comState = ComStates::START_CONVERSIONS; + case (ComStates::START_INT_CLOCKED_CONVERSIONS): { + *id = SUS::START_INT_TIMED_CONVERSIONS; + comState = ComStates::READ_INT_CLOCKED_CONVERSIONS; + return buildCommandFromCommand(*id, nullptr, 0); + } + case (ComStates::READ_INT_CLOCKED_CONVERSIONS): { + *id = SUS::READ_INT_TIMED_CONVERSIONS; + comState = ComStates::START_INT_CLOCKED_CONVERSIONS; return buildCommandFromCommand(*id, nullptr, 0); } } @@ -80,22 +85,37 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman size_t commandDataLen) { switch (deviceCommand) { case (SUS::WRITE_SETUP): { - cmdBuffer[0] = SUS::SETUP; + if (clkMode == Modes::INT_CLOCKED) { + cmdBuffer[0] = SUS::SETUP_INT_CLOKED; + } else { + cmdBuffer[0] = SUS::SETUP_EXT_CLOCKED; + } + rawPacket = cmdBuffer; rawPacketLen = 1; return RETURN_OK; } - case (SUS::START_CONVERSIONS): { + case (SUS::START_INT_TIMED_CONVERSIONS): { std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); cmdBuffer[0] = SUS::CONVERSION; rawPacket = cmdBuffer; rawPacketLen = 2; return RETURN_OK; } - case (SUS::READ_CONVERSIONS): { + case (SUS::READ_INT_TIMED_CONVERSIONS): { std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); rawPacket = cmdBuffer; - rawPacketLen = SUS::SIZE_READ_CONVERSIONS; + rawPacketLen = SUS::SIZE_READ_INT_CONVERSIONS; + return RETURN_OK; + } + case (SUS::READ_EXT_TIMED_CONVERSIONS): { + std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); + rawPacket = cmdBuffer; + for (uint8_t idx = 0; idx < 6; idx++) { + cmdBuffer[idx * 2] = buildConvByte(ScanModes::N_ONCE, 0, false); + cmdBuffer[idx * 2 + 1] = 0; + } + rawPacketLen = SUS::SIZE_READ_EXT_CONVERSIONS; return RETURN_OK; } default: @@ -106,8 +126,11 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman void SusHandler::fillCommandAndReplyMap() { this->insertInCommandAndReplyMap(SUS::WRITE_SETUP, 1); - this->insertInCommandAndReplyMap(SUS::START_CONVERSIONS, 1); - this->insertInCommandAndReplyMap(SUS::READ_CONVERSIONS, 1, &dataset, SUS::SIZE_READ_CONVERSIONS); + this->insertInCommandAndReplyMap(SUS::START_INT_TIMED_CONVERSIONS, 1); + this->insertInCommandAndReplyMap(SUS::READ_INT_TIMED_CONVERSIONS, 1, &dataset, + SUS::SIZE_READ_INT_CONVERSIONS); + this->insertInCommandAndReplyMap(SUS::READ_EXT_TIMED_CONVERSIONS, 1, &dataset, + SUS::SIZE_READ_EXT_CONVERSIONS); } ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSize, @@ -119,16 +142,16 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSiz ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { switch (id) { - case SUS::WRITE_SETUP: { - if (mode == _MODE_START_UP) { - commandExecuted = true; - } - return HasReturnvaluesIF::RETURN_OK; - } - case SUS::START_CONVERSIONS: { - return HasReturnvaluesIF::RETURN_OK; - } - case SUS::READ_CONVERSIONS: { + case SUS::WRITE_SETUP: { + if (mode == _MODE_START_UP) { + commandExecuted = true; + } + return HasReturnvaluesIF::RETURN_OK; + } + case SUS::START_INT_TIMED_CONVERSIONS: { + return HasReturnvaluesIF::RETURN_OK; + } + case SUS::READ_INT_TIMED_CONVERSIONS: { PoolReadGuard readSet(&dataset); dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125; dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3)); @@ -137,18 +160,18 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 dataset.ain3 = (*(packet + 8) << 8 | *(packet + 9)); dataset.ain4 = (*(packet + 10) << 8 | *(packet + 11)); dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13)); -#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 - if (divider.checkAndIncrement()) { - sif::info << "SUS Object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; - sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl; - sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl; - sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl; - sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl; - sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl; - sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl; - sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl; - } -#endif + printDataset(); + break; + } + case (SUS::READ_EXT_TIMED_CONVERSIONS): { + PoolReadGuard readSet(&dataset); + dataset.ain0 = (packet[1] << 8) | packet[2]; + dataset.ain1 = (packet[3] << 8) | packet[4]; + dataset.ain2 = (packet[5] << 8) | packet[6]; + dataset.ain3 = (packet[7] << 8) | packet[8]; + dataset.ain4 = (packet[9] << 8) | packet[10]; + dataset.ain5 = (packet[11] << 8) | packet[12]; + printDataset(); break; } default: { @@ -159,7 +182,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 return HasReturnvaluesIF::RETURN_OK; } -uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; } +uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2000; } ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { @@ -174,3 +197,22 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData } void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; } + +uint8_t SusHandler::buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) { + return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp; +} + +void SusHandler::printDataset() { +#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 + if (divider.checkAndIncrement()) { + sif::info << "SUS Object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; + sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl; + sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl; + sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl; + sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl; + sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl; + sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl; + sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl; + } +#endif +} diff --git a/linux/devices/SusHandler.h b/linux/devices/SusHandler.h index b499e74b..15a4a8a8 100644 --- a/linux/devices/SusHandler.h +++ b/linux/devices/SusHandler.h @@ -22,6 +22,15 @@ */ class SusHandler : public DeviceHandlerBase { public: + enum Modes { INT_CLOCKED, EXT_CLOCKED }; + + enum ScanModes : uint8_t { + CHANNELS_0_TO_N = 0b00, + CHANNEL_N_TO_HIGHEST = 0b01, + N_REPEATEDLY = 0b10, + N_ONCE = 0b11 + }; + static const uint8_t FIRST_WRITE = 7; SusHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, @@ -44,32 +53,42 @@ class SusHandler : public DeviceHandlerBase { ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override; - //void setNormalDatapoolEntriesInvalid() override; + // void setNormalDatapoolEntriesInvalid() override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; + uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp); + private: static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER; static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1); - enum class ComStates { IDLE, WRITE_SETUP, START_CONVERSIONS, READ_CONVERSIONS }; + enum class ComStates { + IDLE, + WRITE_SETUP, + EXT_CLOCKED_CONVERSIONS, + START_INT_CLOCKED_CONVERSIONS, + READ_INT_CLOCKED_CONVERSIONS + }; PeriodicOperationDivider divider; // LinuxLibgpioIF* gpioComIF = nullptr; + // gpioId_t chipSelectId = gpio::NO_GPIO; bool goToNormalModeImmediately = false; bool commandExecuted = false; - // gpioId_t chipSelectId = gpio::NO_GPIO; SUS::SusDataset dataset; + Modes clkMode = Modes::INT_CLOCKED; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; ComStates comState = ComStates::IDLE; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; uint32_t timeoutMs = 20; + void printDataset(); MutexIF* spiMutex = nullptr; }; diff --git a/linux/devices/devicedefinitions/SusDefinitions.h b/linux/devices/devicedefinitions/SusDefinitions.h index 2a45ebc5..92a1881a 100644 --- a/linux/devices/devicedefinitions/SusDefinitions.h +++ b/linux/devices/devicedefinitions/SusDefinitions.h @@ -21,12 +21,14 @@ static const DeviceCommandId_t WRITE_SETUP = 0x1; * This command initiates the ADC conversion for all channels including the internal * temperature sensor. */ -static const DeviceCommandId_t START_CONVERSIONS = 0x2; +static const DeviceCommandId_t START_INT_TIMED_CONVERSIONS = 0x2; /** * This command reads the internal fifo which holds the temperature and the channel * conversions. */ -static const DeviceCommandId_t READ_CONVERSIONS = 0x3; +static constexpr DeviceCommandId_t READ_INT_TIMED_CONVERSIONS = 0x3; + +static constexpr DeviceCommandId_t READ_EXT_TIMED_CONVERSIONS = 0x4; /** * @brief This is the configuration byte which will be written to the setup register after @@ -39,7 +41,8 @@ static const DeviceCommandId_t READ_CONVERSIONS = 0x3; * written to the setup register * */ -static const uint8_t SETUP = 0b01101000; +static constexpr uint8_t SETUP_INT_CLOKED = 0b01101000; +static constexpr uint8_t SETUP_EXT_CLOCKED = 0b01111000; /** * @brief This values will always be written to the ADC conversion register to specify the @@ -51,12 +54,14 @@ static const uint8_t SETUP = 0b01101000; */ static const uint8_t CONVERSION = 0b10101001; -static const uint8_t SUS_DATA_SET_ID = READ_CONVERSIONS; +static const uint8_t SUS_DATA_SET_ID = READ_EXT_TIMED_CONVERSIONS; /** Size of data replies. Temperature and 6 channel convesions (AIN0 - AIN5) */ -static const uint8_t SIZE_READ_CONVERSIONS = 14; +static const uint8_t SIZE_READ_INT_CONVERSIONS = 14; +// 6 * conv byte, 6 * 0 and one trailing zero +static constexpr uint8_t SIZE_READ_EXT_CONVERSIONS = 13; -static const uint8_t MAX_CMD_SIZE = SIZE_READ_CONVERSIONS; +static const uint8_t MAX_CMD_SIZE = 16; static const uint8_t POOL_ENTRIES = 7; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index c6ceaa0d..31e22ecc 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -177,19 +177,19 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus0) { /* Write setup */ thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION); - //thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE); + // thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.933, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ - //thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::GET_READ); /* Read ADC conversions */ - //thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935, DeviceHandlerIF::SEND_READ); @@ -341,7 +341,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus8) { /* Write setup */ thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION); - //thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); + // thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ); @@ -363,19 +363,19 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus9) { /* Write setup */ thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); - //thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); + // thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ - //thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ); /* Read ADC conversions */ - //thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ);