General code and comment cleanup

This commit is contained in:
2025-09-04 16:59:00 +03:00
parent 7244b57061
commit bf5e3a4426
25 changed files with 213 additions and 218 deletions

View File

@@ -44,15 +44,15 @@ TEST_CASE("Run Forward to Tilt Forward transition with inertia", "[relay_chn][ti
prepare_channel_for_tilt(RELAY_CHN_CMD_FORWARD);
// 1. Start in forward direction
relay_chn_run_forward();
relay_chn_run_forward();
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_FORWARD, relay_chn_get_state());
// 2. Issue tilt forward command
relay_chn_tilt_forward();
relay_chn_tilt_forward();
// After tilt command, it should immediately stop and then trigger inertia.
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_STOPPED, relay_chn_get_state());
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_STOPPED, relay_chn_get_state());
// Wait for the inertia period (after which the tilt command will be dispatched)
vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS));
@@ -67,12 +67,12 @@ TEST_CASE("Run Reverse to Tilt Reverse transition with inertia", "[relay_chn][ti
prepare_channel_for_tilt(RELAY_CHN_CMD_REVERSE);
// 1. Start in reverse direction
relay_chn_run_reverse();
relay_chn_run_reverse();
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_REVERSE, relay_chn_get_state());
// 2. Issue tilt reverse command
relay_chn_tilt_reverse();
relay_chn_tilt_reverse();
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_STOPPED, relay_chn_get_state());
@@ -89,9 +89,9 @@ TEST_CASE("FREE to Tilt Forward transition with inertia (prepared)", "[relay_chn
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state()); // Ensure we are back to FREE
// Issue tilt forward command
relay_chn_tilt_forward();
relay_chn_tilt_forward();
// From FREE state, tilt command should still incur the inertia due to the internal timer logic
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_TILT_FORWARD, relay_chn_get_state());
}
@@ -104,7 +104,7 @@ TEST_CASE("FREE to Tilt Reverse transition with inertia (prepared)", "[relay_chn
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_IDLE, relay_chn_get_state()); // Ensure we are back to FREE
// Issue tilt reverse command
relay_chn_tilt_reverse();
relay_chn_tilt_reverse();
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_TILT_REVERSE, relay_chn_get_state());
}
@@ -120,7 +120,7 @@ TEST_CASE("Tilt Forward to Run Forward transition with inertia", "[relay_chn][ti
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_TILT_FORWARD, relay_chn_get_state());
// 2. Issue run forward command
relay_chn_run_forward();
relay_chn_run_forward();
// From Tilt to Run in the same logical name but in the opposite direction, inertia is expected.
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_FORWARD_PENDING, relay_chn_get_state());
vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS));
@@ -138,7 +138,7 @@ TEST_CASE("Tilt Reverse to Run Reverse transition with inertia", "[relay_chn][ti
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_TILT_REVERSE, relay_chn_get_state());
// 2. Issue run reverse command
relay_chn_run_reverse();
relay_chn_run_reverse();
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_REVERSE_PENDING, relay_chn_get_state());
vTaskDelay(pdMS_TO_TICKS(CONFIG_RELAY_CHN_OPPOSITE_INERTIA_MS + TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_REVERSE, relay_chn_get_state());
@@ -155,7 +155,7 @@ TEST_CASE("Tilt Forward to Run Reverse transition without inertia", "[relay_chn]
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_TILT_FORWARD, relay_chn_get_state());
// 2. Issue run reverse command (opposite direction)
relay_chn_run_reverse();
relay_chn_run_reverse();
vTaskDelay(pdMS_TO_TICKS(TEST_DELAY_MARGIN_MS));
TEST_ASSERT_EQUAL(RELAY_CHN_STATE_REVERSE, relay_chn_get_state());
}