Repo unification

This commit is contained in:
2024-03-12 21:22:26 +02:00
parent 7aa7edba33
commit 02cb3a9c70
152 changed files with 14575 additions and 2038 deletions

View File

@@ -0,0 +1,86 @@
#include "ut_coil.h"
#include "..\..\src\logic\coil.h"
static int ut_coil_target(uint8_t force, uint8_t hbrake_act, int16_t exp_out)
{
int16_t out = coil_target(force, hbrake_act);
printf("Force:%d Handbrake:%d \n", force, hbrake_act);
printf("Output:%d Expected:%d\n", out, exp_out);
if(out==exp_out)
{
printf("PASS\n\n");
return 1;
}
else
{
printf("FAIL\n\n");
return 0;
}
}
int ut_coil_target_test(void)
{
printf("******************************************************\n");
printf("int16_t coil_target(uint8_t force, uint8_t hbrake_act)\n");
int test_res;
int pass = 1;
uint8_t force;
uint8_t hbrake;
int16_t exp_out;
force = 0;
hbrake = 0;
exp_out = 0;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 50;
hbrake = 0;
exp_out = COIL_LOCK_VOLTAGE/2;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 100;
hbrake = 0;
exp_out = COIL_LOCK_VOLTAGE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 255;
hbrake = 0;
exp_out = COIL_LOCK_VOLTAGE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 0;
hbrake = 1;
exp_out = COIL_TARGET_HANDBRAKE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 50;
hbrake = 1;
exp_out = COIL_TARGET_HANDBRAKE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 100;
hbrake = 1;
exp_out = COIL_TARGET_HANDBRAKE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
force = 255;
hbrake = 1;
exp_out = COIL_TARGET_HANDBRAKE;
test_res = ut_coil_target(force, hbrake, exp_out);
if(!test_res) pass = 0;
return pass;
}