Skip to content

Commit

Permalink
fix: negative temperature values from BLE devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxilef committed Dec 4, 2024
1 parent c97e506 commit 50280f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SensorsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ class SensorsTask : public LeanTask {
return;
}

float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.01f);
float rawTemp = (pChar->getValue<int16_t>() * 0.01f);
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Sensor #%hhu '%s': received temp: %.2f"),
Expand Down Expand Up @@ -634,7 +634,7 @@ class SensorsTask : public LeanTask {
return;
}

float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.1f);
float rawTemp = (pChar->getValue<int16_t>() * 0.1f);
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Sensor #%hhu '%s': received temp: %.2f"),
Expand Down Expand Up @@ -719,7 +719,7 @@ class SensorsTask : public LeanTask {
return;
}

float rawHumidity = ((pData[0] | (pData[1] << 8)) * 0.01f);
float rawHumidity = (pChar->getValue<uint16_t>() * 0.01f);
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Sensor #%hhu '%s': received humidity: %.2f"),
Expand Down Expand Up @@ -818,7 +818,7 @@ class SensorsTask : public LeanTask {
return;
}

uint8_t rawBattery = pData[0];
auto rawBattery = pChar->getValue<uint8_t>();
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Sensor #%hhu '%s': received battery: %.2f"),
Expand Down

0 comments on commit 50280f6

Please sign in to comment.