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