From b630609333f163a35ee844cd80f4247cfd46e049 Mon Sep 17 00:00:00 2001 From: Matthias Prinke Date: Thu, 22 Feb 2024 20:24:15 +0100 Subject: [PATCH 1/2] Fix for #82, workaround for #81 --- .github/workflows/CI.yml | 2 +- BresserWeatherSensorTTN.ino | 10 +++++++++- package.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e836d35..110a7d4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -75,7 +75,7 @@ jobs: #declare -a required_libs=("https://github.com/matthias-bs/BresserWeatherSensorReceiver.git" declare -a required_libs=( "RadioLib@6.4.2" - "BresserWeatherSensorReceiver@0.22.1" + "BresserWeatherSensorReceiver@0.23.1" "MCCI LoRaWAN LMIC library@4.1.1" "MCCI Arduino LoRaWAN Library@0.10.0" "MCCI Arduino Development Kit ADK@0.2.2" diff --git a/BresserWeatherSensorTTN.ino b/BresserWeatherSensorTTN.ino index bc6b392..beb4612 100644 --- a/BresserWeatherSensorTTN.ino +++ b/BresserWeatherSensorTTN.ino @@ -121,6 +121,7 @@ // 20231223 Updated to BresserWeatherSensorReceiver v0.20.1 // 20240116 Fixed rain counter overflow value for SENSOR_TYPE_WEATHER0 // (see https://github.com/matthias-bs/BresserWeatherSensorReceiver/releases/tag/v0.5.1) +// 20240222 Added weatherSensor.clearSlots() (part of fix for #82), added workaround for (#81) // // ToDo: // - Split this file @@ -1342,7 +1343,13 @@ void printDateTime(void) { /// Determine sleep duration and enter Deep Sleep Mode void prepareSleep(void) { - uint32_t sleep_interval = prefs.sleep_interval; + // FIXME + // Workaround for + // https://github.com/matthias-bs/BresserWeatherSensorTTN/issues/81 + //uint32_t sleep_interval = (uint32_t)prefs.sleep_interval; + preferences.begin("BWS-TTN", false); + uint32_t sleep_interval = preferences.getUShort("sleep_int", SLEEP_INTERVAL); + preferences.end(); longSleep = false; #ifdef ADC_EN // Long sleep interval if battery is weak @@ -1607,6 +1614,7 @@ cSensor::setup(std::uint32_t uplinkPeriodMs) { #ifndef LORAWAN_DEBUG weatherSensor.begin(); + weatherSensor.clearSlots(); //bool decode_ok = weatherSensor.getData(prefs.ws_timeout * 1000, DATA_TYPE | DATA_COMPLETE, SENSOR_TYPE_WEATHER1); bool decode_ok = weatherSensor.getData(prefs.ws_timeout * 1000, DATA_ALL_SLOTS); #else diff --git a/package.json b/package.json index 8397acf..43c687b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/matthias-bs/BresserWeatherSensorTTN#README", "dependencies": { - "BresserWeatherSensorReceiver": "matthias-bs/BresserWeatherSensorReceiver#semver:^0.22.1", + "BresserWeatherSensorReceiver": "matthias-bs/BresserWeatherSensorReceiver#semver:^0.23.1", "arduino-lmic": "mcci-catena/arduino-lmic.git#v4.1.1", "arduino-lorawan": "mcci-catena/arduino-lorawan.git#v0.10.0", "Catena-mcciadk": "mcci-catena/Catena-mcciadk.git#v0.2.2", From b30d28c202365a48e0a4cd05e27cbc94492e5077 Mon Sep 17 00:00:00 2001 From: Matthias Prinke <83612361+matthias-bs@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:31:18 +0100 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43c687b..e676042 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "BresserWeatherSensorTTN", - "version": "0.12.0", + "version": "0.12.1", "description": "Bresser 5-in-1/6-in-1/7-in-1 868 MHz Weather Sensor Radio Receiver; provides data via LoRaWAN", "main": "BresserWeatherSensorTTN.ino", "frameworks": "arduino",