forked from FOSS/BangleApps
Added vibrate as beep workaround
parent
ecfb62bd76
commit
a874d5838c
|
@ -2,7 +2,7 @@
|
||||||
{ "id": "boot",
|
{ "id": "boot",
|
||||||
"name": "Bootloader",
|
"name": "Bootloader",
|
||||||
"icon": "bootloader.png",
|
"icon": "bootloader.png",
|
||||||
"version":"0.10",
|
"version":"0.11",
|
||||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||||
"tags": "tool,system",
|
"tags": "tool,system",
|
||||||
"type":"bootloader",
|
"type":"bootloader",
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
{ "id": "setting",
|
{ "id": "setting",
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"icon": "settings.png",
|
"icon": "settings.png",
|
||||||
"version":"0.06",
|
"version":"0.07",
|
||||||
"description": "A menu for setting up Bangle.js",
|
"description": "A menu for setting up Bangle.js",
|
||||||
"tags": "tool,system",
|
"tags": "tool,system",
|
||||||
"storage": [
|
"storage": [
|
||||||
|
@ -575,7 +575,7 @@
|
||||||
{ "id": "mmonday",
|
{ "id": "mmonday",
|
||||||
"name": "Manic Monday Tone",
|
"name": "Manic Monday Tone",
|
||||||
"icon": "manic-monday-icon.png",
|
"icon": "manic-monday-icon.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "The Bangles make a comeback",
|
"description": "The Bangles make a comeback",
|
||||||
"tags": "sound",
|
"tags": "sound",
|
||||||
"storage": [
|
"storage": [
|
||||||
|
|
|
@ -8,3 +8,4 @@
|
||||||
0.09: Only check GPS for time after a fresh boot
|
0.09: Only check GPS for time after a fresh boot
|
||||||
0.10: Stop users calling save() (fix #125)
|
0.10: Stop users calling save() (fix #125)
|
||||||
If Debug info is set to 'show' don't move to Terminal if connected!
|
If Debug info is set to 'show' don't move to Terminal if connected!
|
||||||
|
0.11: Added vibrate as beep workaround
|
||||||
|
|
|
@ -20,7 +20,19 @@ if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
|
||||||
if (s.ble===false && !NRF.getSecurityStatus().connected) NRF.sleep();
|
if (s.ble===false && !NRF.getSecurityStatus().connected) NRF.sleep();
|
||||||
// Set time, vibrate, beep, etc
|
// Set time, vibrate, beep, etc
|
||||||
if (!s.vibrate) Bangle.buzz=Promise.resolve;
|
if (!s.vibrate) Bangle.buzz=Promise.resolve;
|
||||||
if (!s.beep) Bangle.beep=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);
|
Bangle.setLCDTimeout(s.timeout);
|
||||||
if (!s.timeout) Bangle.setLCDPower(1);
|
if (!s.timeout) Bangle.setLCDPower(1);
|
||||||
E.setTimeZone(s.timezone);
|
E.setTimeZone(s.timezone);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
0.02: Added vibrate as beep workaround
|
|
@ -1,12 +1,23 @@
|
||||||
// made using https://www.espruino.com/Making+Music
|
// made using https://www.espruino.com/Making+Music
|
||||||
// Manic Monday tone by The Bangles
|
// Manic Monday tone by The Bangles
|
||||||
|
|
||||||
var SPEAKER_PIN = D18;
|
var s = require('Storage').readJSON('setting.json',1)||{};
|
||||||
|
/* Normally we'd just use Bangle.beep which works automatically
|
||||||
function freq(f) {
|
but because we're going lower level we need to account for the
|
||||||
if (f===0) digitalWrite(SPEAKER_PIN, 0);
|
different pin. */
|
||||||
else analogWrite(SPEAKER_PIN, 0.5, {freq: f});
|
if (s.beep=="vib") {
|
||||||
|
function freq(f) {
|
||||||
|
if (f===0) digitalWrite(D13, 0);
|
||||||
|
else analogWrite(D13, 0.1, {freq: f});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
function freq(f) {
|
||||||
|
if (f===0) digitalWrite(D18, 0);
|
||||||
|
else analogWrite(D18, 0.5, {freq: f});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
freq(1000);
|
freq(1000);
|
||||||
freq(1500);
|
freq(1500);
|
||||||
freq(0);
|
freq(0);
|
||||||
|
@ -39,6 +50,7 @@ var tune = "aggffefed";
|
||||||
var pos = 0;
|
var pos = 0;
|
||||||
|
|
||||||
setWatch(() => {
|
setWatch(() => {
|
||||||
|
pos = 0;
|
||||||
var playing = setInterval(step, 500);
|
var playing = setInterval(step, 500);
|
||||||
if(playing === 0) clearInterval(playing);
|
if(playing === 0) clearInterval(playing);
|
||||||
}, BTN1);
|
}, BTN1);
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
0.04: Add setting to disable log messages
|
0.04: Add setting to disable log messages
|
||||||
0.05: Fix Settings json
|
0.05: Fix Settings json
|
||||||
0.06: Remove distance setting as there's a separate app for Locale now
|
0.06: Remove distance setting as there's a separate app for Locale now
|
||||||
|
0.07: Added vibrate as beep workaround
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
log: false, // Do log messages appear on screen?
|
log: false, // Do log messages appear on screen?
|
||||||
timeout: 10, // Default LCD timeout in seconds
|
timeout: 10, // Default LCD timeout in seconds
|
||||||
vibrate: true, // Vibration enabled by default. App must support
|
vibrate: true, // Vibration enabled by default. App must support
|
||||||
beep: true, // Beep enabled by default. App must support
|
beep: "vib", // Beep enabled by default. App must support
|
||||||
timezone: 0, // Set the timezone for the device
|
timezone: 0, // Set the timezone for the device
|
||||||
HID : false, // BLE HID mode, off by default
|
HID : false, // BLE HID mode, off by default
|
||||||
clock: null, // a string for the default clock's name
|
clock: null, // a string for the default clock's name
|
||||||
|
|
|
@ -16,7 +16,7 @@ function resetSettings() {
|
||||||
log: false, // Do log messages appear on screen?
|
log: false, // Do log messages appear on screen?
|
||||||
timeout: 10, // Default LCD timeout in seconds
|
timeout: 10, // Default LCD timeout in seconds
|
||||||
vibrate: true, // Vibration enabled by default. App must support
|
vibrate: true, // Vibration enabled by default. App must support
|
||||||
beep: true, // Beep enabled by default. App must support
|
beep: "vib", // Beep enabled by default. App must support
|
||||||
timezone: 0, // Set the timezone for the device
|
timezone: 0, // Set the timezone for the device
|
||||||
HID : false, // BLE HID mode, off by default
|
HID : false, // BLE HID mode, off by default
|
||||||
clock: null, // a string for the default clock's name
|
clock: null, // a string for the default clock's name
|
||||||
|
@ -32,6 +32,8 @@ if (!settings) resetSettings();
|
||||||
const boolFormat = v => v ? "On" : "Off";
|
const boolFormat = v => v ? "On" : "Off";
|
||||||
|
|
||||||
function showMainMenu() {
|
function showMainMenu() {
|
||||||
|
var beepV = [ false,true,"vib" ];
|
||||||
|
var beepN = [ "Off","Piezo","Vibrate" ];
|
||||||
const mainmenu = {
|
const mainmenu = {
|
||||||
'': { 'title': 'Settings' },
|
'': { 'title': 'Settings' },
|
||||||
'Make Connectable': makeConnectable,
|
'Make Connectable': makeConnectable,
|
||||||
|
@ -71,14 +73,14 @@ function showMainMenu() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Beep': {
|
'Beep': {
|
||||||
value: settings.beep,
|
value: 0|beepV.indexOf(settings.beep),
|
||||||
format: boolFormat,
|
min:0,max:2,
|
||||||
onchange: () => {
|
format: v=>beepN[v],
|
||||||
settings.beep = !settings.beep;
|
onchange: v => {
|
||||||
|
settings.beep = beepV[v];
|
||||||
|
if (v==1) { analogWrite(D18,0.5,{freq:2000});setTimeout(()=>D18.reset(),200) } // piezo
|
||||||
|
else if (v==2) { analogWrite(D13,0.1,{freq:2000});setTimeout(()=>D13.reset(),200) } // vibrate
|
||||||
updateSettings();
|
updateSettings();
|
||||||
if (settings.beep) {
|
|
||||||
Bangle.beep(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Vibration': {
|
'Vibration': {
|
||||||
|
|
Loading…
Reference in New Issue