vbat percentage calculation adopted

This commit is contained in:
Joerg Lehmann 2021-04-14 19:50:37 +02:00
parent 45ee1e6b3d
commit 68ab2e205b
3 changed files with 5 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -333,7 +333,7 @@ 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))
res = int(float64(i-3400) / 6.0)
fmt.Printf("vbat2percent Result in Percent: %d\n", res)
if res < 0 {
res = 0

View File

@ -1,6 +1,7 @@
{{define "header_additions"}}
{{end}}
{{define "body_content"}}
<p class="title is-4">Willkommen bei wo-bisch.ch</p>
<p>
Hier sind Sie am richtigen Ort, wenn Sie einen kleinen, sparsamen <a href="/product.html"><strong>GPS-Tracker</strong></a> suchen, der seinen Standort periodisch &uuml;bermittelt.
</p>