From d2789d84188be567e704e49691fa9bb730442a1b Mon Sep 17 00:00:00 2001 From: Graham Fenner Date: Sat, 1 Jul 2023 16:55:42 +0100 Subject: [PATCH] battery voltage estimate --- apps/lcars/ChangeLog | 3 ++- apps/lcars/README.md | 3 ++- apps/lcars/lcars.app.js | 3 +++ apps/lcars/lcars.settings.js | 2 +- apps/lcars/metadata.json | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/lcars/ChangeLog b/apps/lcars/ChangeLog index fb778c2788..e3f1f6d771 100644 --- a/apps/lcars/ChangeLog +++ b/apps/lcars/ChangeLog @@ -24,4 +24,5 @@ 0.24: Add ability to disable alarm functionality. 0.25: Add more colors to the settings and add the ability to disable the data charts+Markup. 0.26: Use widget_utils. -0.27: Report latest HRM rather than HRM 10 minutes ago (fix #2395) \ No newline at end of file +0.27: Report latest HRM rather than HRM 10 minutes ago (fix #2395) +0.28: Battery Vref implemented correctly. \ No newline at end of file diff --git a/apps/lcars/README.md b/apps/lcars/README.md index 1564b41790..89918ae87b 100644 --- a/apps/lcars/README.md +++ b/apps/lcars/README.md @@ -25,7 +25,8 @@ the "sched" app must be installed on your device. ## Data that can be configured * Steps - Steps loaded via the wpedom app. * Battery - Current battery level in % - * VREF - Voltage of battery + * BattVolt - Voltage of battery + * VREF - Internal Voltage Reference * HRM - Last measured HRM * Temp - Weather temperature loaded via the weather module + gadgetbridge * Humidity - Humidity loaded via the weather module + gadgetbridge diff --git a/apps/lcars/lcars.app.js b/apps/lcars/lcars.app.js index cbb6e6ad51..4eab1c4ebd 100644 --- a/apps/lcars/lcars.app.js +++ b/apps/lcars/lcars.app.js @@ -239,6 +239,9 @@ function _drawData(key, y, c){ } else if (key == "VREF"){ value = E.getAnalogVRef().toFixed(2) + "V"; + } else if (key =="BATTVOLT" ) { + text = "BATV"; + value = (E.getAnalogVRef()*analogRead(3)*4).toFixed(2) + "V"; } else if(key == "HRM"){ value = Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm); diff --git a/apps/lcars/lcars.settings.js b/apps/lcars/lcars.settings.js index 7837eb4d1b..81c71020fa 100644 --- a/apps/lcars/lcars.settings.js +++ b/apps/lcars/lcars.settings.js @@ -26,7 +26,7 @@ } - var dataOptions = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "Wind", "Altitude", "CoreT"]; + var dataOptions = ["Steps", "Battery", "BattVolt", "VREF", "HRM", "Temp", "Humidity", "Wind", "Altitude", "CoreT"]; var speedOptions = ["kph", "mph"]; var color_options = ['Green','Orange','Cyan','Purple','Red','Blue','Yellow','White','Purple','Pink','Light Green','Dark Green']; var bg_code = ['#00ff00','#FF9900','#0094FF','#FF00DC','#ff0000','#0000ff','#ffef00','#FFFFFF','#FF00FF','#6C00FF','#99FF00','#556B2F']; diff --git a/apps/lcars/metadata.json b/apps/lcars/metadata.json index 2cefb544fb..4a7707b8a3 100644 --- a/apps/lcars/metadata.json +++ b/apps/lcars/metadata.json @@ -3,7 +3,7 @@ "name": "LCARS Clock", "shortName":"LCARS", "icon": "lcars.png", - "version":"0.27", + "version":"0.28", "readme": "README.md", "supports": ["BANGLEJS2"], "description": "Library Computer Access Retrieval System (LCARS) clock.",