v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
5 changed files with 54 additions and 40 deletions
Showing only changes of commit effe461380 - Show all commits

View File

@ -305,6 +305,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
auto radSensor = auto radSensor =
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
static_cast<void>(radSensor);
#if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1 #if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
radSensor->setStartUpImmediately(); radSensor->setStartUpImmediately();
radSensor->setToGoToNormalModeImmediately(); radSensor->setToGoToNormalModeImmediately();

View File

@ -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 const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 4'000'000; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_0; static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;

View File

@ -102,9 +102,10 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
} }
case (SUS::START_INT_TIMED_CONVERSIONS): { case (SUS::START_INT_TIMED_CONVERSIONS): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
//cmdBuffer[0] = max1227::buildResetByte(true);
cmdBuffer[0] = SUS::CONVERSION; cmdBuffer[0] = SUS::CONVERSION;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 2; rawPacketLen = 1;
break; break;
} }
case (SUS::READ_INT_TIMED_CONVERSIONS): { case (SUS::READ_INT_TIMED_CONVERSIONS): {
@ -116,13 +117,12 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
case (SUS::READ_EXT_TIMED_CONVERSIONS): { case (SUS::READ_EXT_TIMED_CONVERSIONS): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
rawPacket = 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] = buildConvByte(ScanModes::N_ONCE, idx, false);
cmdBuffer[idx * 2 + 1] = 0; cmdBuffer[idx * 2 + 1] = 0;
} }
cmdBuffer[2] = 0x00; cmdBuffer[12] = 0x00;
// cmdBuffer[12] = 0x00; rawPacketLen = SUS::SIZE_READ_EXT_CONVERSIONS;
rawPacketLen = 3; // SUS::SIZE_READ_EXT_CONVERSIONS;
break; break;
} }
case (SUS::READ_EXT_TIMED_TEMPS): { 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: { case SUS::READ_INT_TIMED_CONVERSIONS: {
PoolReadGuard readSet(&dataset); PoolReadGuard readSet(&dataset);
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
dataset.temperatureCelcius = static_cast<int16_t>((packet[0] << 8) | packet[1]) * 0.125;
dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3)); dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3));
dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5)); dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5));
dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7)); 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): { case (SUS::READ_EXT_TIMED_TEMPS): {
PoolReadGuard readSet(&dataset); PoolReadGuard readSet(&dataset);
dataset.temperatureCelcius = (packet[23] << 8) | packet[24]; dataset.temperatureCelcius = static_cast<int16_t>(((packet[23] & 0x0f) << 8) | packet[24]) * 0.125;
comState = ComStates::EXT_CLOCKED_CONVERSIONS; comState = ComStates::EXT_CLOCKED_CONVERSIONS;
break; break;
} }

View File

@ -77,7 +77,7 @@ class SusHandler : public DeviceHandlerBase {
SUS::SusDataset dataset; SUS::SusDataset dataset;
// Read temperature in each alternating communication step when using // Read temperature in each alternating communication step when using
// externally clocked mode // externally clocked mode
ClkModes clkMode = ClkModes::EXT_CLOCKED; ClkModes clkMode = ClkModes::INT_CLOCKED;
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
ComStates comState = ComStates::IDLE; ComStates comState = ComStates::IDLE;

View File

@ -161,7 +161,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#if OBSW_ADD_SUN_SENSORS == 1 #if OBSW_ADD_SUN_SENSORS == 1
bool addSus0 = true; bool addSus0 = false;
bool addSus1 = false; bool addSus1 = false;
bool addSus2 = false; bool addSus2 = false;
bool addSus3 = false; bool addSus3 = false;
@ -169,7 +169,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
bool addSus5 = false; bool addSus5 = false;
bool addSus6 = false; bool addSus6 = false;
bool addSus7 = false; bool addSus7 = false;
bool addSus8 = false; bool addSus8 = true;
bool addSus9 = false; bool addSus9 = false;
bool addSus10 = false; bool addSus10 = false;
bool addSus11 = 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, 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.2, DeviceHandlerIF::SEND_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.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_0, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_0, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */ /* 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.94, DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::SEND_WRITE);
@ -225,11 +230,11 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
} }
if (addSus2) { if (addSus2) {
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.8, DeviceHandlerIF::GET_READ);
// /* Write setup */ // /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); // thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE);
@ -245,11 +250,11 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
} }
if (addSus3) { if (addSus3) {
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_3, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ);
// /* Write setup */ // /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); // thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE);
@ -265,12 +270,12 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
} }
if (addSus4) { if (addSus4) {
/* Write setup */ /* 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, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_4, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_4, length * 0.8, DeviceHandlerIF::GET_READ);
/* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE); // thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
@ -349,12 +354,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
if (addSus8) { if (addSus8) {
/* Write setup */ /* 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.921, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.93, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.95, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.96, DeviceHandlerIF::GET_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 */ /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
@ -372,12 +381,15 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
if (addSus9) { if (addSus9) {
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, 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 */ // /* Start ADC conversions */
// // thisSequence->addSlot(objects::SUS_9, length * 0.925, // // 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,