From 1b290a69822d1605c051e9f261d37d2a1b9c1738 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 23 May 2022 11:16:40 +0100 Subject: [PATCH] settings 0.45: Add calibrate battery option --- apps/setting/ChangeLog | 1 + apps/setting/README.md | 3 ++- apps/setting/metadata.json | 2 +- apps/setting/settings.js | 12 ++++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/setting/ChangeLog b/apps/setting/ChangeLog index bfd32a130..6d3bbb468 100644 --- a/apps/setting/ChangeLog +++ b/apps/setting/ChangeLog @@ -48,3 +48,4 @@ 0.43: Add some Bangle 1 colours to theme customizer 0.44: Add "Start Week On X" option (#1780) UI improvements to Locale and Date & Time menu +0.45: Add calibrate battery option diff --git a/apps/setting/README.md b/apps/setting/README.md index 451b48c06..657b96f71 100644 --- a/apps/setting/README.md +++ b/apps/setting/README.md @@ -13,7 +13,6 @@ This is Bangle.js's settings menu * **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on - see below. * **Theme** Adjust the colour scheme * **Utils** Utilities - including resetting settings (see below) -* **Turn Off** Turn Bangle.js off ## BLE - Bluetooth Settings @@ -61,5 +60,7 @@ The exact effects depend on the app. In general the watch will not wake up by i * **Compact Storage** Removes deleted/old files from Storage - this will speed up your Bangle.js * **Rewrite Settings** Should not normally be required, but if `.boot0` has been deleted/corrupted (and so no settings are being loaded) this will fix it. * **Flatten Battery** Turns on all devices and draws as much power as possible, attempting to flatten the Bangle.js battery. This can still take 5+ hours. +* **Calibrate Battery** If you're finding your battery percentage meter isn't accurate, leave your Bangle.js on charge for at least 3 hours, and then choose this menu option. It will measure the battery voltage when full and will allow Bangle.js to report a more accurate battery percentage. * **Reset Settings** Reset the settings (as set in this app) to defaults. Does not reset settings for other apps. * **Factory Reset** (not available on Bangle.js 1) - wipe **everything** and return to a factory state +* **Turn Off** Turn Bangle.js off diff --git a/apps/setting/metadata.json b/apps/setting/metadata.json index 85dddf9db..c5c368fae 100644 --- a/apps/setting/metadata.json +++ b/apps/setting/metadata.json @@ -1,7 +1,7 @@ { "id": "setting", "name": "Settings", - "version": "0.44", + "version": "0.45", "description": "A menu for setting up Bangle.js", "icon": "settings.png", "tags": "tool,system", diff --git a/apps/setting/settings.js b/apps/setting/settings.js index 9b5bdae68..5c14e914d 100644 --- a/apps/setting/settings.js +++ b/apps/setting/settings.js @@ -546,6 +546,18 @@ function showUtilMenu() { var i=1000;while (i--); }, 1); }, + /*LANG*/'Calibrate Battery': () => { + E.showPrompt(/*LANG*/"Is the battery fully charged?",{title:/*LANG*/"Calibrate"}).then(ok => { + if (ok) { + var s=require("Storage").readJSON("setting.json"); + s.batFullVoltage = (analogRead(D3)+analogRead(D3)+analogRead(D3)+analogRead(D3))/4; + require("Storage").writeJSON("setting.json",s); + E.showAlert(/*LANG*/"Calibrated!").then(() => load("settings.app.js")); + } else { + E.showAlert(/*LANG*/"Please charge Bangle.js for 3 hours and try again").then(() => load("settings.app.js")); + } + }); + }, /*LANG*/'Reset Settings': () => { E.showPrompt(/*LANG*/'Reset to Defaults?',{title:/*LANG*/"Settings"}).then((v) => { if (v) {