vbat percentage calculation adopted
This commit is contained in:
+3
-3
@@ -269,8 +269,8 @@ func vbat2percent(vbat string) int {
|
||||
i, err := strconv.Atoi(vbat)
|
||||
res := 0
|
||||
if err == nil {
|
||||
res = int(float64(i-3500) * float64((100.0/0.7)*0.001))
|
||||
//fmt.Printf("vbat2percent Result in Percent: %d\n", res)
|
||||
res = int(float64(i-3400) / 6.0)
|
||||
fmt.Printf("vbat2percent Result in Percent: %d\n", res)
|
||||
if res < 0 {
|
||||
res = 0
|
||||
} else if res > 100 {
|
||||
@@ -399,7 +399,7 @@ func main() {
|
||||
if last_metric.BatteryPercent != "" {
|
||||
fmt.Printf("%s:%s:%s Percent:%s:%d\n", u2, d, last_metric.BatteryPercent, last_metric.ActiveUntil, last_metric.DaysUntilDeactivated)
|
||||
vp, _ := strconv.Atoi(last_metric.BatteryPercent)
|
||||
if CheckThreshold(d, vp, u2, last_metric, 50, 20, 10) {
|
||||
if CheckThreshold(d, vp, u2, last_metric, 20, 10, 5) {
|
||||
DeleteAlert("alarm_sent_accu:", d, u2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user