Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing implementation of CMD_SET_LW_STATUS_INTERVAL #102

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- esp32:esp32:m5stack_core2
- esp32:esp32:esp32s3_powerfeather
- esp32:esp32:adafruit_feather_esp32s2
- rp2040:rp2040:adafruit_feather:dbgport=Serial
#- rp2040:rp2040:adafruit_feather:dbgport=Serial

runs-on: ubuntu-latest
name: ${{ matrix.board }}
Expand Down
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
Loading