Commit Graph

81 Commits

Author SHA1 Message Date
96bb139751 Add new utility script and update test tags
- Added new utility script run_tests_all_cfgs.sh to run tests for all configurations and with test tag support.
- Updated run_tests.sh to add the new test tag for NVS unit tests.
2025-08-19 17:40:26 +03:00
61edf11b75 Refactor to remove redundant initialization and add NVS storage tests
- Removed unnecessary calls to relay_chn_create and g_is_component_initialized in multiple test cases across test_relay_chn_core_single.c, test_relay_chn_listener_multi.c, and test_relay_chn_listener_single.c.
- Introduced new test files for NVS functionality: test_relay_chn_nvs_multi.c and test_relay_chn_nvs_single.c, covering initialization, direction setting, invalid parameters, and erase operations.
- Updated partition table configuration to support NVS storage, including the addition of a new partition file part_nvs.csv.
- Adjusted sdkconfig files to enable NVS support and configure custom partition settings for relay channels.
2025-08-19 17:36:23 +03:00
b19f0c553b 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.
2025-08-19 17:33:45 +03:00
f04632dc77 Unignore .vscode folder.
Unignore .vscode folder and add necessary configuration files for a
synced development environment.
2025-08-14 16:55:25 +03:00
b29768edad Merge pull request 'feat/957-single-channel-mode' (!32) from feat/957-single-channel-mode into dev
Reviewed-on: #32
2025-08-14 09:50:36 +03:00
f1cda4531d Merge remote-tracking branch 'origin/main' into feat/957-single-channel-mode 2025-08-13 18:36:48 +03:00
f8d6e74f23 Refactor and update configuration for single channel mode
- Created `test_relay_chn_tilt_multi.c` and `test_relay_chn_tilt_single.c` to implement comprehensive tests for the tilt functionality of relay channels, covering various scenarios including transitions between states and sensitivity settings.
- Introduced a new partition table in `partitionTable.csv` for proper memory management.
- Updated `sdkconfig` to set the relay channel count to 1 for single channel testing and adjusted related configurations.
- Added default configuration file `sdkconfig.defaults.single` for streamlined testing setup.
2025-08-13 18:36:48 +03:00
9f1134763e Refactor and update the relay_chn component.
Refactor relay channel component to support single and multi-channel modes; update CMake configuration and enhance API documentation.
2025-08-13 18:36:48 +03:00
61f8ed440e Add single channel mode feature.
The addition of a single-channel mode implied further modularisation of the component. This commit has broken the component down into the following modules to avoid a huge single source file and to make unit testing easier.

The modules:

- Separation of public and private code
- *types and *defs
- public relay_chn API
- *adapter
- *output
- *run_info
- *core
- *ctl (control)
- *tilt

Closes #957.
2025-08-13 18:31:05 +03:00
1776c81c8d Merge pull request 'release-0.5.0' (!31) from release-0.5.0 into main
Reviewed-on: #31
0.5.0
2025-07-23 17:48:18 +03:00
22668b6759 Merge pull request 'release-0.5.0' (!30) from release-0.5.0 into dev
Reviewed-on: #30
2025-07-23 17:45:26 +03:00
2e81966afb Bump version to 0.5.0 and update repo URLs. 2025-07-23 17:37:27 +03:00
5734f47cd3 Merge pull request 'feat/1030-more-unit-tests' (!29) from feat/1030-more-unit-tests into dev
Reviewed-on: #29
2025-07-22 16:59:47 +03:00
d884f5f45c Add missing test cases for tilt API.
Added missing test cases for the tilt API.

Closes #1056.
2025-07-22 10:02:40 +03:00
c7678d6084 Add restart chip to make qemu exit in tests. 2025-07-22 10:00:33 +03:00
8527ebea83 Fix imbalanced tilt counts.
Fixed the tilt count logic that causes an imbalance in tilting within the same run frame but opposite direction.

Fixes #1057.
2025-07-22 09:58:59 +03:00
f31eae649f Add a shell utility for running tests. 2025-07-21 18:47:41 +03:00
a143484748 Break down tests into categories.
Break down tests into categories to improve maintainability and test granularity. This makes it easier to execute unit tests in CI/CD pipelines.

Closes #1054.
2025-07-21 15:37:49 +03:00
a9a8169710 Add test cases for ID_ALL channel id.
Add test cases to test all relevant functions that support operating with the `RELAY_CHN_ID_ALL` channel id.

Closes #1052.
2025-07-16 11:42:44 +03:00
74f4341c1d Add test cases for direction flip.
Closes #1051.
2025-07-15 16:14:19 +03:00
a587036093 Add tests for init error handling.
Added tests for covering initialization error handling cases like; NULL pointer, invalid GPIO count etc.

This changed implied removing the `relay_chn_create` from the Unity's `setUp` function and place it in each testcase.

Refs #1050, #1030.
2025-07-15 12:23:21 +03:00
82312ba7c3 Add NULL handling for the gpio_num pointer.
Fixes #1050.
2025-07-15 12:17:46 +03:00
db62a7b5b2 Fix listener memory allocation bug.
- Replaced the buggy, oldschool, plain pointer based list approach with more robust FreeRTOS linked list implementation for the listener API. Fixes #1049.

- Added relevant test cases. Refs #1030.
2025-07-14 18:49:47 +03:00
1ee70be715 Fix invalid ID test loops. 2025-07-14 18:49:47 +03:00
f1cb928341 Add missing destroy function.
The component allocates resources (timers, event loop) in relay_chn_create but never frees them. This is a resource leak.
Hence, a destroy function added to free the resources gracefully.

Fixes #1048.
2025-07-14 11:37:14 +03:00
a90649a4d3 Clean and add more tests.
Clean the unnecessary codes and logging macros to keep the test output cleaner.
Add fail tests for the `get_state*` functions.
2025-07-11 18:32:28 +03:00
b239b50abe Fix invalid channel ID handling.
Fix the issue where get_state* functions do not handle when id is RELAY_CHN_ID_ALL.
Fixes #1037.
2025-07-11 18:28:59 +03:00
9b2274ed7c Add default configs for unit tests. 2025-07-11 17:35:50 +03:00
5a38956146 Restructure the project tree.
Restructured the project tree to align with Espressif's project tree pattern and practice. Also updated the affected cmake files.

Fixes: #1033
2025-07-07 22:57:02 +03:00
82168f34eb Delete this ghost file appeared out of nowhere. 2025-07-07 20:25:45 +03:00
2165e9d571 Merge pull request 'release-0.4.0' (!28) from release-0.4.0 into main
Reviewed-on: KozmotronikTech/relay_chn_component#28
2025-07-07 14:45:01 +03:00
0ebe1c791e Merge pull request 'fix/134-testing-issues' (!27) from fix/134-testing-issues into dev
Reviewed-on: KozmotronikTech/relay_chn_component#27
0.4.0
2025-07-07 14:31:27 +03:00
bacbe03e12 Update the manifest file with the latest information. 2025-07-07 09:50:36 +03:00
be09cb883a Correct the installation description.
Fixes  #1027
2025-07-07 09:39:29 +03:00
925fd5de74 Update descriptions about the inertia timing.
Fixes #1027
2025-07-07 09:27:28 +03:00
2e3e92bb63 Fix testing issues and add more tests.
Fixes #134.
Fix unit testing issues. Add more tests to cover more code.
2025-07-04 17:55:33 +03:00
c4482b8d49 Fix unhandled tilt to run mode transitions.
Fixes #1028.
This commit add unhandled logic to the relay_chn_issue_cmd function to handle transitions from tilt mode to run mode.
2025-07-04 17:31:31 +03:00
41c292cc89 Restructure the project tree for unit testing
Restructure the whole project tree so that the component can be unit tested. Also update some cmake files to update the modified paths, update test cases etc.
2025-07-04 00:38:57 +03:00
ed5b86e863 Fix CMakeLists.txt definitions and test cases. 2025-07-03 18:58:09 +03:00
c0c7fbf3df Merge pull request 'Fix error handling issues.' (!26) from release-0.3.2 into main
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/26
v0.3.2 0.3.2
2025-04-03 10:21:37 +03:00
a1c66d51c7 Merge pull request 'Fix error handling issues.' from fix/172-fix-error-handling into dev
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/25
2025-04-02 14:39:49 +03:00
421dea7d69 Merge pull request 'fix/172-fix-error-handling' (!24) from fix/172-fix-error-handling into fix/134-testing-issues
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/24
2025-04-02 14:38:32 +03:00
99d753238b Fix error handling issues.
Fix error handling so that the value in ret variable does not become corrupt.
2025-04-02 14:05:48 +03:00
7afe6144bd Set dev branch's upstream. 2025-03-24 09:31:33 +03:00
4f39308f13 Merge pull request 'fix/162-fix-error-handling' from fix/162-fix-error-handling into fix/134-testing-issues
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/23
2025-03-21 17:30:13 +03:00
fb425edc4b Merge pull request 'release-0.3.1' from release-0.3.1 into main
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/22
v0.3.1
2025-03-21 17:06:05 +03:00
805df016fe Merge pull request 'fix/162-fix-error-handling' from fix/162-fix-error-handling into dev
Reviewed-on: https://dev.kozmotronik.com.tr/gitea/KozmotronikTech/relay_chn/pulls/21
2025-03-21 16:44:34 +03:00
f230477cad Fix error handling in the init function. 2025-03-21 16:42:06 +03:00
e19bd09389 Update gitignore as per esp-idf gitignore. 2025-03-21 16:41:22 +03:00
11786b7a06 Remove unnecessary unity functions. 2025-03-04 09:49:04 +03:00