Upgrade to Zephyr v4.3 and migrate boards
Also use new Zephyr CI environment and compile all boards. Board migration script example: python ../zephyr/scripts/utils/board_v1_to_v2.py --board-root . \ -v libresolar -g libresolar -b pwm_2420_lus -s stm32l072xx
This commit is contained in:
+3
-1
@@ -23,7 +23,7 @@ void tearDown(void) {}
|
||||
|
||||
} /* extern "C" */
|
||||
|
||||
void main()
|
||||
int main()
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
@@ -42,4 +42,6 @@ void main()
|
||||
#ifdef CONFIG_ARCH_POSIX
|
||||
posix_exit(err);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ static void init_structs()
|
||||
void no_start_at_high_voltage()
|
||||
{
|
||||
init_structs();
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage + 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage + 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_IDLE, charger.state);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ void no_start_after_short_rest()
|
||||
{
|
||||
init_structs();
|
||||
charger.time_state_changed = time(NULL) - bat_conf.time_limit_recharge + 1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_IDLE, charger.state);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void no_start_outside_temperature_limits()
|
||||
{
|
||||
init_structs();
|
||||
charger.bat_temperature = bat_conf.charge_temp_max + 1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_IDLE, charger.state);
|
||||
|
||||
@@ -56,7 +56,7 @@ void start_if_everything_just_fine()
|
||||
{
|
||||
init_structs();
|
||||
charger.time_state_changed = time(NULL) - bat_conf.time_limit_recharge - 1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_BULK, charger.state);
|
||||
}
|
||||
@@ -65,11 +65,11 @@ void enter_topping_at_voltage_setpoint()
|
||||
{
|
||||
init_structs();
|
||||
charger.time_state_changed = time(NULL) - bat_conf.time_limit_recharge - 1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.recharge_voltage - 0.1f;
|
||||
bat_terminal.bus->voltage_filtered = bat_terminal.bus->voltage;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_BULK, charger.state);
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1f;
|
||||
bat_terminal.bus->voltage_filtered = bat_terminal.bus->voltage;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_TOPPING, charger.state);
|
||||
@@ -80,9 +80,9 @@ void topping_to_bulk_after_8h_low_power()
|
||||
enter_topping_at_voltage_setpoint();
|
||||
|
||||
charger.time_state_changed = time(NULL) - 8 * 60 * 60 + 1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage - 0.1f;
|
||||
bat_terminal.bus->voltage_filtered = bat_terminal.bus->voltage;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current + 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current + 0.1f;
|
||||
bat_terminal.current_filtered = bat_terminal.current;
|
||||
|
||||
charger.charge_control(&bat_conf);
|
||||
@@ -98,10 +98,10 @@ void stop_topping_after_time_limit()
|
||||
enter_topping_at_voltage_setpoint();
|
||||
|
||||
charger.target_voltage_timer = bat_conf.topping_duration - 1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current + 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current + 0.1f;
|
||||
bat_terminal.current_filtered = bat_terminal.current;
|
||||
bat_terminal.bus->voltage =
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
bat_terminal.bus->voltage_filtered = bat_terminal.bus->voltage;
|
||||
|
||||
charger.charge_control(&bat_conf);
|
||||
@@ -117,10 +117,10 @@ void stop_topping_at_cutoff_current()
|
||||
enter_topping_at_voltage_setpoint();
|
||||
|
||||
charger.target_voltage_timer = 0;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
bat_terminal.current_filtered = bat_terminal.current;
|
||||
bat_terminal.bus->voltage =
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
bat_terminal.bus->voltage_filtered = bat_terminal.bus->voltage;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_FLOAT, charger.state);
|
||||
@@ -132,9 +132,9 @@ void float_to_idle_for_li_ion()
|
||||
battery_conf_init(&bat_conf, BAT_TYPE_LFP, 4, 100);
|
||||
|
||||
charger.time_state_changed = time(NULL) - 1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
bat_terminal.bus->voltage =
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_IDLE, charger.state);
|
||||
}
|
||||
@@ -150,8 +150,8 @@ void no_equalization_if_disabled()
|
||||
charger.time_last_equalization = time(NULL) - bat_conf.equalization_trigger_days * 24 * 60 * 60;
|
||||
|
||||
charger.time_state_changed = time(NULL) - 1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1f;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_NOT_EQUAL(CHG_STATE_EQUALIZATION, charger.state);
|
||||
}
|
||||
@@ -168,8 +168,8 @@ void no_equalization_if_limits_not_reached()
|
||||
time(NULL) - (bat_conf.equalization_trigger_days - 1) * 24 * 60 * 60;
|
||||
|
||||
charger.time_state_changed = time(NULL) - 1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.topping_voltage + 0.1f;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_NOT_EQUAL(CHG_STATE_EQUALIZATION, charger.state);
|
||||
}
|
||||
@@ -181,9 +181,9 @@ void float_to_equalization_if_enabled_and_time_limit_reached()
|
||||
charger.time_last_equalization = time(NULL) - bat_conf.equalization_trigger_days * 24 * 60 * 60;
|
||||
|
||||
charger.time_state_changed = time(NULL) - 1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
bat_terminal.bus->voltage =
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_EQUALIZATION, charger.state);
|
||||
}
|
||||
@@ -196,9 +196,9 @@ void float_to_equalization_if_enabled_and_deep_dis_limit_reached()
|
||||
charger.num_deep_discharges - bat_conf.equalization_trigger_deep_cycles;
|
||||
|
||||
charger.time_state_changed = time(NULL) - 1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1;
|
||||
bat_terminal.current = bat_conf.topping_cutoff_current - 0.1f;
|
||||
bat_terminal.bus->voltage =
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
bat_conf.topping_voltage - bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_EQUALIZATION, charger.state);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ void stop_equalization_after_time_limit()
|
||||
|
||||
charger.time_state_changed = time(NULL) - bat_conf.equalization_duration + 1;
|
||||
bat_terminal.bus->voltage = bat_conf.equalization_voltage
|
||||
- bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1;
|
||||
- bat_terminal.current * bat_terminal.bus->sink_droop_res + 0.1f;
|
||||
|
||||
charger.charge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(CHG_STATE_EQUALIZATION, charger.state);
|
||||
@@ -232,7 +232,7 @@ void stop_discharge_at_low_voltage()
|
||||
charger.discharge_control(&bat_conf);
|
||||
TEST_ASSERT_LESS_THAN(0, bat_terminal.neg_current_limit);
|
||||
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage - 0.1f;
|
||||
charger.discharge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(0, bat_terminal.neg_current_limit);
|
||||
}
|
||||
@@ -262,17 +262,17 @@ void restart_discharge_if_allowed()
|
||||
init_structs();
|
||||
|
||||
// stop because of undervoltage
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage - 0.1;
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage - 0.1f;
|
||||
charger.discharge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(0, bat_terminal.neg_current_limit);
|
||||
|
||||
// increase voltage slightly above absolute minimum
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage + 0.05;
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage + 0.05f;
|
||||
charger.discharge_control(&bat_conf);
|
||||
TEST_ASSERT_EQUAL(0, bat_terminal.neg_current_limit);
|
||||
|
||||
// increase voltage above hysteresis voltage
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage + 0.15;
|
||||
bat_terminal.bus->voltage = bat_conf.absolute_min_voltage + 0.15f;
|
||||
charger.discharge_control(&bat_conf);
|
||||
TEST_ASSERT_LESS_THAN(0, bat_terminal.neg_current_limit);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ void adc_alert_lv_undervoltage_triggering()
|
||||
adc_update_value(ADC_POS(v_low));
|
||||
|
||||
// undervoltage test
|
||||
adcval.battery_voltage = bat_conf.absolute_min_voltage - 0.1;
|
||||
adcval.battery_voltage = bat_conf.absolute_min_voltage - 0.1f;
|
||||
prepare_adc_readings(adcval);
|
||||
adc_update_value(ADC_POS(v_low));
|
||||
TEST_ASSERT_EQUAL(false, dev_stat.has_error(ERR_LOAD_VOLTAGE_DIP));
|
||||
@@ -130,7 +130,7 @@ void adc_alert_lv_overvoltage_triggering()
|
||||
dcdc.state = DCDC_CONTROL_MPPT;
|
||||
|
||||
// overvoltage test
|
||||
adcval.battery_voltage = bat_conf.absolute_max_voltage + 0.1;
|
||||
adcval.battery_voltage = bat_conf.absolute_max_voltage + 0.1f;
|
||||
prepare_adc_readings(adcval);
|
||||
adc_update_value(ADC_POS(v_low));
|
||||
TEST_ASSERT_EQUAL(false, dev_stat.has_error(ERR_BAT_OVERVOLTAGE));
|
||||
|
||||
+16
-16
@@ -136,7 +136,7 @@ void no_start_if_dcdc_disabled()
|
||||
void no_start_if_dcdc_lv_voltage_low()
|
||||
{
|
||||
init_structs_buck();
|
||||
lv_terminal.bus->voltage = dcdc.ls_voltage_min - 0.5;
|
||||
lv_terminal.bus->voltage = dcdc.ls_voltage_min - 0.5f;
|
||||
TEST_ASSERT_EQUAL(DCDC_MODE_OFF, dcdc.check_start_conditions());
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void no_start_if_dcdc_lv_voltage_low()
|
||||
void no_buck_start_if_bat_voltage_high()
|
||||
{
|
||||
init_structs_buck();
|
||||
lv_terminal.bus->voltage = bat_conf.topping_voltage + 0.1;
|
||||
lv_terminal.bus->voltage = bat_conf.topping_voltage + 0.1f;
|
||||
TEST_ASSERT_EQUAL(DCDC_MODE_OFF, dcdc.check_start_conditions());
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ void no_buck_start_if_solar_voltage_low()
|
||||
void no_boost_start_if_bat_voltage_high()
|
||||
{
|
||||
init_structs_boost();
|
||||
hv_terminal.bus->voltage = bat_conf.topping_voltage + 0.1;
|
||||
hv_terminal.bus->voltage = bat_conf.topping_voltage + 0.1f;
|
||||
TEST_ASSERT_EQUAL(DCDC_MODE_OFF, dcdc.check_start_conditions());
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ void buck_derating_output_voltage_too_high()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
lv_terminal.bus->voltage = lv_terminal.bus->sink_voltage_intercept + 0.1;
|
||||
lv_terminal.bus->voltage = lv_terminal.bus->sink_voltage_intercept + 0.1f;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after < pwm_before); // less duty cycle = higher voltage
|
||||
@@ -226,7 +226,7 @@ void buck_derating_output_current_too_high()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
lv_terminal.current = lv_terminal.pos_current_limit + 0.1;
|
||||
lv_terminal.current = lv_terminal.pos_current_limit + 0.1f;
|
||||
lv_terminal.update_bus_current_margins();
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
@@ -238,7 +238,7 @@ void buck_derating_inductor_current_too_high()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
dcdc.inductor_current = dcdc.inductor_current_max + 0.1;
|
||||
dcdc.inductor_current = dcdc.inductor_current_max + 0.1f;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after < pwm_before);
|
||||
@@ -249,8 +249,8 @@ void buck_derating_input_voltage_too_low()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->src_voltage_intercept - 0.1;
|
||||
dcdc.power = 1.2;
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->src_voltage_intercept - 0.1f;
|
||||
dcdc.power = 1.2f;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after < pwm_before);
|
||||
@@ -261,7 +261,7 @@ void buck_derating_input_current_too_high()
|
||||
{
|
||||
start_buck();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.current = hv_terminal.neg_current_limit - 0.1;
|
||||
hv_terminal.current = hv_terminal.neg_current_limit - 0.1f;
|
||||
hv_terminal.update_bus_current_margins();
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
@@ -290,7 +290,7 @@ void buck_stop_input_power_too_low()
|
||||
void buck_stop_high_voltage_emergency()
|
||||
{
|
||||
start_buck();
|
||||
lv_terminal.bus->voltage = dcdc.ls_voltage_max + 0.1;
|
||||
lv_terminal.bus->voltage = dcdc.ls_voltage_max + 0.1f;
|
||||
dcdc.control();
|
||||
TEST_ASSERT(half_bridge_enabled() == false);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void boost_derating_output_voltage_too_high()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->sink_voltage_intercept + 0.5;
|
||||
hv_terminal.bus->voltage = hv_terminal.bus->sink_voltage_intercept + 0.5f;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after > pwm_before); // higher duty cycle = less power
|
||||
@@ -339,7 +339,7 @@ void boost_derating_output_current_too_high()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
hv_terminal.current = hv_terminal.pos_current_limit + 0.1;
|
||||
hv_terminal.current = hv_terminal.pos_current_limit + 0.1f;
|
||||
hv_terminal.update_bus_current_margins();
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
@@ -350,8 +350,8 @@ void boost_derating_input_voltage_too_low()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
lv_terminal.bus->voltage = lv_terminal.bus->src_voltage_intercept - 0.1;
|
||||
dcdc.power = -1.2;
|
||||
lv_terminal.bus->voltage = lv_terminal.bus->src_voltage_intercept - 0.1f;
|
||||
dcdc.power = -1.2f;
|
||||
hv_terminal.update_bus_current_margins();
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
@@ -363,7 +363,7 @@ void boost_derating_input_current_too_high()
|
||||
{
|
||||
start_boost();
|
||||
float pwm_before = half_bridge_get_duty_cycle();
|
||||
dcdc.inductor_current = lv_terminal.neg_current_limit - 0.1;
|
||||
dcdc.inductor_current = lv_terminal.neg_current_limit - 0.1f;
|
||||
dcdc.control();
|
||||
float pwm_after = half_bridge_get_duty_cycle();
|
||||
TEST_ASSERT(pwm_after > pwm_before);
|
||||
@@ -390,7 +390,7 @@ void boost_stop_input_power_too_low()
|
||||
void boost_stop_high_voltage_emergency()
|
||||
{
|
||||
start_boost();
|
||||
hv_terminal.bus->voltage = dcdc.hs_voltage_max + 0.1;
|
||||
hv_terminal.bus->voltage = dcdc.hs_voltage_max + 0.1f;
|
||||
dcdc.control();
|
||||
TEST_ASSERT(half_bridge_enabled() == false);
|
||||
}
|
||||
|
||||
+10
-10
@@ -81,7 +81,7 @@ static void control_on_to_off_shedding()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init, NULL);
|
||||
load_init(&load_out, true);
|
||||
|
||||
bus.voltage = load_out.disconnect_voltage - 0.1;
|
||||
bus.voltage = load_out.disconnect_voltage - 0.1f;
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(ERR_LOAD_SHEDDING, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_OFF, load_out.state);
|
||||
@@ -93,7 +93,7 @@ void control_on_to_off_overvoltage()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init, NULL);
|
||||
load_init(&load_out, true);
|
||||
|
||||
bus.voltage = bus.sink_voltage_intercept + 0.6;
|
||||
bus.voltage = bus.sink_voltage_intercept + 0.6f;
|
||||
|
||||
// increase debounce counter to 1 before limit
|
||||
for (int i = 0; i < CONFIG_CONTROL_FREQUENCY; i++) {
|
||||
@@ -114,7 +114,7 @@ void control_on_to_off_overvoltage_dual_battery()
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init, NULL);
|
||||
load_init(&load_out, true, 2);
|
||||
|
||||
bus.voltage = (bus.sink_voltage_intercept + 0.6) * bus.series_multiplier;
|
||||
bus.voltage = (bus.sink_voltage_intercept + 0.6f) * bus.series_multiplier;
|
||||
|
||||
// increase debounce counter to 1 before limit
|
||||
for (int i = 0; i < CONFIG_CONTROL_FREQUENCY; i++) {
|
||||
@@ -136,7 +136,7 @@ void control_on_to_off_overcurrent()
|
||||
load_init(&load_out, true);
|
||||
|
||||
// current slightly below factor 2 so that it is not switched off immediately
|
||||
load_out.current = DT_PROP(DT_CHILD(DT_PATH(outputs), load), current_max) * 1.9;
|
||||
load_out.current = DT_PROP(DT_CHILD(DT_PATH(outputs), load), current_max) * 1.9f;
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_ON, load_out.state);
|
||||
|
||||
@@ -227,19 +227,19 @@ void control_off_overvoltage_to_on_at_lower_voltage()
|
||||
DcBus bus = {};
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init, NULL);
|
||||
load_init(&load_out);
|
||||
bus.voltage = load_out.overvoltage + 0.1;
|
||||
bus.voltage = load_out.overvoltage + 0.1f;
|
||||
load_out.error_flags = ERR_LOAD_OVERVOLTAGE;
|
||||
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(ERR_LOAD_OVERVOLTAGE, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_OFF, load_out.state);
|
||||
|
||||
bus.voltage = load_out.overvoltage - 0.1; // test hysteresis
|
||||
bus.voltage = load_out.overvoltage - 0.1f; // test hysteresis
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(ERR_LOAD_OVERVOLTAGE, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_OFF, load_out.state);
|
||||
|
||||
bus.voltage = load_out.overvoltage - load_out.ov_hysteresis - 0.1;
|
||||
bus.voltage = load_out.overvoltage - load_out.ov_hysteresis - 0.1f;
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(0, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_ON, load_out.state);
|
||||
@@ -250,19 +250,19 @@ void control_off_overvoltage_to_on_at_lower_voltage_dual_battery()
|
||||
DcBus bus = {};
|
||||
LoadOutput load_out(&bus, &load_drv_set, &load_drv_init, NULL);
|
||||
load_init(&load_out, false, 2);
|
||||
bus.voltage = (load_out.overvoltage + 0.1) * bus.series_multiplier;
|
||||
bus.voltage = (load_out.overvoltage + 0.1f) * bus.series_multiplier;
|
||||
load_out.error_flags = ERR_LOAD_OVERVOLTAGE;
|
||||
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(ERR_LOAD_OVERVOLTAGE, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_OFF, load_out.state);
|
||||
|
||||
bus.voltage = (load_out.overvoltage - 0.1) * bus.series_multiplier; // test hysteresis
|
||||
bus.voltage = (load_out.overvoltage - 0.1f) * bus.series_multiplier; // test hysteresis
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(ERR_LOAD_OVERVOLTAGE, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_OFF, load_out.state);
|
||||
|
||||
bus.voltage = (load_out.overvoltage - load_out.ov_hysteresis - 0.1) * bus.series_multiplier;
|
||||
bus.voltage = (load_out.overvoltage - load_out.ov_hysteresis - 0.1f) * bus.series_multiplier;
|
||||
load_out.control();
|
||||
TEST_ASSERT_EQUAL(0, load_out.error_flags);
|
||||
TEST_ASSERT_EQUAL(LOAD_STATE_ON, load_out.state);
|
||||
|
||||
Reference in New Issue
Block a user