client ip, style updates
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m57s

This commit is contained in:
Alex Janka 2024-01-23 14:03:03 +11:00
parent a817e1b5f7
commit 92621d394a
4 changed files with 12 additions and 12 deletions

2
Cargo.lock generated
View file

@ -2633,7 +2633,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.24"
version = "1.0.25"
dependencies = [
"chrono",
"clap 4.4.11",

View file

@ -1,6 +1,6 @@
[package]
name = "tesla-charge-controller"
version = "1.0.24"
version = "1.0.25"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"

View file

@ -116,13 +116,13 @@ async fn control_state(state: &State<ServerState>) -> Result<Json<ControlState>,
}
#[post("/flash")]
async fn flash(state: &State<ServerState>, remote_addr: std::net::SocketAddr) {
async fn flash(state: &State<ServerState>, remote_addr: std::net::IpAddr) {
log::warn!("flash requested: {remote_addr:?}");
let _ = state.api_requests.send(InterfaceRequest::FlashLights);
}
#[post("/disable-control")]
async fn disable_control(state: &State<ServerState>, remote_addr: std::net::SocketAddr) {
async fn disable_control(state: &State<ServerState>, remote_addr: std::net::IpAddr) {
log::warn!("disabling control: {remote_addr:?}");
match state
.tcrc_requests
@ -134,7 +134,7 @@ async fn disable_control(state: &State<ServerState>, remote_addr: std::net::Sock
}
#[post("/enable-control")]
async fn enable_control(state: &State<ServerState>, remote_addr: std::net::SocketAddr) {
async fn enable_control(state: &State<ServerState>, remote_addr: std::net::IpAddr) {
log::warn!("enabling control: {remote_addr:?}");
match state
.tcrc_requests
@ -146,33 +146,33 @@ async fn enable_control(state: &State<ServerState>, remote_addr: std::net::Socke
}
#[post("/set-max/<limit>")]
async fn set_max(limit: i64, remote_addr: std::net::SocketAddr) {
async fn set_max(limit: i64, remote_addr: std::net::IpAddr) {
log::warn!("setting max: {remote_addr:?}");
let limit = limit.clamp(access_config().min_rate, 15);
write_to_config().max_rate = limit;
}
#[post("/set-min/<limit>")]
async fn set_min(limit: i64, remote_addr: std::net::SocketAddr) {
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);
write_to_config().min_rate = limit;
}
#[post("/pid-settings/proportional/<gain>")]
async fn set_proportional_gain(gain: f64, remote_addr: std::net::SocketAddr) {
async fn set_proportional_gain(gain: f64, remote_addr: std::net::IpAddr) {
log::warn!("setting proportional gain: {remote_addr:?}");
write_to_config().pid_controls.proportional_gain = gain;
}
#[post("/pid-settings/derivative/<gain>")]
async fn set_derivative_gain(gain: f64, remote_addr: std::net::SocketAddr) {
async fn set_derivative_gain(gain: f64, remote_addr: std::net::IpAddr) {
log::warn!("setting derivative gain: {remote_addr:?}");
write_to_config().pid_controls.derivative_gain = gain;
}
#[post("/pid-settings/loop_time_seconds/<time>")]
async fn set_pid_loop_length(time: u64, remote_addr: std::net::SocketAddr) {
async fn set_pid_loop_length(time: u64, remote_addr: std::net::IpAddr) {
log::warn!("setting pid loop interval: {remote_addr:?}");
write_to_config().pid_controls.loop_time_seconds = time;
}

View file

@ -1,6 +1,6 @@
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background-color: #666;
background-color: #333;
}
.container {
@ -8,7 +8,7 @@ body {
margin: auto;
padding: 0.5em 2em;
border-radius: 10px;
background-color: white;
background-color: #faf9fd;
}
.outlink {