diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 290411c6..eae4eb46 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -305,6 +305,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); + static_cast(radSensor); #if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1 radSensor->setStartUpImmediately(); radSensor->setToGoToNormalModeImmediately(); diff --git a/common/config/devConf.h b/common/config/devConf.h index b3848225..deea6aa2 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -29,8 +29,8 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; */ static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000; -static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 4'000'000; -static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_0; +static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000; +static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index 8959cf1b..3b7d996d 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -102,9 +102,10 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman } case (SUS::START_INT_TIMED_CONVERSIONS): { std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); + //cmdBuffer[0] = max1227::buildResetByte(true); cmdBuffer[0] = SUS::CONVERSION; rawPacket = cmdBuffer; - rawPacketLen = 2; + rawPacketLen = 1; break; } case (SUS::READ_INT_TIMED_CONVERSIONS): { @@ -116,13 +117,12 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman case (SUS::READ_EXT_TIMED_CONVERSIONS): { std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); rawPacket = cmdBuffer; - for (uint8_t idx = 0; idx < 1; idx++) { + for (uint8_t idx = 0; idx < 6; idx++) { cmdBuffer[idx * 2] = buildConvByte(ScanModes::N_ONCE, idx, false); cmdBuffer[idx * 2 + 1] = 0; } - cmdBuffer[2] = 0x00; - // cmdBuffer[12] = 0x00; - rawPacketLen = 3; // SUS::SIZE_READ_EXT_CONVERSIONS; + cmdBuffer[12] = 0x00; + rawPacketLen = SUS::SIZE_READ_EXT_CONVERSIONS; break; } case (SUS::READ_EXT_TIMED_TEMPS): { @@ -168,7 +168,8 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 } case SUS::READ_INT_TIMED_CONVERSIONS: { PoolReadGuard readSet(&dataset); - dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125; + + dataset.temperatureCelcius = static_cast((packet[0] << 8) | packet[1]) * 0.125; dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3)); dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5)); dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7)); @@ -195,7 +196,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 } case (SUS::READ_EXT_TIMED_TEMPS): { PoolReadGuard readSet(&dataset); - dataset.temperatureCelcius = (packet[23] << 8) | packet[24]; + dataset.temperatureCelcius = static_cast(((packet[23] & 0x0f) << 8) | packet[24]) * 0.125; comState = ComStates::EXT_CLOCKED_CONVERSIONS; break; } diff --git a/linux/devices/SusHandler.h b/linux/devices/SusHandler.h index d2f5f9ce..04fd3032 100644 --- a/linux/devices/SusHandler.h +++ b/linux/devices/SusHandler.h @@ -77,7 +77,7 @@ class SusHandler : public DeviceHandlerBase { SUS::SusDataset dataset; // Read temperature in each alternating communication step when using // externally clocked mode - ClkModes clkMode = ClkModes::EXT_CLOCKED; + ClkModes clkMode = ClkModes::INT_CLOCKED; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; ComStates comState = ComStates::IDLE; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 6e0194e3..b43e8632 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -161,7 +161,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #if OBSW_ADD_SUN_SENSORS == 1 - bool addSus0 = true; + bool addSus0 = false; bool addSus1 = false; bool addSus2 = false; bool addSus3 = false; @@ -169,7 +169,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool addSus5 = false; bool addSus6 = false; bool addSus7 = false; - bool addSus8 = false; + bool addSus8 = true; bool addSus9 = false; bool addSus10 = false; bool addSus11 = false; @@ -186,9 +186,14 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_0, length * 0.2, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_0, length * 0.2, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_0, length * 0.2, DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SUS_0, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SUS_0, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ // thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::SEND_WRITE); @@ -225,11 +230,11 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { } if (addSus2) { /* Write setup */ - thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_2, length * 0.8, DeviceHandlerIF::GET_READ); // /* Write setup */ // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); @@ -245,11 +250,11 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { } if (addSus3) { /* Write setup */ - thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_3, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); // /* Write setup */ // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); @@ -265,12 +270,12 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { } if (addSus4) { /* Write setup */ - thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE); - thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.8, DeviceHandlerIF::GET_READ); /* Write setup */ // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE); @@ -349,12 +354,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { if (addSus8) { /* Write setup */ - thisSequence->addSlot(objects::SUS_8, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); - thisSequence->addSlot(objects::SUS_8, length * 0.925, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::SUS_8, length * 0.93, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SUS_8, length * 0.95, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SUS_8, length * 0.96, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::GET_READ); /* Start ADC conversions */ // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE); @@ -372,12 +381,15 @@ 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.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); + thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.2, 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,