From b7cae91c97fa203ee5aad35b19bfa397cbe7f72c Mon Sep 17 00:00:00 2001 From: Nik Date: Sat, 4 Jun 2016 12:21:42 +0200 Subject: [PATCH] Enabled low battery detection on FineOffset WH1080 (#387) --- src/devices/fineoffset_wh1080.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/devices/fineoffset_wh1080.c b/src/devices/fineoffset_wh1080.c index 5379bad9..0ca3f9e6 100644 --- a/src/devices/fineoffset_wh1080.c +++ b/src/devices/fineoffset_wh1080.c @@ -90,8 +90,8 @@ static unsigned short get_device_id(const uint8_t* br) { return (br[1] << 4 & 0xf0 ) | (br[2] >> 4); } -static char* get_battery(const uint8_t* br) { // Not enabled - Still unknown if it's right - if ((br[9] >> 4) == 0) { +static char* get_battery(const uint8_t* br) { + if ((br[9] >> 4) != 1) { return "OK"; } else { return "LOW"; @@ -283,7 +283,7 @@ if (msg_type == 0) { "speed", "Wind avg speed", DATA_FORMAT, "%.02f", DATA_DOUBLE, speed, "gust", "Wind gust", DATA_FORMAT, "%.02f", DATA_DOUBLE, gust, "rain", "Total rainfall", DATA_FORMAT, "%.01f", DATA_DOUBLE, rain, - //"battery", "Battery", DATA_STRING, battery, // Unsure about Battery byte... + "battery", "Battery", DATA_STRING, battery, // Unsure about Battery byte... NULL); data_acquired_handler(data); return 1; @@ -323,7 +323,7 @@ static char *output_fields[] = { "year", "month", "day", - //"battery", // Still unsure about Battery byte(s)... + "battery", NULL };