Add menu to allow altitude to be calibrated

master
Gordon Williams 2025-03-14 14:32:57 +00:00
parent 254d33323d
commit f7c1b1b3aa
4 changed files with 66 additions and 14 deletions

View File

@ -84,3 +84,4 @@ of 'Select Clock'
0.73: Fix `const` bug / work with fastload 0.73: Fix `const` bug / work with fastload
0.74: Add extra layer of checks before allowing a factory reset (fix #3476) 0.74: Add extra layer of checks before allowing a factory reset (fix #3476)
0.75: Restore previous menu's scroll positions 0.75: Restore previous menu's scroll positions
0.76: Add altitude calibration menu (and update README after menu changed)

View File

@ -1,20 +1,32 @@
# Settings # Settings
This is Bangle.js's settings menu This is Bangle.js's main settings menu:
* **Apps** - Settings for installed apps/widgets
* **System** - Settings related to themes, default apps, date & time, etc
* **Bluetooth** - Bluetooth Settings menu - see below.
* **Alerts** - Set how Bangle.js alerts you (including Quiet mode)
* **Utils** - Utilities, including resetting settings
See below for options under each heading:
## System - System settings
* **Theme** Adjust the colour scheme
* **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on - see below.
* **Locale** set time zone, the time format (12/24h, for supported clocks) and the first day of the week
* **Clock** if you have more than one clock face, select the default one
* **Launcher** if you have more than one app launcher, select the default one
* **Date & Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader
* **Altitude** On Bangle.js 2, adjust the altitude (
## Alerts
* **App/Widget Settings** settings specific to installed applications
* **BLE** Bluetooth Settings menu - see below.
* **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected * **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected
* **Vibration** enable/disable the vibration motor * **Vibration** enable/disable the vibration motor
* **Quiet Mode** prevent notifications/alarms from vibrating/beeping/turning the screen on - see below * **Quiet Mode** prevent notifications/alarms from vibrating/beeping/turning the screen on - see below
* **Locale** set time zone, the time format (12/24h, for supported clocks) and the first day of the week
* **Select Clock** if you have more than one clock face, select the default one
* **Date & Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader
* **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)
## BLE - Bluetooth Settings ## Bluetooth
* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up) * **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
* **BLE** is Bluetooth LE enabled and the watch connectable? * **BLE** is Bluetooth LE enabled and the watch connectable?

View File

@ -1,7 +1,7 @@
{ {
"id": "setting", "id": "setting",
"name": "Settings", "name": "Settings",
"version": "0.75", "version": "0.76",
"description": "A menu for setting up Bangle.js", "description": "A menu for setting up Bangle.js",
"icon": "settings.png", "icon": "settings.png",
"tags": "tool,system", "tags": "tool,system",

View File

@ -1,4 +1,3 @@
{
Bangle.loadWidgets(); Bangle.loadWidgets();
Bangle.drawWidgets(); Bangle.drawWidgets();
@ -110,7 +109,6 @@ function mainMenu() {
} }
function systemMenu() { function systemMenu() {
const mainmenu = { const mainmenu = {
'': { 'title': /*LANG*/'System' }, '': { 'title': /*LANG*/'System' },
'< Back': ()=>popMenu(mainMenu()), '< Back': ()=>popMenu(mainMenu()),
@ -121,6 +119,7 @@ function systemMenu() {
/*LANG*/'Launcher': ()=>pushMenu(launcherMenu()), /*LANG*/'Launcher': ()=>pushMenu(launcherMenu()),
/*LANG*/'Date & Time': ()=>pushMenu(setTimeMenu()) /*LANG*/'Date & Time': ()=>pushMenu(setTimeMenu())
}; };
if (Bangle.getPressure) mainmenu[/*LANG*/"Altitude"] = ()=>pushMenu(showAltitude());
return mainmenu; return mainmenu;
} }
@ -1030,5 +1029,45 @@ function showTouchscreenCalibration() {
showTapSpot(); showTapSpot();
} }
pushMenu(mainMenu()); // Calibrate altitude - Bangle.js2 only
function showAltitude() {
function onPressure(pressure) {
menuPressure.value = Math.round(pressure.pressure);
menuAltitude.value = Math.round(pressure.altitude);
m.draw();
}
Bangle.setBarometerPower(1,"settings");
Bangle.on("pressure",onPressure);
var seaLevelPressure = Bangle.getOptions().seaLevelPressure;
if (!isFinite(seaLevelPressure)) seaLevelPressure=1013.25;
var menuPressure = {value:"-"};
var menuAltitude = {value:"-"};
var m = E.showMenu({ "" : {title:/*LANG*/"Altitude",back:() => {
Bangle.setBarometerPower(0,"settings");
Bangle.removeListener("pressure",onPressure);
settings.seaLevelPressure = seaLevelPressure;
updateSettings();
popMenu(systemMenu());
}},
/*LANG*/"Pressure (hPa)" : menuPressure,
/*LANG*/"Altitude (m)" : menuAltitude,
/*LANG*/"Adjust up" : function() {
Bangle.buzz(80);
seaLevelPressure++;
Bangle.setOptions({seaLevelPressure:seaLevelPressure});
},
/*LANG*/"Adjust down" : function() {
Bangle.buzz(80);
seaLevelPressure--;
Bangle.setOptions({seaLevelPressure:seaLevelPressure});
},
/*LANG*/"Set Default" : function() {
Bangle.buzz();
seaLevelPressure=1013.25;
Bangle.setOptions({seaLevelPressure:seaLevelPressure});
}
});
} }
// Show the main menu
pushMenu(mainMenu());