default state control enable

This commit is contained in:
Alex Janka 2024-01-16 11:10:20 +11:00
parent 560fbf3d7a
commit 79454ff95a
3 changed files with 11 additions and 3 deletions

2
Cargo.lock generated
View file

@ -2256,7 +2256,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.0-beta-1"
version = "1.0.0-beta-2"
dependencies = [
"async-channel",
"chrono",

View file

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

View file

@ -23,11 +23,19 @@ pub enum TcrcRequest {
EnableAutomaticControl,
}
#[derive(Default, Clone, Copy, Serialize, Deserialize, Debug)]
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
pub struct TcrcState {
pub control_enable: bool,
}
impl Default for TcrcState {
fn default() -> Self {
Self {
control_enable: true,
}
}
}
impl TeslaChargeRateController {
pub fn new(car_state: Arc<RwLock<CarState>>, pl_state: Option<Arc<RwLock<PlState>>>) -> Self {
describe_gauge!("tcrc_control_enable", "Enable Tesla charge rate control");