Skip to content

Commit

Permalink
Added missing implementation of CMD_SET_LW_STATUS_INTERVAL (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs authored Aug 29, 2024
1 parent ba12b65 commit 9e25dbe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions BresserWeatherSensorLWCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
// 20240723 Extracted from BresserWeatherSensorLW.ino
// 20240729 Added PowerFeather specific status information
// 20240818 Replaced delay() with light sleep for ESP32
// 20240829 Added missing implementation of CMD_SET_LW_STATUS_INTERVAL
//
// ToDo:
// -
Expand Down Expand Up @@ -134,6 +135,16 @@ uint8_t decodeDownlink(uint8_t port, uint8_t *payload, size_t size)
return 0;
}

if ((port == CMD_SET_LW_STATUS_INTERVAL) && (size == 1))
{
prefs.lw_stat_interval = payload[0];
log_d("Set lw_stat_interval: %u", prefs.lw_stat_interval);
preferences.begin("BWS-LW", false);
preferences.putUChar("lw_stat_int", prefs.lw_stat_interval);
preferences.end();
return 0;
}

if ((port == CMD_GET_LW_CONFIG) && (payload[0] == 0x00) && (size == 1))
{
log_d("Get config");
Expand Down
2 changes: 1 addition & 1 deletion src/AppLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void AppLayer::getPayloadStage1(uint8_t &port, LoraEncoder &encoder)
#endif

// FIXME: To be removed later
// Battery status flags for compatibility with BresserWeatherSensorTTN
// Battery status flags for compatibility with BresserWeatherSensorTTN and ESP32-e-Paper-Weather-Display
if ((appPayloadCfg[0] & 1) && (encoder.getLength() <= PAYLOAD_SIZE - 1))
{
log_i("Battery status flags: ws=%u, soil=%u, lgt=%u", appStatus[SENSOR_TYPE_WEATHER1] & 1,
Expand Down
1 change: 1 addition & 0 deletions src/rp2040/pico_rtc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <time.h>
#include <pico/stdlib.h>
#include <hardware/rtc.h>
#include <hardware/clocks.h>
#include "pico_sleep.h"
#include "pico_rosc.h"
#include "../logging.h"
Expand Down
1 change: 1 addition & 0 deletions src/rp2040/pico_sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "pico.h"
#include "hardware/rtc.h"
#include "hardware/clocks.h"

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit 9e25dbe

Please sign in to comment.