commit
07ba704afb
|
|
@ -13,3 +13,4 @@
|
|||
0.10: Use charging state on boot for auto calibration
|
||||
Log additional timestamp for trace log
|
||||
0.11: Minor code improvements
|
||||
0.12: Round monotonic percentage, rename to stable percentage/voltage
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
setInterval(save, saveEvery);
|
||||
|
||||
E.on("kill", ()=>{
|
||||
|
|
@ -75,7 +77,7 @@
|
|||
})(Bangle[functionName]);
|
||||
}
|
||||
|
||||
let functions = {};
|
||||
|
||||
let wrapDeferred = ((o,t) => (a) => {
|
||||
if (a == eval || typeof a == "string") {
|
||||
return o.apply(this, arguments);
|
||||
|
|
@ -131,19 +133,25 @@
|
|||
handleCharging(Bangle.isCharging());
|
||||
}
|
||||
|
||||
var savedBatPercent=E.getBattery();
|
||||
if (settings.forceMonoPercentage){
|
||||
var p = (E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery())/4;
|
||||
var op = E.getBattery;
|
||||
var newPercent =Math.round((E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery())/6);
|
||||
|
||||
E.getBattery = function() {
|
||||
var current = Math.round((op()+op()+op()+op())/4);
|
||||
if (Bangle.isCharging() && current > p) p = current;
|
||||
if (!Bangle.isCharging() && current < p) p = current;
|
||||
return p;
|
||||
|
||||
if(Bangle.isCharging()){
|
||||
if(newPercent > savedBatPercent)
|
||||
savedBatPercent = newPercent;
|
||||
}else{
|
||||
if(newPercent < savedBatPercent)
|
||||
savedBatPercent = newPercent;
|
||||
}
|
||||
return savedBatPercent;
|
||||
};
|
||||
}
|
||||
|
||||
if (settings.forceMonoVoltage){
|
||||
var v = (NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery())/4;
|
||||
var v = (NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery())/6;
|
||||
var ov = NRF.getBattery;
|
||||
NRF.getBattery = function() {
|
||||
var current = (ov()+ov()+ov()+ov())/4;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"id": "powermanager",
|
||||
"name": "Power Manager",
|
||||
"shortName": "Power Manager",
|
||||
"version": "0.11",
|
||||
"description": "Allow configuration of warnings and thresholds for battery charging and display.",
|
||||
"version": "0.12",
|
||||
"description": "Allow configuration of warnings for battery charging, stabilization of voltage, stabilization of battery percentage, and battery logging.",
|
||||
"icon": "app.png",
|
||||
"type": "bootloader",
|
||||
"tags": "tool",
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@
|
|||
'Widget': function() {
|
||||
E.showMenu(submenu_widget);
|
||||
},
|
||||
'Monotonic percentage': {
|
||||
'Stable Percentage': {
|
||||
value: !!settings.forceMonoPercentage,
|
||||
onchange: v => {
|
||||
writeSettings("forceMonoPercentage", v);
|
||||
}
|
||||
},
|
||||
'Monotonic voltage': {
|
||||
'Stable Voltage': {
|
||||
value: !!settings.forceMonoVoltage,
|
||||
onchange: v => {
|
||||
writeSettings("forceMonoVoltage", v);
|
||||
|
|
|
|||
Loading…
Reference in New Issue