fix(test): simplify TEST_CAN ALERT to single-level param like VIOLATION/COLLISION

This commit is contained in:
miketsai 2026-06-14 14:42:58 +08:00
parent 0d924d139c
commit fa67a9f225

View File

@ -676,10 +676,8 @@ static void handle_test_cmd(const char *raw)
int lv = atoi(cmd + 18); int lv = atoi(cmd + 18);
test_can_event("COLLISION", lv, lv ? SPEED_LIMIT_STOP : SPEED_LIMIT_NORMAL); test_can_event("COLLISION", lv, lv ? SPEED_LIMIT_STOP : SPEED_LIMIT_NORMAL);
} else if (strncmp(cmd, "TEST_CAN ALERT", 14) == 0) { } else if (strncmp(cmd, "TEST_CAN ALERT", 14) == 0) {
int ll = 0, rl = 0; int lv = atoi(cmd + 14);
sscanf(cmd + 14, " %d %d", &ll, &rl); test_can_event("ALERT", lv, lv ? SPEED_LIMIT_ALERT : SPEED_LIMIT_NORMAL);
int active = ll || rl;
test_can_event("ALERT", active, active ? SPEED_LIMIT_ALERT : SPEED_LIMIT_NORMAL);
} else if (strncmp(cmd, "TEST_BUZZER_ALL", 15) == 0) { } else if (strncmp(cmd, "TEST_BUZZER_ALL", 15) == 0) {
if (s_test_all_running) { test_reply("TEST_ERR ALL_ALREADY_RUNNING"); return; } if (s_test_all_running) { test_reply("TEST_ERR ALL_ALREADY_RUNNING"); return; }
s_test_all_running = 1; s_test_all_running = 1;