diff --git a/src/main.go b/src/main.go index 5dfaa38..26a0307 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 @@ -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 < 1){ + return "< 1%" + } + return strconv.Itoa(percentage) + "%" }