From 7bf0e57882749af1efd2e8f968daaab4738b3bea Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 11:42:24 +0100 Subject: [PATCH] Bootloader: Don't modify beep/buzz behaviour if firmware does it automatically --- apps.json | 2 +- apps/boot/ChangeLog | 1 + apps/boot/boot0.js | 30 ++++++++++++++++-------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/apps.json b/apps.json index 42a3f0d2a..906331f65 100644 --- a/apps.json +++ b/apps.json @@ -2,7 +2,7 @@ { "id": "boot", "name": "Bootloader", "icon": "bootloader.png", - "version":"0.16", + "version":"0.17", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "tags": "tool,system", "type":"bootloader", diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog index c12654e97..c157c6705 100644 --- a/apps/boot/ChangeLog +++ b/apps/boot/ChangeLog @@ -15,3 +15,4 @@ 0.14: Move welcome loaders to *.boot.js 0.15: Added BLE HID option for Joystick and bare Keyboard 0.16: Detect out of memory errors and draw them onto the bottom of the screen in red +0.17: Don't modify beep/buzz behaviour if firmware does it automatically diff --git a/apps/boot/boot0.js b/apps/boot/boot0.js index 9463df27c..38423362d 100644 --- a/apps/boot/boot0.js +++ b/apps/boot/boot0.js @@ -21,20 +21,22 @@ if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth // Don't disconnect if something is already connected to us if (s.ble===false && !NRF.getSecurityStatus().connected) NRF.sleep(); // Set time, vibrate, beep, etc -if (!s.vibrate) Bangle.buzz=Promise.resolve; -if (s.beep===false) Bangle.beep=Promise.resolve; -else if (s.beep=="vib") Bangle.beep = function (time, freq) { - return new Promise(function(resolve) { - if ((0|freq)<=0) freq=4000; - if ((0|time)<=0) time=200; - if (time>5000) time=5000; - analogWrite(D13,0.1,{freq:freq}); - setTimeout(function() { - digitalWrite(D13,0); - resolve(); - }, time); - }); -}; +if (!Bangle.F_BEEPSET) { + if (!s.vibrate) Bangle.buzz=Promise.resolve; + if (s.beep===false) Bangle.beep=Promise.resolve; + else if (s.beep=="vib") Bangle.beep = function (time, freq) { + return new Promise(function(resolve) { + if ((0|freq)<=0) freq=4000; + if ((0|time)<=0) time=200; + if (time>5000) time=5000; + analogWrite(D13,0.1,{freq:freq}); + setTimeout(function() { + digitalWrite(D13,0); + resolve(); + }, time); + }); + }; +} Bangle.setLCDTimeout(s.timeout); if (!s.timeout) Bangle.setLCDPower(1); E.setTimeZone(s.timezone);