Skip to content

Commit

Permalink
Caught Big/Little-Endian problem with 16 bit UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
wcbonner committed Nov 2, 2022
1 parent a5d4854 commit 195086e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion GoveeBTTempLogger/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: GoveeBTTempLogger
Version: 2.20221030-1
Version: 2.20221101-1
Section: custom
Priority: optional
Architecture: armhf
Expand Down
17 changes: 9 additions & 8 deletions goveebttemplogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#include <vector>

/////////////////////////////////////////////////////////////////////////////
static const std::string ProgramVersionString("GoveeBTTempLogger Version 2.20221030-1 Built on: " __DATE__ " at " __TIME__);
static const std::string ProgramVersionString("GoveeBTTempLogger Version 2.20221101-1 Built on: " __DATE__ " at " __TIME__);
/////////////////////////////////////////////////////////////////////////////
std::string timeToISO8601(const time_t & TheTime)
{
Expand Down Expand Up @@ -371,11 +371,11 @@ ThermometerType Govee_Temp::SetModel(const unsigned short* UUID)
{
ThermometerType rval = Model;
// 88EC could be either GVH5075_ or GVH5174_
if (0x5181 == *UUID)
if (0x8151 == *UUID)
Model = ThermometerType::H5181;
else if (0x5182 == *UUID)
else if (0x8251 == *UUID)
Model = ThermometerType::H5182;
else if (0x5183 == *UUID)
else if (0x8351 == *UUID)
Model = ThermometerType::H5183;
return(rval);
}
Expand Down Expand Up @@ -2060,7 +2060,6 @@ int main(int argc, char **argv)
char addr[19] = { 0 };
ba2str(&info->bdaddr, addr);
ConsoleOutLine << " [" << addr << "]";
Govee_Temp localTemp;
std::string localName;
if (ConsoleVerbosity > 2)
{
Expand All @@ -2087,6 +2086,7 @@ int main(int argc, char **argv)
{
int current_offset = 0;
bool data_error = false;
Govee_Temp localTemp;
while (!data_error && current_offset < info->length)
{
size_t data_len = info->data[current_offset];
Expand Down Expand Up @@ -2190,11 +2190,10 @@ int main(int argc, char **argv)
{
if (localTemp.ReadMSG((info->data + current_offset)))
{
//ConsoleOutLine << " (Temp) " << std::dec << localTemp.Temperature << "°F";
ConsoleOutLine << " (Temp) " << std::dec << localTemp.GetTemperature() << "\u00B0" << "C"; // http://www.fileformat.info/info/unicode/char/b0/index.htm
if (localTemp.GetModel() == ThermometerType::H5183)
if ((localTemp.GetModel() == ThermometerType::H5181) || (localTemp.GetModel() == ThermometerType::H5183))
ConsoleOutLine << " (Temp) " << std::dec << localTemp.GetTemperature(false, 1) << "\u00B0" << "C"; // http://www.fileformat.info/info/unicode/char/b0/index.htm
if (localTemp.GetModel() == ThermometerType::H5182)
else if (localTemp.GetModel() == ThermometerType::H5182)
{
ConsoleOutLine << " (Temp) " << std::dec << localTemp.GetTemperature(false, 1) << "\u00B0" << "C"; // http://www.fileformat.info/info/unicode/char/b0/index.htm
ConsoleOutLine << " (Temp) " << std::dec << localTemp.GetTemperature(false, 2) << "\u00B0" << "C"; // http://www.fileformat.info/info/unicode/char/b0/index.htm
Expand Down Expand Up @@ -2231,6 +2230,8 @@ int main(int argc, char **argv)
case ThermometerType::H5181:
ConsoleOutLine << " (GVH5181)";
break;
default:
ConsoleOutLine << " (ThermometerType::Unknown)";
}
std::queue<Govee_Temp> foo;
auto ret = GoveeTemperatures.insert(std::pair<bdaddr_t, std::queue<Govee_Temp>>(info->bdaddr, foo));
Expand Down

0 comments on commit 195086e

Please sign in to comment.