release-1.0.0 #39

Merged
ismail merged 78 commits from release-1.0.0 into main 2025-09-13 10:55:49 +02:00
3 changed files with 29 additions and 3 deletions
Showing only changes of commit 0cd6b4e263 - Show all commits

View File

@@ -25,7 +25,7 @@ void setUp()
void tearDown() void tearDown()
{ {
reset_channels_to_idle_state(); reset_channels_to_defaults();
} }
#if CONFIG_RELAY_CHN_ENABLE_NVS #if CONFIG_RELAY_CHN_ENABLE_NVS

View File

@@ -32,17 +32,40 @@ const uint8_t gpio_map[] = {4, 5};
const uint8_t gpio_count = sizeof(gpio_map) / sizeof(gpio_map[0]); const uint8_t gpio_count = sizeof(gpio_map) / sizeof(gpio_map[0]);
void reset_channels_to_idle_state() void reset_channels_to_defaults()
{ {
#if CONFIG_RELAY_CHN_COUNT > 1 #if CONFIG_RELAY_CHN_COUNT > 1
relay_chn_stop_all(); relay_chn_stop_all();
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
relay_chn_set_run_limit_all_with(CONFIG_RELAY_CHN_RUN_LIMIT_DEFAULT_SEC);
#endif
vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS)); vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS));
for (int i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) { for (int i = 0; i < CONFIG_RELAY_CHN_COUNT; i++) {
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state(i)); TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state(i));
// Reset directions
if (relay_chn_get_direction(i) != RELAY_CHN_DIRECTION_DEFAULT) {
relay_chn_flip_direction(i);
TEST_ASSERT_EQUAL(RELAY_CHN_DIRECTION_DEFAULT, relay_chn_get_direction(i));
}
} }
#else #else
relay_chn_stop(); relay_chn_stop();
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
relay_chn_set_run_limit(CONFIG_RELAY_CHN_RUN_LIMIT_DEFAULT_SEC);
#endif
// Reset direction
if (relay_chn_get_direction() != RELAY_CHN_DIRECTION_DEFAULT) {
relay_chn_flip_direction();
TEST_ASSERT_EQUAL(RELAY_CHN_DIRECTION_DEFAULT, relay_chn_get_direction());
}
vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS)); vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state()); TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state());
#endif #endif
} }
void test_state_listener(uint8_t id, relay_chn_state_t old_state, relay_chn_state_t new_state)
{
ESP_LOGI(TEST_TAG, "test_state_listener: id: %d, old_state: %d, new_state: %d", id, old_state, new_state);
}

View File

@@ -18,4 +18,7 @@ extern const uint8_t gpio_count;
#define TEST_DELAY_MARGIN_MS 50 #define TEST_DELAY_MARGIN_MS 50
// Reset channels to Idle state // Reset channels to Idle state
void reset_channels_to_idle_state(void); void reset_channels_to_defaults(void);
// Relay channel state listener for tests
void test_state_listener(uint8_t id, relay_chn_state_t old_state, relay_chn_state_t new_state);