mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Merge pull request #217 from dalathegreat/bugfix/kia-hyundai-current-swap
Kia/Hyundai: Swap sign on current value
This commit is contained in:
commit
e1759e1669
1 changed files with 3 additions and 5 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue