From 45f3ac1b47121a3a6d985f85aba0ebc3cfa75ee3 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sun, 28 Jan 2024 12:03:14 +1100 Subject: [PATCH] temp bro --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/charge_controllers/tristar.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76aede7..fb35c70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2554,7 +2554,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.1.2" +version = "1.1.3" dependencies = [ "chrono", "clap 4.4.11", diff --git a/Cargo.toml b/Cargo.toml index f68bf0e..9677e59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesla-charge-controller" -version = "1.1.2" +version = "1.1.3" edition = "2021" license = "MITNFA" description = "Controls Tesla charge rate based on solar charge data" diff --git a/src/charge_controllers/tristar.rs b/src/charge_controllers/tristar.rs index de74091..f4af5f1 100644 --- a/src/charge_controllers/tristar.rs +++ b/src/charge_controllers/tristar.rs @@ -54,7 +54,7 @@ pub struct TristarState { battery_voltage: f64, target_voltage: f64, input_current: f64, - battery_temp: f64, + battery_temp: u16, charge_state: ChargeState, tristar_input_voltage: f64, tristar_charge_current: f64, @@ -71,7 +71,7 @@ impl TristarState { battery_voltage: scaling.get_voltage(ram[TristarRamAddress::AdcVbFMed]), target_voltage: scaling.get_voltage(ram[TristarRamAddress::VbRef]), input_current: scaling.get_current(ram[TristarRamAddress::AdcIaFShadow]), - battery_temp: half::f16::from_bits(ram[TristarRamAddress::Tbatt]).to_f64() * 512., + battery_temp: ram[TristarRamAddress::Tbatt], charge_state: ChargeState::from(ram[TristarRamAddress::ChargeState]), tristar_input_voltage: scaling.get_voltage(ram[TristarRamAddress::AdcVaF]), tristar_charge_current: scaling.get_current(ram[TristarRamAddress::AdcIbFShadow]), @@ -267,7 +267,7 @@ impl Tristar { .set(new_state.input_current); BATTERY_TEMP .with_label_values(&[&self.port_name]) - .set(new_state.battery_temp); + .set(new_state.battery_temp.into()); TRISTAR_INPUT_VOLTAGE .with_label_values(&[&self.port_name]) .set(new_state.tristar_input_voltage);