151 Commits

Author SHA1 Message Date
5e92e0477b Merge pull request 'Merge main with the latest changes and its tag into dev' (!40) from main into dev
Reviewed-on: #40
2025-09-13 12:04:40 +03:00
fafc23591a Merge pull request 'release-1.0.0' (!39) from release-1.0.0 into main
Reviewed-on: #39
1.0.0
2025-09-13 11:55:48 +03:00
497f45e336 Fix and optimize tilt test case issues
Tilt tests started to fail after the latest changes. Had to make
some fixes and optimizations so that the test code resets the
tilt controls correctly and aligns with relay_chn's timing requirements.

Fixes #1115
2025-09-13 09:54:12 +03:00
95ca976bc6 Allow changing log level dynamically 2025-09-13 09:46:10 +03:00
300f9a1317 Fix unused variable warning
TAG constant is only used when run limit is enabled. As a result,
the compiler generates an "unused variable" warning for other cases.
Fixed this warning by adding the unused attribute.
2025-09-13 09:45:13 +03:00
5440440c4d Untrack autogenerated sdkconfig.old file 2025-09-13 09:39:24 +03:00
8416187d86 Fix test_apps directory issue
Fixed test_apps directory locating issue by fixing the path to
"project_root/test_apps" and removed find command since it
searches recursively and founds the similar directories in
managed_components directory. Also added current time to the output.
2025-09-12 15:10:37 +03:00
9f45a2310d Update and enrich the manifest file 2025-09-12 10:27:46 +03:00
a1ff54b6e9 Bump versions to 1.0.0 2025-09-12 09:39:16 +03:00
c718a1380f Merge pull request 'feat/1104-add-examples' (!38) from feat/1104-add-examples into dev
Reviewed-on: #38
2025-09-11 16:44:19 +03:00
6caa4f1bd5 Ignore session specific settings files 2025-09-11 16:03:29 +03:00
4edebf206e Add a multi channel example
Added a multi channel example with run limit, tilting and channel selection
features. Refs #1104 and closes #1111.
2025-09-11 15:50:34 +03:00
e30b445b91 Fix channel validity check
Fixed mistaken channel validity check in `tilt_stop` funciton
in multi mode. Refs #1111 and fixes #1114.
2025-09-11 14:21:24 +03:00
9ee974e677 Add a single channel example
Added a single channel example with run limit and tilting
features. Refs #1104 and closes #1105.
2025-09-09 18:15:32 +03:00
31e351a129 Fix tilting opposite direction when running
Fixed TILT_STOP command issuing chain that was causing a running channel
to be stopped when an opposite direction tilting requested. For exeample:
RUN_FORWARD > TILT_REVERSE. Refs #1105 and fixes #1110.
2025-09-09 17:50:02 +03:00
3ce079c2e8 Fix unwanted reverse tilts
Added a helper function to determine if the channel may perform
the requested tilt command. Refs #1105 and fixes #1109.
2025-09-09 17:09:08 +03:00
a5b320c152 Add state to string API function
Added a state to string public API function. There was already
a private function (`relay_chn_state_str`) that provides
this functionality. So this function has been renamed to
`relay_chn_state_to_str` and made publicly available.

Refs #1104, #1105 and closes #1108.
2025-09-09 10:53:56 +03:00
087deb338e Fix STOP command issuing when idle
Fixed almost unconditional STOP command issuing when the
channel is idle. Refs #1104, #1105 and closes #1107.
2025-09-09 09:26:24 +03:00
fbf8b5dfc8 Fix mispelled config parameter
Fixed a mispelled configuration parameter. Refs #1105
2025-09-09 09:14:28 +03:00
a3f83eaaee Merge pull request 'opt/1085-optimization-and-cleanup' (!37) from opt/1085-optimization-and-cleanup into dev
Reviewed-on: #37
2025-09-05 11:05:41 +03:00
61ca2197e1 Fix conditional compilation issues.
Fixed include directory settings and conditional includes in CMakeLists and test_common.c. Refs #1085.
2025-09-04 18:23:05 +03:00
86cc29a33b Fix static variable names
Fixed static variable names according to the ESP-IDF C code formatting guide.

Refs #1085 and fixes #1103
2025-09-04 18:20:51 +03:00
bf5e3a4426 General code and comment cleanup 2025-09-04 16:59:00 +03:00
7244b57061 Add SPDX license headers to multiple source files
Refs #1085 and closes #1099
2025-09-04 16:23:13 +03:00
7bafc4845f Add default tilt sensitivity get function
Added `relay_chn_tilt_get_default_sensitivity` function and test cases.

Refs #1085 and fixes #1101
2025-09-04 16:16:10 +03:00
ad377ebfc8 Fix the operation of unregistering listener
- Add check for empty listener list in find_listener_entry function.
- Reset notification queue when all listeners are removed.
- Change queue operation to send remove_listener message to the front of the queue.

Refs #1085, #1096 and fixes #1102
2025-09-04 15:46:57 +03:00
a1a54e2ca0 Stop tracking auto generated sdkconfig file 2025-09-04 15:44:26 +03:00
639533cbb6 Refactor and improve unit tests
- Refactored and improved NVS tests to accomodate latest changes in NVS module. See #1098
- Improved channel reset function that is called from `tearDown` to minimize public API calls that trigger a chain of internal calls that involve NVS and timer operations.
- Fixed test case bugs that make some test cases to fail.

Refs #1096, #1098
2025-09-04 15:06:17 +03:00
2c9ee40ff4 Enhance NVS module with a dedicated background task
- Implemented a dedicated background task to decouple long-running code from the main application task.
- Improved the NVS commit code logic, especially for batch writes to minimize flash wear.
- Updated NVS functions to support asynchronous writes and synchronous reads.
- Added default value parameters to `get` functions for better usability.
- Improved error handling and logging in NVS operations.
- Refactored related code in multiple source files to accommodate these changes.

Refs #1085, #1096 and closes #1098
2025-09-04 14:50:38 +03:00
0122ef0803 Fix NVS key bug and optimize for single mode
- Fixed a critical NVS key generation bug that would cause overwriting the values for all channels.
- Optimized the code for single channel mode since no formatting required.
- Improved multi-channel test coverage to cover that each value for each channel stored correctly.

Refs #1096, #1098 and fixes #1100
2025-09-02 17:02:05 +03:00
5e8e5a4cab Add notification system for relay channel state changes
- Introduced a new notification module to handle state change listeners.
- Added functions to register and unregister listeners for relay channel state changes.
- Implemented a queue-based system to manage notifications and listener callbacks.
- Updated core relay channel logic to utilize the new notification system.
- Removed old listener management code from relay channel core.
- Refactored the former listener tests to notify tests and added tests for the notification system, including handling of multiple listeners and queue overflow scenarios.
- Updated CMakeLists.txt to include new source files and headers for the notification module.
- Revised README.md to include warnings about callback execution context and performance considerations.

Refs #1096, #1085 and closes #1097
2025-09-02 15:46:48 +03:00
d2b38a5b4e Ignore autogenerated sdkconfig file 2025-09-02 15:31:53 +03:00
db55c0b7e4 Fix single channel tests in multi mode tests
Some test cases that were testing for only one channel in multi-channel mode are fixed to test all available channels. Fixes #1094
2025-08-29 17:41:42 +03:00
dea9f1e986 Add missing test tags 2025-08-29 14:10:18 +03:00
a2e8e3c120 Implement relay_chn_stop_prv function
Implemented `relay_chn_stop_prv` to streamline stop command handling
and avoid unnecessary code execution. Fixes #1095.
2025-08-28 17:43:14 +03:00
a6d38327b7 Add test cases for *all and *all_with functions
Added test cases for the recently implemented `*all` and `*all_with`
functions. Closes #1089.
2025-08-28 09:34:19 +03:00
0cd6b4e263 Refactor and enhance reset_channels_to_idle_state
- Refactor reset_channels_to_idle_state to reset_channels_to_defaults
and enhance functionality with direction reset logic. This is because
some tilt test cases were failing due to modified run limit values in some
of the previous core test cases. See #1089-3.
- A relay channel listener has been added to diagnose channel
states during tests.

Refs #1089
2025-08-28 09:30:43 +03:00
ec1b25d489 Add missing test cases
Some missing test cases for the public API have been added.

Closes #1090
2025-08-27 17:26:32 +03:00
4eb1bb03a0 Fix function call
Refs #1090
2025-08-27 17:16:06 +03:00
7d597f3725 Fix STOP command does not interrupt
An if statement has been added to handle the STOP command properly
when the `previous_state` is one of the `*PENDING` states.

Fixes #1093
2025-08-27 17:02:02 +03:00
71b632737e Fix esp_timer_start error handling
A helper function added for each module so that each module
handles errors by itself.

Fixes #1092
2025-08-27 15:56:24 +03:00
374647732c Fix possible integer underflow bug
Fixed a possible integer underflow bug that may cause the timer
to be set for an unexpectedly long duration.

Fixes #1091
2025-08-27 14:06:37 +03:00
ae33204a87 Optimize internal stop calls for output errors 2025-08-27 11:03:55 +03:00
79a66c19d7 Rename time_sec to limit_sec in relay channel functions for clarity
Fixes #1087
2025-08-26 18:08:05 +03:00
9a6b8c9f80 Add upper boundary checks for tilt sensitivity settings
The tilt sensitivity values were passed to the NVS module without
the boundaries being checked, even though the maximum
percent value is 100. This commit fixes this issue.
Also test cases are added to cover the upper boundary checks
for the tilt sensitivity settings.

Fixes #1086
2025-08-26 17:43:19 +03:00
0b75df35d1 Use build profiles instead of providing sdkconfig.defaults manually
ESP-IDF provides a more efficient way of handling and combining
multi-configurations for a project than the way currently used:
Build profiles.

So I switched to this method instead of providing the sdkconfig.defaults.*
files manually. This reduced the number of sdkconfig.defaults.* files
as well as the configuration parameters defined in them.

Refs #1085
2025-08-26 17:03:36 +03:00
da953846c9 Refactor function brackets
Refactor the brackets of the test case functions to align with ESP-IDF style.

Refs #1085
2025-08-26 15:19:09 +03:00
15d1673e77 Refactor and improve for batch operations
Refactor tilt test functions to use batch operations for all channels and improve state checks.

Refs #1085
2025-08-26 15:03:16 +03:00
329812aecc Enhance relay command handling
- `TILT_STOP` command is prioritized in `relay_chn_tilt_issue_cmd()` because it should override any other tilt commands.
- The debug logs are cleaned up.

Fixes #1088
Refs #1085
2025-08-26 13:37:48 +03:00
54c8dc26fc Add .ESP-IDF vscode configuration files 2025-08-26 12:10:02 +03:00