From a7239fa9bb016de2d369c82b5ba9bf464566265c Mon Sep 17 00:00:00 2001 From: Martin Jaeger <17674105+martinjaeger@users.noreply.github.com> Date: Thu, 24 Oct 2019 16:10:35 +0200 Subject: [PATCH] Enabled all warnings for unit-test builds --- platformio.ini | 5 +++-- src/pwm_switch.cpp | 3 ++- test/tests_dcdc.cpp | 2 -- test/tests_power_port.cpp | 7 ------- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/platformio.ini b/platformio.ini index 5c2027a..51d2813 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,9 +13,9 @@ default_envs = # mppt-1210-hus-v0.2 # mppt-1210-hus-v0.4 # mppt-1210-hus-v0.6 -# mppt-1210-hus-v0.7 + mppt-1210-hus-v0.7 # pwm-2420-lus-v0.2 -# pwm-2420-lus-v0.3 + pwm-2420-lus-v0.3 # unit-test-native [env] @@ -105,6 +105,7 @@ platform = native framework = build_flags = -std=gnu++17 + -Wall -D LITTLE_ENDIAN -D UNIT_TEST -D __STDC_FORMAT_MACROS diff --git a/src/pwm_switch.cpp b/src/pwm_switch.cpp index 8611e87..e1a3759 100644 --- a/src/pwm_switch.cpp +++ b/src/pwm_switch.cpp @@ -23,11 +23,12 @@ #if FEATURE_PWM_SWITCH -static int _pwm_resolution; static bool _pwm_active; #ifndef UNIT_TEST +static int _pwm_resolution; + void pwm_signal_init_registers(int freq_Hz) { // Enable peripheral clock of GPIOB diff --git a/test/tests_dcdc.cpp b/test/tests_dcdc.cpp index 38bf212..dc7e1a1 100644 --- a/test/tests_dcdc.cpp +++ b/test/tests_dcdc.cpp @@ -251,7 +251,6 @@ void buck_derating_temperature_limits_exceeded() void buck_stop_input_power_too_low() { start_buck(); - float pwm_before = half_bridge_get_duty_cycle(); dcdc.power_good_timestamp = time(NULL) - 11; dcdc.control(); TEST_ASSERT(half_bridge_enabled() == false); @@ -260,7 +259,6 @@ void buck_stop_input_power_too_low() void buck_stop_high_voltage_emergency() { start_buck(); - float pwm_before = half_bridge_get_duty_cycle(); dcdc_lv_port.voltage = dcdc.ls_voltage_max + 0.1; dcdc.control(); TEST_ASSERT(half_bridge_enabled() == false); diff --git a/test/tests_power_port.cpp b/test/tests_power_port.cpp index 9e55c01..39e521a 100644 --- a/test/tests_power_port.cpp +++ b/test/tests_power_port.cpp @@ -9,13 +9,6 @@ #include "main.h" -static void init_structs() -{ - battery_conf_init(&bat_conf, BAT_TYPE_FLOODED, 6, 100); - battery_init_dc_bus(&bat_terminal, &bat_conf, 1); - charger.state = CHG_STATE_IDLE; -} - static adc_values_t adcval; const float dcdc_current_sun = 3;