Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesla: Fix power W calculation #119

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Software/src/battery/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ static uint32_t total_discharge = 0;
static uint32_t total_charge = 0;
static uint16_t volts = 0; // V
static int16_t amps = 0; // A
static int16_t power = 0; // W
static uint16_t raw_amps = 0; // A
static int16_t max_temp = 6; // C*
static int16_t min_temp = 5; // C*
Expand Down Expand Up @@ -202,7 +203,8 @@ void update_values_tesla_model_3_battery() { //This function maps all the value
max_target_charge_power = MAXCHARGEPOWERALLOWED;
}

stat_batt_power = (volts * amps); //TODO: check if scaling is OK
power = ((volts / 10) * amps);
stat_batt_power = convert2unsignedInt16(power);

min_temp = (min_temp * 10);
temperature_min = convert2unsignedInt16(min_temp);
Expand Down