Skip to content

Commit

Permalink
fixed ambious byte reference in last pio update
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Jun 2, 2021
1 parent d3b380c commit 4c81fac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ bool Sensors::pmGenericRead() {
if (txtMsg[0] == 66) {
if (txtMsg[1] == 77) {
DEBUG("-->[PMS-HPMA] read > done!");
pm25 = txtMsg[6] * 256 + byte(txtMsg[7]);
pm10 = txtMsg[8] * 256 + byte(txtMsg[9]);
pm25 = txtMsg[6] * 256 + (char)(txtMsg[7]);
pm10 = txtMsg[8] * 256 + (char)(txtMsg[9]);
if (pm25 > 1000 && pm10 > 1000) {
onSensorError("-->[E][PMSENSOR] out of range pm25 > 1000");
} else
Expand All @@ -245,9 +245,9 @@ bool Sensors::pmPanasonicRead() {
String txtMsg = hwSerialRead(lenght_buffer);
if (txtMsg[0] == 02) {
DEBUG("-->[PANASONIC] read > done!");
pm1 = txtMsg[2] * 256 + byte(txtMsg[1]);
pm25 = txtMsg[6] * 256 + byte(txtMsg[5]);
pm10 = txtMsg[10] * 256 + byte(txtMsg[9]);
pm1 = txtMsg[2] * 256 + (char)(txtMsg[1]);
pm25 = txtMsg[6] * 256 + (char)(txtMsg[5]);
pm10 = txtMsg[10] * 256 + (char)(txtMsg[9]);
if (pm25 > 2000 && pm10 > 2000) {
onSensorError("-->[E][PMSENSOR] out of range pm25 > 2000");
} else
Expand All @@ -268,8 +268,8 @@ bool Sensors::pmSDS011Read() {
if (txtMsg[0] == 170) {
if (txtMsg[1] == 192) {
DEBUG("-->[SDS011] read > done!");
pm25 = (txtMsg[3] * 256 + byte(txtMsg[2])) / 10;
pm10 = (txtMsg[5] * 256 + byte(txtMsg[4])) / 10;
pm25 = (txtMsg[3] * 256 + (char)(txtMsg[2])) / 10;
pm10 = (txtMsg[5] * 256 + (char)(txtMsg[4])) / 10;
if (pm25 > 1000 && pm10 > 1000) {
onSensorError("-->[E][PMSENSOR] out of range pm25 > 1000");
} else
Expand Down

0 comments on commit 4c81fac

Please sign in to comment.