mirror of https://github.com/espruino/BangleApps
boot 0.38: Option to log to file if settings.log==2
settings 0.36: Added 'Utils' menu with helpful utilities for restoring Bangle.jspull/1047/head
parent
f8e04ad28a
commit
59b06d5aef
|
@ -16,7 +16,7 @@
|
|||
{
|
||||
"id": "boot",
|
||||
"name": "Bootloader",
|
||||
"version": "0.37",
|
||||
"version": "0.38",
|
||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||
"icon": "bootloader.png",
|
||||
"type": "bootloader",
|
||||
|
@ -146,7 +146,7 @@
|
|||
{
|
||||
"id": "setting",
|
||||
"name": "Settings",
|
||||
"version": "0.35",
|
||||
"version": "0.36",
|
||||
"description": "A menu for setting up Bangle.js",
|
||||
"icon": "settings.png",
|
||||
"tags": "tool,system",
|
||||
|
|
|
@ -41,3 +41,4 @@
|
|||
Don't set beep vibration up on Bangle.js 2 (built in)
|
||||
0.36: Add comments to .boot0 to make debugging a bit easier
|
||||
0.37: Remove Quiet Mode settings: now handled by Quiet Mode Schedule app
|
||||
0.38: Option to log to file if settings.log==2
|
||||
|
|
|
@ -23,8 +23,14 @@ if (s.ble!==false) {
|
|||
boot += `bleServiceOptions.hid=Bangle.HID;\n`;
|
||||
}
|
||||
}
|
||||
if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
|
||||
if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
|
||||
if (s.log==2) { // logging to file
|
||||
boot += `_DBGLOG=require("Storage").open("log.txt","a");
|
||||
`;
|
||||
} if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
|
||||
if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
|
||||
LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
|
||||
LoopbackA.setConsole(true);\n`;
|
||||
else if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
|
||||
else boot += `E.setConsole(null,{force:true});\n`; // on new (2v05+) firmware we have E.setConsole which allows a 'null' console
|
||||
/* If not programmable add our own handler for Bluetooth data
|
||||
to allow Gadgetbridge commands to be received*/
|
||||
|
@ -41,7 +47,10 @@ Bluetooth.on('line',function(l) {
|
|||
try { global.GB(JSON.parse(l.slice(3,-1))); } catch(e) {}
|
||||
});\n`;
|
||||
} else {
|
||||
if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
|
||||
if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
|
||||
LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
|
||||
if (!NRF.getSecurityStatus().connected) LoopbackA.setConsole();\n`;
|
||||
else if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
|
||||
else boot += `Bluetooth.setConsole(true);\n`; // else if no debug, force REPL to Bluetooth
|
||||
}
|
||||
// we just reset, so BLE should be on.
|
||||
|
|
|
@ -38,3 +38,4 @@
|
|||
0.33: Really fix 'beep' menu on Bangle.js 2 this time
|
||||
0.34: Remove Quiet Mode LCD settings: now handled by Quiet Mode Schedule app
|
||||
0.35: Change App/Widget settings to 'App Settings' so it fits on Bangle screen
|
||||
0.36: Added 'Utils' menu with helpful utilities for restoring Bangle.js
|
||||
|
|
|
@ -2,27 +2,26 @@
|
|||
|
||||
This is Bangle.js's settings menu
|
||||
|
||||
* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
|
||||
* **App/Widget Settings** settings specific to installed applications
|
||||
* **BLE** Bluetooth Settings menu - see below.
|
||||
* **Debug Info** should debug info be shown on the watch's screen or not?
|
||||
* **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
|
||||
* **Quiet Mode** prevent notifications/alarms from vibrating/beeping/turning the screen on - see below
|
||||
* **Locale** set time zone/whether the clock is 12/24 hour (for supported clocks)
|
||||
* **Select Clock** if you have more than one clock face, select the default one
|
||||
* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device.
|
||||
* **NOTE:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
|
||||
* **Set 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
|
||||
* **Reset Settings** Reset the settings to defaults
|
||||
* **Utils** Utilities - including resetting settings (see below)
|
||||
* **Turn Off** Turn Bangle.js off
|
||||
|
||||
## BLE - Bluetooth Settings
|
||||
|
||||
* **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?
|
||||
* **Programmable** if BLE is on, can the watch be connected to in order to program/upload apps? As long as your watch firmware is up to date, Gadgetbridge will work even with `Programmable` set to `Off`.
|
||||
* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device.
|
||||
* **NOTE:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
|
||||
* **Passkey BETA** allows you to set a passkey that is required to connect and pair to Bangle.js. **Note:** This is Beta and you will almost certainly encounter issues connecting with Web Bluetooth using this option.
|
||||
* **Whitelist** allows you to specify only specific devices that you will let connect to your Bangle.js. Simply choose the menu item, then `Add Device`, and then connect to Bangle.js with the device you want to add. If you are already connected you will have to disconnect first. Changes will take effect when you exit the `Settings` app.
|
||||
* **NOTE:** iOS devices and newer Android devices often implement Address Randomisation and change their Bluetooth address every so often. If you device's address changes, you will be unable to connect until you update the whitelist again.
|
||||
|
@ -44,4 +43,16 @@ The exact effects depend on the app. In general the watch will not wake up by i
|
|||
- Off: Normal operation
|
||||
- Alarms: Stops notifications, but "alarm" apps will still work
|
||||
- Silent: Blocks even alarms
|
||||
|
||||
|
||||
## Utils
|
||||
|
||||
|
||||
* **Debug Info** should debug info be shown on the watch's screen or not?
|
||||
* `Hide` (default) do not show debug information
|
||||
* `Show` Show on the Bangle's screen (when not connected to Bluetooth or `Programmable:off`)
|
||||
* `Log` Show on the Bangle's screen **and** write to a file called `log.txt` on Storage (when not connected to Bluetooth or `Programmable:off`). Warning - this file is appended to so may grow to be large if this is left enabled.
|
||||
* **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.
|
||||
* **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
|
||||
|
|
|
@ -95,17 +95,8 @@ function showMainMenu() {
|
|||
const mainmenu = {
|
||||
'': { 'title': 'Settings' },
|
||||
'< Back': ()=>load(),
|
||||
'Make Connectable': ()=>makeConnectable(),
|
||||
'App Settings': ()=>showAppSettingsMenu(),
|
||||
'BLE': ()=>showBLEMenu(),
|
||||
'Debug Info': {
|
||||
value: settings.log,
|
||||
format: v => v ? "Show" : "Hide",
|
||||
onchange: () => {
|
||||
settings.log = !settings.log;
|
||||
updateSettings();
|
||||
}
|
||||
},
|
||||
'Beep': beepMenuItem,
|
||||
'Vibration': {
|
||||
value: settings.vibrate,
|
||||
|
@ -134,7 +125,7 @@ function showMainMenu() {
|
|||
'Set Time': ()=>showSetTimeMenu(),
|
||||
'LCD': ()=>showLCDMenu(),
|
||||
'Theme': ()=>showThemeMenu(),
|
||||
'Reset Settings': ()=>showResetMenu(),
|
||||
'Utils': ()=>showUtilMenu(),
|
||||
'Turn Off': ()=>{ if (Bangle.softOff) Bangle.softOff(); else Bangle.off() },
|
||||
};
|
||||
|
||||
|
@ -146,6 +137,7 @@ function showBLEMenu() {
|
|||
var hidN = ["Off", "Kbrd & Media", "Kbrd","Joystick"];
|
||||
E.showMenu({
|
||||
'< Back': ()=>showMainMenu(),
|
||||
'Make Connectable': ()=>makeConnectable(),
|
||||
'BLE': {
|
||||
value: settings.ble,
|
||||
format: boolFormat,
|
||||
|
@ -476,21 +468,63 @@ function showLocaleMenu() {
|
|||
return E.showMenu(localemenu);
|
||||
}
|
||||
|
||||
function showResetMenu() {
|
||||
const resetmenu = {
|
||||
'': { 'title': 'Reset' },
|
||||
function showUtilMenu() {
|
||||
var menu = {
|
||||
'': { 'title': 'Utilities' },
|
||||
'< Back': ()=>showMainMenu(),
|
||||
'Debug Info': {
|
||||
value: E.clip(0|settings.log,0,2),
|
||||
format: v => ["Hide","Show","Log"][E.clip(0|v,0,2)],
|
||||
onchange: v => {
|
||||
settings.log = v;
|
||||
updateSettings();
|
||||
}
|
||||
},
|
||||
'Compact Storage': () => {
|
||||
E.showMessage("Compacting...\nTakes approx\n1 minute",{title:"Storage"});
|
||||
require("Storage").compact();
|
||||
showUtilMenu();
|
||||
},
|
||||
'Rewrite Settings': () => {
|
||||
require("Storage").write(".boot0","eval(require('Storage').read('bootupdate.js'));");
|
||||
load("setting.app.js");
|
||||
},
|
||||
'Flatten Battery': () => {
|
||||
E.showMessage('Flattening battery - this can take hours.\nLong-press button to cancel.');
|
||||
Bangle.setLCDTimeout(0);
|
||||
Bangle.setLCDPower(1);
|
||||
if (Bangle.setGPSPower) Bangle.setGPSPower(1,"flat");
|
||||
if (Bangle.setHRMPower) Bangle.setHRMPower(1,"flat");
|
||||
if (Bangle.setCompassPower) Bangle.setCompassPower(1,"flat");
|
||||
if (Bangle.setBarometerPower) Bangle.setBarometerPower(1,"flat");
|
||||
if (Bangle.setHRMPower) Bangle.setGPSPower(1,"flat");
|
||||
setInterval(function() {
|
||||
var i=1000;while (i--);
|
||||
}, 1);
|
||||
},
|
||||
'Reset Settings': () => {
|
||||
E.showPrompt('Reset Settings?').then((v) => {
|
||||
E.showPrompt('Reset to Defaults?',{title:"Settings"}).then((v) => {
|
||||
if (v) {
|
||||
E.showMessage('Resetting');
|
||||
resetSettings();
|
||||
}
|
||||
setTimeout(showMainMenu, 50);
|
||||
setTimeout(showMainMenu, 50);
|
||||
} else showUtilMenu();
|
||||
});
|
||||
}
|
||||
};
|
||||
return E.showMenu(resetmenu);
|
||||
if (Bangle.factoryReset) {
|
||||
menu['Factory Reset'] = ()=>{
|
||||
E.showPrompt('This will remove everything!',{title:"Factory Reset"}).then((v) => {
|
||||
if (v) {
|
||||
E.showMessage();
|
||||
Terminal.setConsole();
|
||||
Bangle.factoryReset();
|
||||
} else showUtilMenu();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return E.showMenu(menu);
|
||||
}
|
||||
|
||||
function makeConnectable() {
|
||||
|
|
Loading…
Reference in New Issue