From 8d02f073ed922fc487cbf54b14f3bf628d9b10ed Mon Sep 17 00:00:00 2001 From: jogo Date: Tue, 23 Apr 2013 09:17:05 +0000 Subject: [PATCH] [packages] wview: fix operation for low temperatures for WMRUSB When the outside temperature is less than -10C the station reports that dewpoint is invalid. This patch allows to ignore only that value instead of ignoring all of the packet contents from the outside sensor (including temperature and humidity). This is also sort of fixed (the reported dew point values might be invalid) in upstream release 5.20.0, but we can't use his repository because there is no public repository and also he ignores requests on his semi-private bugtracker; so we need to use the source we can trust, and currently jgoerzen's branch is the best source out there. Signed-off-by: Paul Fertser git-svn-id: svn://svn.openwrt.org/openwrt/packages@36389 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- utils/wview/Makefile | 2 +- .../040-WMRUSB-process-absent-dewpoint.patch | 29 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch diff --git a/utils/wview/Makefile b/utils/wview/Makefile index 72fe4df35..32e9de659 100644 --- a/utils/wview/Makefile +++ b/utils/wview/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wview PKG_VERSION:=5.19.0-jgoerzen -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE=$(PKG_SOURCE_VERSION)-r1 PKG_SOURCE_URL:=git://github.com/jgoerzen/wview.git PKG_SOURCE_VERSION:=7bfac6c11e756290c38e7b5862a4c51b6bc6c51e PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) diff --git a/utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch b/utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch new file mode 100644 index 000000000..ca6ef02a6 --- /dev/null +++ b/utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch @@ -0,0 +1,29 @@ +Index: wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c +=================================================================== +--- wview-5.19.0-jgoerzen.orig/stations/WMRUSB/wmrusbprotocol.c 2012-12-15 15:32:03.000000000 +0000 ++++ wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c 2012-12-15 15:36:47.199715376 +0000 +@@ -70,12 +70,9 @@ + { + a &= 0xff; + b &= 0xff; +- int t = (b << 8) | a; +- if (t & 0x8000) +- { +- t &= 0x7FFF; ++ int t = ((b & 0x0f) << 8) | a; ++ if (b & 0x80) + return -(t / 10.0); +- } + else + return t / 10.0; + } +@@ -166,6 +163,9 @@ + return; + } + ++ if (ptr[5] & 0x20) ++ dew = ARCHIVE_VALUE_NULL; ++ + wmrWork.sensorData.humidity[sensor] = humid; + wmrWork.sensorData.temp[sensor] = temp; + wmrWork.sensorData.dewpoint[sensor] = dew; -- 2.11.0