Skip to content

Commit

Permalink
Renamed Preferences: BWS-LW to GRO2LW, added implementation of CMD_SE…
Browse files Browse the repository at this point in the history
…T_LW_STATUS_INTERVAL
  • Loading branch information
matthias-bs committed Aug 28, 2024
1 parent 574ea04 commit edae71b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/growatt2lorawan_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
// 20240729 Added PowerFeather specific status information
// 20240815 Added getUplinkDelayMs()
// 20240818 Replaced delay() with light sleep for ESP32
// 20240828 Renamed Preferences: BWS-LW to GRO2LW
// Added implementation of CMD_SET_LW_STATUS_INTERVAL
//
// ToDo:
// -
Expand Down Expand Up @@ -127,7 +129,7 @@ uint8_t decodeDownlink(uint8_t port, uint8_t *payload, size_t size)
{
prefs.sleep_interval = (payload[0] << 8) | payload[1];
log_d("Set sleep_interval: %u s", prefs.sleep_interval);
preferences.begin("BWS-LW", false);
preferences.begin("GRO2LW", false);
preferences.putUShort("sleep_int", prefs.sleep_interval);
preferences.end();
return 0;
Expand All @@ -137,12 +139,22 @@ uint8_t decodeDownlink(uint8_t port, uint8_t *payload, size_t size)
{
prefs.sleep_interval_long = (payload[0] << 8) | payload[1];
log_d("Set sleep_interval_long: %u s", prefs.sleep_interval_long);
preferences.begin("BWS-LW", false);
preferences.begin("GRO2LW", false);
preferences.putUShort("sleep_int_long", prefs.sleep_interval_long);
preferences.end();
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("GRO2LW", 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

0 comments on commit edae71b

Please sign in to comment.