rates minimum to 0
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m54s
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m54s
This commit is contained in:
parent
73b3a90462
commit
95a0a446a1
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2633,7 +2633,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap 4.4.11",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
edition = "2021"
|
||||
license = "MITNFA"
|
||||
description = "Controls Tesla charge rate based on solar charge data"
|
||||
|
|
|
@ -211,8 +211,8 @@ impl Config {
|
|||
|
||||
fn validate(&mut self) {
|
||||
self.shutoff_voltage = self.shutoff_voltage.clamp(40.0, 60.0);
|
||||
self.max_rate = self.max_rate.clamp(1, 30);
|
||||
self.min_rate = self.min_rate.clamp(1, self.max_rate);
|
||||
self.max_rate = self.max_rate.clamp(0, 30);
|
||||
self.min_rate = self.min_rate.clamp(0, self.max_rate);
|
||||
self.duty_cycle_too_high = self.duty_cycle_too_high.clamp(0.0, 1.0);
|
||||
self.duty_cycle_too_low = self.duty_cycle_too_low.clamp(0.0, 1.0);
|
||||
self.pid_controls.proportional_gain = self.pid_controls.proportional_gain.clamp(0.0, 50.0);
|
||||
|
|
|
@ -155,7 +155,7 @@ async fn set_max(limit: i64, remote_addr: std::net::IpAddr) {
|
|||
#[post("/set-min/<limit>")]
|
||||
async fn set_min(limit: i64, remote_addr: std::net::IpAddr) {
|
||||
log::warn!("setting min: {remote_addr:?}");
|
||||
let limit = limit.clamp(3, access_config().max_rate);
|
||||
let limit = limit.clamp(0, access_config().max_rate);
|
||||
write_to_config().min_rate = limit;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
<div id="rate-control">
|
||||
<h3>Charge rate:</h3>
|
||||
<input type="number" id="max-rate" max="15" min="3" onchange="change_max()" autocomplete="off" />
|
||||
<input type="number" id="max-rate" max="15" min="0" onchange="change_max()" autocomplete="off" />
|
||||
<button id="set-maximum" onclick="set_maximum()" disabled>Set maximum</button>
|
||||
<br><br>
|
||||
<input type="number" id="min-rate" max="15" min="3" onchange="change_min()" autocomplete="off" />
|
||||
<input type="number" id="min-rate" max="15" min="0" onchange="change_min()" autocomplete="off" />
|
||||
<button id="set-minimum" onclick="set_minimum()" disabled>Set minimum</button>
|
||||
</div>
|
||||
<div id="info"></div>
|
||||
|
|
Loading…
Reference in a new issue