From 493f0031b9318b9fb5511bcb3e635c56fa2a7c3a Mon Sep 17 00:00:00 2001 From: NielsD1 Date: Fri, 20 Jun 2025 13:38:43 +0000 Subject: [PATCH 1/3] fix: incorrect empty voltage --- src/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.go b/src/main.go index 5dfaa38..b6b2b72 100644 --- a/src/main.go +++ b/src/main.go @@ -25,7 +25,7 @@ import ( var terminated = false -const EMPTY_BATTERY_VOLTAGE = 15.36 +const EMPTY_BATTERY_VOLTAGE = 14.9 const FULL_BATTERY_VOLTAGE = 16.8 const PLUGGED_IN_BATTERY_VOLTAGE = 16.9 From f15a2bbc0e05255f38481b9fd75647b55441b80b Mon Sep 17 00:00:00 2001 From: NielsD1 Date: Fri, 20 Jun 2025 13:42:04 +0000 Subject: [PATCH 2/3] fix: displaying 0% --- src/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.go b/src/main.go index b6b2b72..04f9510 100644 --- a/src/main.go +++ b/src/main.go @@ -221,6 +221,11 @@ func voltageToPercent(voltage float32) string { // percentage must be between 0-100 here percentage := int((voltage - EMPTY_BATTERY_VOLTAGE) / (FULL_BATTERY_VOLTAGE - EMPTY_BATTERY_VOLTAGE) * 100) + + if(percentage < 0){ + return "1% <" + } + return strconv.Itoa(percentage) + "%" } From fc4eebb5a45561b733be92fc51fb057deb458183 Mon Sep 17 00:00:00 2001 From: NielsD1 Date: Fri, 20 Jun 2025 13:45:55 +0000 Subject: [PATCH 3/3] fix: typo in percentage --- src/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.go b/src/main.go index 04f9510..26a0307 100644 --- a/src/main.go +++ b/src/main.go @@ -222,8 +222,8 @@ func voltageToPercent(voltage float32) string { percentage := int((voltage - EMPTY_BATTERY_VOLTAGE) / (FULL_BATTERY_VOLTAGE - EMPTY_BATTERY_VOLTAGE) * 100) - if(percentage < 0){ - return "1% <" + if(percentage < 1){ + return "< 1%" } return strconv.Itoa(percentage) + "%"