WIP: PL PCDU #142

Closed
muellerr wants to merge 118 commits from mueller/plpcdu-sus-updates into develop
Showing only changes of commit 9245815f97 - Show all commits

View File

@ -47,7 +47,7 @@ void SusHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
switch (comState) {
case (ComStates::IDLE): {
return NOTHING_TO_SEND;
break;
}
case (ComStates::WRITE_SETUP): {
*id = SUS::WRITE_SETUP;
@ -168,7 +168,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
case SUS::READ_INT_TIMED_CONVERSIONS: {
PoolReadGuard readSet(&dataset);
dataset.temperatureCelcius = static_cast<int16_t>((packet[0] << 8) | packet[1]) * 0.125;
dataset.temperatureCelcius = max1227::getTemperature(((packet[0] & 0x0f) << 8) | packet[1]);
for (uint8_t idx = 0; idx < 6; idx++) {
dataset.channels[idx] = packet[idx * 2 + 2] << 8 | packet[idx * 2 + 3];
}
@ -189,8 +189,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
}
case (SUS::READ_EXT_TIMED_TEMPS): {
PoolReadGuard readSet(&dataset);
dataset.temperatureCelcius =
static_cast<int16_t>(((packet[23] & 0x0f) << 8) | packet[24]) * 0.125;
dataset.temperatureCelcius = max1227::getTemperature(((packet[23] & 0x0f) << 8) | packet[24]);
comState = ComStates::EXT_CLOCKED_CONVERSIONS;
break;
}