bring charge rate back down if it's changed from the webui
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m49s
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m49s
This commit is contained in:
parent
1cec64dc62
commit
7bbd0ed6f7
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2567,7 +2567,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"chrono",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
edition = "2021"
|
||||
license = "MITNFA"
|
||||
description = "Controls Tesla charge rate based on solar charge data"
|
||||
|
|
|
@ -105,13 +105,14 @@ fn get_control(pl_state: &PlState, charge_state: &ChargeState) -> Option<Interfa
|
|||
return valid_rate(rate, charge_state.charge_amps).map(InterfaceRequest::SetChargeRate);
|
||||
}
|
||||
|
||||
None
|
||||
valid_rate(charge_state.charge_amps, charge_state.charge_amps)
|
||||
.map(InterfaceRequest::SetChargeRate)
|
||||
}
|
||||
|
||||
fn valid_rate(rate: i64, other: i64) -> Option<i64> {
|
||||
fn valid_rate(rate: i64, previous: i64) -> Option<i64> {
|
||||
let config = access_config();
|
||||
let new = rate.clamp(config.min_rate, config.max_rate);
|
||||
if new == other {
|
||||
if new == previous {
|
||||
None
|
||||
} else {
|
||||
Some(new)
|
||||
|
|
Loading…
Reference in a new issue