- first commit

pull/2506/head
notEvil 2023-01-16 15:50:15 +01:00
parent 02a2f7fb51
commit 29d588e17d
5 changed files with 57 additions and 0 deletions

1
apps/chargent/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: First version

13
apps/chargent/README.md Normal file
View File

@ -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

30
apps/chargent/boot.js Normal file
View File

@ -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;
}
}
});
})();

BIN
apps/chargent/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -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"}
]
}