Skip to content

Commit

Permalink
Fix Error in converting EddystoneTLM negative temperatures to float | r…
Browse files Browse the repository at this point in the history
…esolves #675
  • Loading branch information
Max93 authored and h2zero committed Jun 8, 2024
1 parent 098a989 commit 6d8eb8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NimBLEEddystoneTLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ uint16_t NimBLEEddystoneTLM::getVolt() {
* @return The temperature value.
*/
float NimBLEEddystoneTLM::getTemp() {
return ENDIAN_CHANGE_U16(m_eddystoneData.temp) / 256.0f;
return (int16_t)ENDIAN_CHANGE_U16(m_eddystoneData.temp) / 256.0f;
} // getTemp

/**
Expand Down Expand Up @@ -203,7 +203,7 @@ void NimBLEEddystoneTLM::setVolt(uint16_t volt) {
* @param [in] temp The temperature value.
*/
void NimBLEEddystoneTLM::setTemp(float temp) {
m_eddystoneData.temp = (uint16_t)temp;
m_eddystoneData.temp = ENDIAN_CHANGE_U16((int16_t)(temp * 256.0f));
} // setTemp


Expand Down

0 comments on commit 6d8eb8a

Please sign in to comment.