Setting to turn Bluetooth on and off
parent
4d3bcd94a3
commit
75f8f7b86a
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
ble: false, // Bluetooth disabled by default
|
||||
timeout: 10, // Default LCD timeout in seconds
|
||||
vibrate: true, // Vibration enabled by default. App must support
|
||||
beep: true, // Beep enabled by default. App must support
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
(function() {
|
||||
var s = require('Storage').readJSON('@setting');
|
||||
if (s.ble) {
|
||||
var adv = { uart: true };
|
||||
if (s.HID) {
|
||||
// Report from https://notes.iopush.net/custom-usb-hid-device-descriptor-media-keyboard/
|
||||
|
|
@ -75,6 +76,12 @@
|
|||
adv.hid = Bangle.HID;
|
||||
}
|
||||
NRF.setServices(undefined, adv);
|
||||
try {
|
||||
NRF.wake();
|
||||
} catch (e) {}
|
||||
} else {
|
||||
NRF.sleep();
|
||||
}
|
||||
|
||||
if (!s.vibrate) Bangle.buzz=()=>Promise.resolve();
|
||||
if (!s.beep) Bangle.beep=()=>Promise.resolve();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ function updateSettings() {
|
|||
|
||||
function resetSettings() {
|
||||
settings = {
|
||||
ble: false,
|
||||
timeout: 10,
|
||||
vibrate: true,
|
||||
beep: true,
|
||||
|
|
@ -39,6 +40,14 @@ const boolFormat = (v) => v ? "On" : "Off";
|
|||
function showMainMenu() {
|
||||
const mainmenu = {
|
||||
'': { 'title': 'Settings' },
|
||||
'BLE': {
|
||||
value: settings.ble,
|
||||
format: boolFormat,
|
||||
onchange: () => {
|
||||
settings.ble = !settings.ble;
|
||||
updateSettings();
|
||||
}
|
||||
},
|
||||
'LCD Timeout': {
|
||||
value: settings.timeout,
|
||||
min: 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue