Merge pull request #217 from dalathegreat/bugfix/kia-hyundai-current-swap

Kia/Hyundai: Swap sign on current value
This commit is contained in:
Daniel Öster 2024-03-10 13:38:46 +02:00 committed by GitHub
commit e1759e1669
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,7 +31,6 @@ static int16_t allowedDischargePower = 0;
static int16_t allowedChargePower = 0; static int16_t allowedChargePower = 0;
static uint16_t batteryVoltage = 0; static uint16_t batteryVoltage = 0;
static int16_t batteryAmps = 0; static int16_t batteryAmps = 0;
static int16_t powerWatt = 0;
static int16_t temperatureMax = 0; static int16_t temperatureMax = 0;
static int16_t temperatureMin = 0; static int16_t temperatureMin = 0;
static int8_t temperature_water_inlet = 0; static int8_t temperature_water_inlet = 0;
@ -155,7 +154,7 @@ void update_values_battery() { //This function maps all the values fetched via
system_battery_voltage_dV = batteryVoltage; //value is *10 (3700 = 370.0) system_battery_voltage_dV = batteryVoltage; //value is *10 (3700 = 370.0)
system_battery_current_dA = batteryAmps; //value is *10 (150 = 15.0) system_battery_current_dA = -batteryAmps; //value is *10 (150 = 15.0) , invert the sign
system_capacity_Wh = BATTERY_WH_MAX; system_capacity_Wh = BATTERY_WH_MAX;
@ -175,9 +174,8 @@ void update_values_battery() { //This function maps all the values fetched via
system_max_discharge_power_W = MAXDISCHARGEPOWERALLOWED; system_max_discharge_power_W = MAXDISCHARGEPOWERALLOWED;
} }
powerWatt = ((batteryVoltage * batteryAmps) / 100); //Power in watts, Negative = charging batt
system_active_power_W = ((system_battery_voltage_dV * system_battery_current_dA) / 100);
system_active_power_W = powerWatt; //Power in watts, Negative = charging batt
system_temperature_min_dC = (int8_t)temperatureMin * 10; //Increase decimals, 17C -> 17.0C system_temperature_min_dC = (int8_t)temperatureMin * 10; //Increase decimals, 17C -> 17.0C