diff --git a/apps/chargent/ChangeLog b/apps/chargent/ChangeLog new file mode 100644 index 000000000..7f837e50e --- /dev/null +++ b/apps/chargent/ChangeLog @@ -0,0 +1 @@ +0.01: First version diff --git a/apps/chargent/README.md b/apps/chargent/README.md new file mode 100644 index 000000000..56bc763b4 --- /dev/null +++ b/apps/chargent/README.md @@ -0,0 +1,13 @@ +# Charge Gently + +Charging Li-ion batteries to their full capacity has a significant impact on their lifespan. If possible, it is good practice to charge more often, but only to a certain lower capacity. + +The first stage of charging Li-ion ends at ~80% capacity when the charge voltage reaches its peak*. When that happens, the watch will buzz twice every 30s to remind you to disconnect the watch. + +This app has no UI and no configuration. To disable the app, you have to uninstall it. + +Side notes +- Full capacity is reached after charge current drops to an insignificant level. This is quite some time after charge voltage reached its peak / `E.getBattery()` returns 100. +- This app starts buzzing some time after `E.getBattery()` returns 100 (~15min on my watch), and at least 5min after the peak to account for noise. + +\* according to https://batteryuniversity.com/article/bu-409-charging-lithium-ion assuming similar characteristics and readouts from pin `D30` approximate charge voltage \ No newline at end of file diff --git a/apps/chargent/boot.js b/apps/chargent/boot.js new file mode 100644 index 000000000..802c3f55a --- /dev/null +++ b/apps/chargent/boot.js @@ -0,0 +1,30 @@ +(() => { + var id; + Bangle.on('charging', (charging) => { + if (charging) { + if (!id) { + var max = 0; + var count = 0; + id = setInterval(() => { + var d30 = analogRead(D30); + if (max < d30) { + max = d30; + count = 0; + } else { + count++; + if (10 <= count) { // 10 * 30s == 5 min // TODO ? customizable + // TODO ? customizable + Bangle.buzz(500); + setTimeout(() => Bangle.buzz(500), 1000); + } + } + }, 30*1000); + } + } else { + if (id) { + clearInterval(id); + id = undefined; + } + } + }); +})(); diff --git a/apps/chargent/icon.png b/apps/chargent/icon.png new file mode 100644 index 000000000..dce0014cb Binary files /dev/null and b/apps/chargent/icon.png differ diff --git a/apps/chargent/metadata.json b/apps/chargent/metadata.json new file mode 100644 index 000000000..e8c8afd71 --- /dev/null +++ b/apps/chargent/metadata.json @@ -0,0 +1,13 @@ +{ "id": "chargent", + "name": "Charge Gently", + "version": "0.01", + "description": "Reduces battery wear by buzzing when the first charge stage ended.", + "icon": "icon.png", + "type": "bootloader", + "tags": "battery", + "supports": ["BANGLEJS"], + "readme": "README.md", + "storage": [ + {"name": "chargent.boot.js", "url": "boot.js"} + ] +}