widbattpwr: show percentage if charging

pull/3503/head
Rob Pilling 2024-07-12 12:58:37 +01:00
parent 1e82772de6
commit 35bc00e271
5 changed files with 8 additions and 3 deletions

View File

@ -1 +1,2 @@
0.01: Initial fork from hwid_a_battery_widget 0.01: Initial fork from hwid_a_battery_widget
0.02: Show battery percentage (instead of power) if charging

View File

@ -2,6 +2,10 @@
Show the time remaining at the current power consumption, and battery percentage via shading of the text and a percentage bar. Show the time remaining at the current power consumption, and battery percentage via shading of the text and a percentage bar.
Battery percentage can be seen:
- Temporarily by tapping the widget
- By charging the watch
Requires firmware 2v23 or above. Requires firmware 2v23 or above.
This is a copy of `hwid_a_battery_widget` (that being a copy of `wid_a_battery_widget`). This is a copy of `hwid_a_battery_widget` (that being a copy of `wid_a_battery_widget`).

View File

@ -3,7 +3,7 @@
"name": "Battery power and percentage widget", "name": "Battery power and percentage widget",
"shortName": "Batt Pwr", "shortName": "Batt Pwr",
"icon": "widget.png", "icon": "widget.png",
"version": "0.01", "version": "0.02",
"type": "widget", "type": "widget",
"supports": ["BANGLEJS2"], "supports": ["BANGLEJS2"],
"readme": "README.md", "readme": "README.md",

View File

@ -39,7 +39,7 @@
g.setFont("Vector", 16); g.setFont("Vector", 16);
{ {
var txt = void 0; var txt = void 0;
if (showPct) { if (showPct || Bangle.isCharging()) {
txt = "".concat(batt, "%"); txt = "".concat(batt, "%");
} }
else { else {

View File

@ -44,7 +44,7 @@
g.setFont("Vector", 16); g.setFont("Vector", 16);
{ {
let txt; let txt;
if(showPct){ if(showPct || Bangle.isCharging()){
txt = `${batt}%`; txt = `${batt}%`;
}else{ }else{
// 175mAh, scaled based on battery (batt/100), scaled down based on usage // 175mAh, scaled based on battery (batt/100), scaled down based on usage