From 18423bec72b7d6b7a8d15811f1b4e1cfe100ed15 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Tue, 3 Oct 2023 20:37:54 +0300 Subject: [PATCH] get rid of rainfall filtering --- src/module/ws1080.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/module/ws1080.ts b/src/module/ws1080.ts index d628ca4..33ccaf9 100644 --- a/src/module/ws1080.ts +++ b/src/module/ws1080.ts @@ -1,6 +1,5 @@ import { getDeviceList, Device, Interface, InEndpoint } from 'usb'; -const MAX_RAIN_JUMP = 10; const WIND_DIRS = [ 'N', 'NNE', @@ -236,7 +235,7 @@ class WS1080 { // Bytes 14 and 15 when combined create an unsigned short int // that we multiply by 0.3 to find the total rain - let totalRain = currentBlock.subarray(13, 15).readUint16LE() * 0.3; + const totalRain = currentBlock.subarray(13, 15).readUint16LE() * 0.3; // Calculate wind speeds const windSpeed = (wind + ((windExtra & 0x0f) << 8)) * 0.38; // Was 0.1 @@ -251,14 +250,7 @@ class WS1080 { // Calculate rainfall rates if (this.previousRain === 0) this.previousRain = totalRain; - let rainDiff = totalRain - this.previousRain; - - if (rainDiff > MAX_RAIN_JUMP) { - // Filter rainfall spikes - rainDiff = 0; - totalRain = this.previousRain; - } - + const rainDiff = totalRain - this.previousRain; this.previousRain = totalRain; // Compile the data