nothing works
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-02-16 21:29:37 +01:00
parent 25b4af1921
commit effe461380
5 changed files with 54 additions and 40 deletions

View File

@ -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<int16_t>((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<int16_t>(((packet[23] & 0x0f) << 8) | packet[24]) * 0.125;
comState = ComStates::EXT_CLOCKED_CONVERSIONS;
break;
}

View File

@ -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;