From 735f8364584b2a835d818e693167d7458051770b Mon Sep 17 00:00:00 2001 From: Empire Date: Wed, 2 Jul 2025 19:11:36 +0200 Subject: [PATCH] fix unit being wrong for solar display --- rust/src/webserver/mod.rs | 4 ++-- rust/src_webpack/src/solarview.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/webserver/mod.rs b/rust/src/webserver/mod.rs index 88d5814..a0659dd 100644 --- a/rust/src/webserver/mod.rs +++ b/rust/src/webserver/mod.rs @@ -235,8 +235,8 @@ fn get_solar_state( ) -> Result, anyhow::Error> { let mut board = BOARD_ACCESS.lock().expect("board access"); let state = SolarState { - mppt_voltage: board.board_hal.get_mptt_voltage()?.as_volts() as f32, - mppt_current: board.board_hal.get_mptt_current()?.as_amperes() as f32, + mppt_voltage: board.board_hal.get_mptt_voltage()?.as_millivolts() as f32, + mppt_current: board.board_hal.get_mptt_current()?.as_milliamperes() as f32, is_day: board.board_hal.is_day(), }; anyhow::Ok(Some(serde_json::to_string(&state)?)) diff --git a/rust/src_webpack/src/solarview.ts b/rust/src_webpack/src/solarview.ts index 641f518..6cc10b8 100644 --- a/rust/src_webpack/src/solarview.ts +++ b/rust/src_webpack/src/solarview.ts @@ -33,8 +33,8 @@ export class SolarView{ this.solar_current_milli_ampere.innerText = "N/A" this.solar_is_day.innerText = "N/A" } else { - this.solar_voltage_milli_volt.innerText = solarState.mppt_voltage.toFixed(2) - this.solar_current_milli_ampere.innerText = String(+solarState.mppt_current) + this.solar_voltage_milli_volt.innerText = solarState.mppt_voltage.toFixed(0) + this.solar_current_milli_ampere.innerText = solarState.mppt_current.toFixed(0) this.solar_is_day.innerText = solarState.is_day?"🌞":"🌙" }