Skip to content

Commit

Permalink
Possibly fix h5074 advertisment vs download issue
Browse files Browse the repository at this point in the history
  • Loading branch information
William C Bonner committed Oct 9, 2023
1 parent 0216a70 commit 4294ed3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (POLICY CMP0141)
endif()

project (GoveeBTTempLogger
VERSION 2.20231008.1
VERSION 2.20231009.1
DESCRIPTION "Listen and log Govee Thermometer Bluetooth Low Energy Advertisments"
HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger
)
Expand Down
8 changes: 5 additions & 3 deletions goveebttemplogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3285,7 +3285,8 @@ int main(int argc, char **argv)
{
time(&TimeAdvertisment);
const le_advertising_info* const info = (le_advertising_info*)(meta->data + 1);
bool AddressInGoveeSet = (GoveeTemperatures.end() != GoveeTemperatures.find(info->bdaddr));
bool AddressInGoveeSet(GoveeTemperatures.end() != GoveeTemperatures.find(info->bdaddr));
bool TemperatureInAdvertisment(false);
char addr[19] = { 0 };
ba2str(&info->bdaddr, addr);
ConsoleOutLine << " [" << addr << "]";
Expand Down Expand Up @@ -3417,8 +3418,9 @@ int main(int argc, char **argv)
ConsoleOutLine << std::hex << std::uppercase << std::setw(2) << std::setfill('0') << int((info->data + current_offset + 1)[index]);
}
{
if (localTemp.ReadMSG((info->data + current_offset)))
if (localTemp.ReadMSG((info->data + current_offset))) // This line decodes temperature from advertisment
{
TemperatureInAdvertisment = true;
ConsoleOutLine << " (Temp) " << std::dec << localTemp.GetTemperature() << "\u00B0" << "C"; // http://www.fileformat.info/info/unicode/char/b0/index.htm
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
Expand Down Expand Up @@ -3490,7 +3492,7 @@ int main(int argc, char **argv)
}
if ((AddressInGoveeSet && (ConsoleVerbosity > 0)) || (ConsoleVerbosity > 1))
std::cout << ConsoleOutLine.str() << std::endl;
if ((DaysBetweenDataDownload > 0) && AddressInGoveeSet && !LogDirectory.empty())
if (TemperatureInAdvertisment && (DaysBetweenDataDownload > 0) && AddressInGoveeSet && !LogDirectory.empty())
{
int BatteryToRecord = 0;
auto RecentTemperature = GoveeTemperatures.find(info->bdaddr);
Expand Down

0 comments on commit 4294ed3

Please sign in to comment.