diff --git a/apps/smartbatt/ChangeLog b/apps/smartbatt/ChangeLog index 4e1092b442..f8900da14d 100644 --- a/apps/smartbatt/ChangeLog +++ b/apps/smartbatt/ChangeLog @@ -1 +1,2 @@ v0.01: New app! +v0.02: Add dynamic intervals, depending on total cycles recorded diff --git a/apps/smartbatt/app.png b/apps/smartbatt/app.png new file mode 100644 index 0000000000..0d2ff3b787 Binary files /dev/null and b/apps/smartbatt/app.png differ diff --git a/apps/smartbatt/icon.png b/apps/smartbatt/icon.png deleted file mode 100644 index 21e662def7..0000000000 Binary files a/apps/smartbatt/icon.png and /dev/null differ diff --git a/apps/smartbatt/metadata.json b/apps/smartbatt/metadata.json index 310c3415e6..4d8544851e 100644 --- a/apps/smartbatt/metadata.json +++ b/apps/smartbatt/metadata.json @@ -2,9 +2,9 @@ "id": "smartbatt", "name": "Smart Battery Module", "shortName": "Smart Battery", - "version": "0.01", + "version": "0.02", "description": "Provides a `smartbatt` module that returns the battery in days, and learns from daily usage over time for accurate predictions.", - "icon": "icon.png", + "icon": "app.png", "type": "module", "tags": "tool,system,clkinfo", "supports": ["BANGLEJS","BANGLEJS2"], diff --git a/apps/smartbatt/module.js b/apps/smartbatt/module.js index 834ae7e01a..6b76195e8c 100644 --- a/apps/smartbatt/module.js +++ b/apps/smartbatt/module.js @@ -84,6 +84,20 @@ reason: reason }); } + clearInterval(interval) + if(data.totalCycles<=200){ + //5m intervals + interval=setInterval(recordBattery, 600000); + }else if(data.totalCycles<=300){ + //30m intervals + interval=setInterval(recordBattery, 1800000); + }else if(data.totalCycles<=500){ + //1h intervals + interval=setInterval(recordBattery, 3600000); + }else { + //3h intervals + interval=setInterval(recordBattery, 10800000); + } } function weightedAverage(oldValue, oldWeight, newValue, newWeight) {