Add NVS support for relay channel config persistence

- Introduced NVS configuration options in Kconfig.
- Implemented NVS initialization and deinitialization in relay_chn_core.
- Added functions for storing and retrieving relay channel direction and tilt sensitivity in NVS.
- Updated relay_chn_tilt and relay_chn_output to utilize NVS for state management.
- Created relay_chn_nvs.c and relay_chn_nvs.h for NVS-related functionalities.

Closes #1074.
This commit is contained in:
2025-08-19 17:33:45 +03:00
parent f04632dc77
commit b19f0c553b
8 changed files with 490 additions and 23 deletions

35
Kconfig
View File

@@ -26,4 +26,39 @@ menu "Relay Channel Driver Configuration"
at a time. Tilting is specifically designed for controlling some
types of curtains that need to be adjusted to let enter specific
amount of day light.
config RELAY_CHN_ENABLE_NVS
bool "Enable persistent NVS storage for relay channel"
default n
help
If enabled, relay channel configuration will be stored in NVS.
endmenu
menu "Relay Channel NVS Storage Configuration"
depends on RELAY_CHN_ENABLE_NVS
config RELAY_CHN_NVS_NAMESPACE
string "NVS namespace for relay channel storage"
default "relay_chn"
help
The NVS namespace used for storing relay channel configuration.
This should be unique to avoid conflicts with other components.
config RELAY_CHN_NVS_CUSTOM_PARTITION
bool "Use custom NVS partition for relay channel storage"
default n
help
If enabled, a custom NVS partition will be used for storing
relay channel configuration. If disabled, the default NVS
partition will be used.
config RELAY_CHN_NVS_CUSTOM_PARTITION_NAME
string "Custom NVS partition name"
depends on RELAY_CHN_NVS_CUSTOM_PARTITION
default "app_data"
help
The name of the custom NVS partition used for storing relay channel
configuration. Make sure the name is exactly the same as label defined
in the relevant partition table.
endmenu