diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index b3002cf4..ce1a7526 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -20,6 +20,7 @@ debugging. */ #define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_ADD_TEST_CODE 1 #define OBSW_ADD_TEST_PST 1 +#define OBSW_ADD_GPS 0 #define TEST_LIBGPIOD 0 #define TEST_RADIATION_SENSOR_HANDLER 0 @@ -43,6 +44,7 @@ debugging. */ #define DEBUG_SUS 1 #define DEBUG_RTD 1 #define IMTQ_DEBUG 1 +#define RW_DEBUG 1 // Leave at one as the BSP is linux. Used by the ADIS16507 device handler #define OBSW_ADIS16507_LINUX_COM_IF 1 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 6ba4083d..9bb73857 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -432,50 +432,61 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); + thisSequence->addSlot(objects::PLOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); +#if OBSW_ADD_GPS == 1 thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); +#endif thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); +#if OBSW_ADD_GPS == 1 thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); +#endif thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); +#if OBSW_ADD_GPS == 1 thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); +#endif thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); +#if OBSW_ADD_GPS == 1 thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); +#endif thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); +#if OBSW_ADD_GPS == 1 thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); +#endif if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "UART PST initialization failed" << std::endl; diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 23c49eba..a9d9dde3 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -208,7 +208,7 @@ ReturnValue_t RwHandler::checkSpeedAndRampTime(const uint8_t* commandData, size_ return INVALID_SPEED; } - uint16_t rampTime = *commandData << 8 | *(commandData + 1); + uint16_t rampTime = *(commandData + 4) << 8 | *(commandData + 5); if (rampTime < 10 || rampTime > 10000) { sif::error << "RwHandler::checkSpeedAndRampTime: Command has invalid ramp time" @@ -238,8 +238,8 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDa commandBuffer[3] = *(commandData + 1); commandBuffer[4] = *commandData; /** Ramp time (ms) */ - commandBuffer[5] = *(commandData + 1); - commandBuffer[6] = *commandData; + commandBuffer[5] = *(commandData + 5); + commandBuffer[6] = *(commandData + 4); uint16_t crc = CRC::crc16ccitt(commandBuffer, 7, 0xFFFF); commandBuffer[7] = static_cast(crc & 0xFF); @@ -251,10 +251,10 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDa void RwHandler::handleGetRwStatusReply(const uint8_t* packet) { uint8_t offset = 2; statusSet.currSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 - | *(packet + offset + 1) << 1 | *(packet + offset); + | *(packet + offset + 1) << 8 | *(packet + offset); offset += 4; statusSet.referenceSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 - | *(packet + offset + 1) << 1 | *(packet + offset); + | *(packet + offset + 1) << 8 | *(packet + offset); offset += 4; statusSet.state = *(packet + offset); offset += 1; @@ -275,7 +275,7 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) { void RwHandler::handleTemperatureReply(const uint8_t* packet) { uint8_t offset = 2; temperatureSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 - | *(packet + offset + 1) << 1 | *(packet + offset); + | *(packet + offset + 1) << 8 | *(packet + offset); #if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1 sif::info << "RwHandler::handleTemperatureReply: Temperature: " << temperatureSet.temperatureCelcius << " °C" << std::endl; diff --git a/tmtc b/tmtc index 899cd942..19b76d96 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 899cd942ce7136f371e93d270a6c6c149c0698cb +Subproject commit 19b76d961c61966a0093d3768f62d99196e1c9b2