ismail created pull request KozmotronikTech/relay_chn#39

ismail
Sat, 13 Sep 2025 10:45:15 +0200

Summary

This PR finalizes the first major release v1.0.0 of the relay channel component.
It consolidates new features, performance improvements, bug fixes, and major API refactors to provide a stable and production-ready foundation.

TICKET-1115

Changes

Added single channel and multi-channel modes with dedicated examples.

Introduced run limit feature with NVS persistence.

Added background tasks for NVS and long-running operations.

Modularized listener notification system.

Improved tilt handling (upper limit checks, STOP command fixes, reverse tilt fixes).

Optimized event loop and timer callbacks for performance and lower memory usage.

Added SPDX license headers and cleaned up code & comments.

Added new public APIs:

relay_chn_tilt_get_default_sensitivity

relay_chn_state_to_str

Specific *_all and *_all_with functions

Enhanced unit tests and coverage across all features.

Updated CMakeLists and build system to support ESP-IDF build profiles.

Related Issues

#957 - Add single channel mode

#1074 - Add NVS storage option

#1080 - Implement free running time limit

#1085 - Code and API optimization

#1089 - Add unit tests for new *all functions

#1096 - Add background tasks for unpredictable long running operations

#1097 - Modularize listener notification

#1098 - Do NVS operations in background

#1104 - Add examples for both modes

#1105 - Implement a single channel example

#1108 - Add state to string API function

#1111 - Add a multi-channel example
(and all related bug fixes up to #1114)

Breaking Changes

Config parameter renaming: All custom defines are replaced with their original CONFIG_ prefixed names.

API refactors:

time_sec parameter renamed to limit_sec in run limit APIs.

Deprecated RELAY_CHN_ID_ALL in favor of new *_all and *_all_with functions.

relay_chn_state_str is renamed and exposed as public API relay_chn_state_to_str.

STOP and TILT command behavior:

STOP no longer issued when idle.

Correct handling of STOP during pending states.

TILT_STOP and reverse tilt commands now prioritized and validated.

Listener handling:

Old inline listener management removed.

Now handled by modularized notification system with queue-based dispatch.

NVS storage:

New background task logic with asynchronous writes (breaking previous synchronous-only flow).

Critical key naming bug fix changes how channel values are stored.

Migration Guide

Config Parameters: Update code and sdkconfig to use original CONFIG_* names.

Run Limit API: Replace any time_sec references with limit_sec.

Channel Selection: Remove usage of RELAY_CHN_ID_ALL, switch to *_all or *_all_with.

State String API: Replace private relay_chn_state_str with public relay_chn_state_to_str.

STOP & TILT Logic: Review application-level command handling; STOP and TILT may now behave differently than before.

Listeners: Use new notification module APIs for registering/unregistering listeners.

NVS: If relying on synchronous writes, ensure application adapts to asynchronous background task model.