-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Fix for negative temp in Eddystone TLM; solving #7618 #7791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
ddd6496
1f3a941
cc893d5
f677580
50e1c7e
3ee9d53
125cdee
96faa77
0980a21
a42a513
1f406c6
f638759
c9bf68d
aa5486b
a64613d
5529457
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,7 +115,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks | |
| foundEddyURL.setData(eddyContent); | ||
| Serial.printf("Reported battery voltage: %dmV\n", foundEddyURL.getVolt()); | ||
| Serial.printf("Reported temperature from TLM class: %.2fC\n", (double)foundEddyURL.getTemp()); | ||
| int temp = (int)payLoad[16] + (int)(payLoad[15] << 8); | ||
| int16_t temp = (int16_t)payLoad[16] + (int16_t)(payLoad[15] << 8); | ||
|
||
| float calcTemp = temp / 256.0f; | ||
| Serial.printf("Reported temperature from data: %.2fC\n", calcTemp); | ||
| Serial.printf("Reported advertise count: %d\n", foundEddyURL.getCount()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ void setBeacon() | |
| uint16_t volt = random(2800, 3700); // 3300mV = 3.3V | ||
| float tempFloat = random(2000, 3100) / 100.0f; | ||
| Serial.printf("Random temperature is %.2fC\n", tempFloat); | ||
| int temp = (int)(tempFloat * 256); //(uint16_t)((float)23.00); | ||
| int16_t temp = (int16_t)(tempFloat * 256); | ||
|
||
| Serial.printf("Converted to 8.8 format %0X%0X\n", (temp >> 8), (temp & 0xFF)); | ||
|
|
||
| BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,7 +132,7 @@ void BLEEddystoneTLM::setVolt(uint16_t volt) { | |
| } // setVolt | ||
|
|
||
| void BLEEddystoneTLM::setTemp(float temp) { | ||
| m_eddystoneData.temp = (uint16_t)temp; | ||
| m_eddystoneData.temp = (int16_t)temp; | ||
|
||
| } // setTemp | ||
|
|
||
| void BLEEddystoneTLM::setCount(uint32_t advCount) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,7 @@ class BLEEddystoneTLM { | |
| uint8_t frameType; | ||
| uint8_t version; | ||
| uint16_t volt; | ||
| uint16_t temp; | ||
| int16_t temp; | ||
|
||
| uint32_t advCount; | ||
| uint32_t tmil; | ||
| } __attribute__((packed)) m_eddystoneData; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed Line 118 to:
int16_t temp = payLoad[22+5] + (payLoad[22+4] << 8);