diff --git a/Cargo.lock b/Cargo.lock index 7eb0b83..0f0e9a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2573,7 +2573,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.0.17" +version = "1.0.18" dependencies = [ "async-channel", "chrono", diff --git a/Cargo.toml b/Cargo.toml index af0d477..fa84e5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesla-charge-controller" -version = "1.0.17" +version = "1.0.18" edition = "2021" license = "MITNFA" description = "Controls Tesla charge rate based on solar charge data" diff --git a/src/tesla_charge_rate.rs b/src/tesla_charge_rate.rs index c86be13..796226a 100644 --- a/src/tesla_charge_rate.rs +++ b/src/tesla_charge_rate.rs @@ -107,7 +107,7 @@ impl PidLoop { charge_state: &ChargeState, delta_time: f64, ) -> Option { - let error = pl_state.target_voltage - pl_state.battery_voltage; + let error = pl_state.battery_voltage - pl_state.target_voltage; let derivative = (error - self.previous_error) / delta_time; let config = access_config(); let extra_offsets = if pl_state.internal_load_current > 1. {