From 9d7bc0e771088b19bdce322101190435c135c153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Mon, 4 Oct 2021 11:23:06 +0200 Subject: [PATCH] Change signedness of some integers to fix warnings --- src/bat_charger.h | 16 ++++++++-------- src/data_objects.cpp | 16 ++++++++-------- src/load.h | 4 ++-- src/pwm_switch.h | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bat_charger.h b/src/bat_charger.h index 07a0a05..a2b9238 100644 --- a/src/bat_charger.h +++ b/src/bat_charger.h @@ -66,7 +66,7 @@ typedef struct * * Start charging of previously fully charged battery earliest after this period of time. */ - int32_t time_limit_recharge; + uint32_t time_limit_recharge; /** * Absolute maximum voltage (V) @@ -115,7 +115,7 @@ typedef struct * * After this time, CV charging is stopped independent of current. */ - int32_t topping_duration; + uint32_t topping_duration; /** * Enable float/trickle charging @@ -138,7 +138,7 @@ typedef struct * input power) for this period of time, the charger state machine goes back * into CC/bulk charging mode. */ - int32_t float_recharge_time; + uint32_t float_recharge_time; /** * Enable equalization charging @@ -159,7 +159,7 @@ typedef struct * * After this time, equalization charging is stopped. */ - int32_t equalization_duration; + uint32_t equalization_duration; /** * Equalization phase maximum current (A) @@ -173,14 +173,14 @@ typedef struct * * After passing specified amount of days, an equalization charge is triggered. */ - int32_t equalization_trigger_days; + uint32_t equalization_trigger_days; /** * Equalization trigger deep-discharge cycles * * After specified number of deep discharges, an equalization charge is triggered. */ - int32_t equalization_trigger_deep_cycles; + uint32_t equalization_trigger_deep_cycles; /** * Load disconnect open circuit voltage (V) @@ -404,7 +404,7 @@ public: * Counts the number of seconds during which the target voltage of current charging phase was * reached. */ - int target_voltage_timer; + uint32_t target_voltage_timer; /** * Timestamp after finish of last equalization charge @@ -414,7 +414,7 @@ public: /** * Deep discharge counter value after last equalization */ - int deep_dis_last_equalization; + uint32_t deep_dis_last_equalization; /** * Flag to indicate if battery was fully charged diff --git a/src/data_objects.cpp b/src/data_objects.cpp index 54dd1a4..d5f3667 100644 --- a/src/data_objects.cpp +++ b/src/data_objects.cpp @@ -817,7 +817,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xA4, "ChgCutoff_s", &bat_conf_user.topping_duration, + TS_ITEM_UINT32(0xA4, "ChgCutoff_s", &bat_conf_user.topping_duration, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -846,7 +846,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xA7, "FloatRechg_s", &bat_conf_user.float_recharge_time, + TS_ITEM_UINT32(0xA7, "FloatRechg_s", &bat_conf_user.float_recharge_time, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -885,7 +885,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xAB, "EqlDuration_s", &bat_conf_user.equalization_duration, + TS_ITEM_UINT32(0xAB, "EqlDuration_s", &bat_conf_user.equalization_duration, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -895,7 +895,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "d" }*/ - TS_ITEM_INT32(0xAC, "EqlInterval_d", &bat_conf_user.equalization_trigger_days, + TS_ITEM_UINT32(0xAC, "EqlInterval_d", &bat_conf_user.equalization_trigger_days, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -904,7 +904,7 @@ static ThingSetDataObject data_objects[] = { "de": "Max. Tiefenentladungszyklen zwischen Ausgleichsladungen" } }*/ - TS_ITEM_INT32(0xAD, "EqlDeepDisTrigger", &bat_conf_user.equalization_trigger_deep_cycles, + TS_ITEM_UINT32(0xAD, "EqlDeepDisTrigger", &bat_conf_user.equalization_trigger_deep_cycles, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -1038,7 +1038,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xBA, "LoadOCRecovery_s", &load.oc_recovery_delay, + TS_ITEM_UINT32(0xBA, "LoadOCRecovery_s", &load.oc_recovery_delay, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), /*{ @@ -1048,7 +1048,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xBB, "LoadUVRecovery_s", &load.lvd_recovery_delay, + TS_ITEM_UINT32(0xBB, "LoadUVRecovery_s", &load.lvd_recovery_delay, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), #endif @@ -1076,7 +1076,7 @@ static ThingSetDataObject data_objects[] = { }, "unit": "s" }*/ - TS_ITEM_INT32(0xBD, "UsbUVRecovery_s", &usb_pwr.lvd_recovery_delay, + TS_ITEM_UINT32(0xBD, "UsbUVRecovery_s", &usb_pwr.lvd_recovery_delay, ID_CONF, TS_ANY_R | TS_ANY_W, SUBSET_NVM), #endif diff --git a/src/load.h b/src/load.h index e0737dc..d46956e 100644 --- a/src/load.h +++ b/src/load.h @@ -137,14 +137,14 @@ public: ///< battery is empty or any errors occured) time_t oc_timestamp; ///< Time when last overcurrent event occured - int32_t oc_recovery_delay; ///< Seconds before we attempt to re-enable the load + uint32_t oc_recovery_delay; ///< Seconds before we attempt to re-enable the load ///< after an overcurrent event float disconnect_voltage = 0; ///< Low voltage disconnect (LVD) setpoint float reconnect_voltage = 0; ///< Low voltage reconnect (LVD) setpoint time_t lvd_timestamp; ///< Time when last low voltage disconnect happened - int32_t lvd_recovery_delay; ///< Seconds before we re-enable the load after a low voltage + uint32_t lvd_recovery_delay;///< Seconds before we re-enable the load after a low voltage ///< disconnect float junction_temperature; ///< calculated using thermal model based on current and ambient diff --git a/src/pwm_switch.h b/src/pwm_switch.h index 7b8f921..5fc8c45 100644 --- a/src/pwm_switch.h +++ b/src/pwm_switch.h @@ -91,7 +91,7 @@ public: * Interval to wait before retrying charging after low solar power cut-off or overvoltage * event (s) */ - int restart_interval = 60; + uint32_t restart_interval = 60; /** * Time when charger was switched off last time