diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index a84e314f..84c26605 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -588,8 +588,6 @@ void ObjectFactory::produce(void* args){ RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback, nullptr); auto rw4SpiCookie = new SpiCookie(addresses::RW4, gpioIds::CS_RW4, "/dev/spidev2.0", RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback, nullptr); - (void) rw3SpiCookie; - (void) rw4SpiCookie; auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1); @@ -599,9 +597,22 @@ void ObjectFactory::produce(void* args){ auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); - rwHandler2->setStartUpImmediately(); +// rwHandler2->setStartUpImmediately(); + (void) rwHandler2; rw2SpiCookie->setCallbackArgs(rwHandler2); + auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, + gpioIds::EN_RW3); +// rwHandler3->setStartUpImmediately(); + (void) rwHandler3; +// rw3SpiCookie->setCallbackArgs(rwHandler3); + + auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, + gpioIds::EN_RW4); +// (void) rwHandler4; + rwHandler4->setStartUpImmediately(); + rw4SpiCookie->setCallbackArgs(rwHandler4); + #endif /* TE0720 == 0 */ new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index 49e22249..5499517b 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -232,12 +232,12 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value } case(gpioIds::CS_RW3): { enableRwDecoder(); - selectY3(); + selectY2(); break; } case(gpioIds::CS_RW4): { enableRwDecoder(); - selectY4(); + selectY3(); break; } default: diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 35f38919..be184b6b 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -413,6 +413,18 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW3, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RW4, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); + if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "SPI PST initialization failed" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index c789fb64..d423aac1 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -298,7 +298,7 @@ ReturnValue_t RwHandler::checkSpeedAndRampTime(const uint8_t* commandData, size_ int32_t speed = *commandData << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 | *(commandData + 3); - if (speed < -65000 || speed > 65000 || (speed > -1000 && speed < 1000)) { + if ((speed < -65000 || speed > 65000 || (speed > -1000 && speed < 1000)) && (speed != 0)) { sif::error << "RwHandler::checkSpeedAndRampTime: Command has invalid speed" << std::endl; return INVALID_SPEED; }