Updated Edisons ball app to work on Bangle JS 2

pull/1520/head
copoer 2022-02-27 09:36:36 -04:00
parent 8518e7623f
commit 73aac6feab
4 changed files with 23 additions and 8 deletions

View File

@ -0,0 +1,2 @@
0.01: Initial version
0.02: Added BangleJS Two

View File

@ -1,4 +1,4 @@
The application is based on a technique that Thomas Edison used to prevent falling asleep using a steel ball. Essentially the app starts with a display that shows the current HR value that the watch alarm is set to and this can be adjusted with buttons 1 and 3. This HR settng should be the approximate value you want the alarm to trigger and so you should ideally know both what your HR is currently and what your heartrate normally is during sleep. For your current HR according to the watch, you can simply use the HR monitor available in the Espruino app loader, and then from that you can choose a lower value as the target for the alarm and adjust as required. The application is based on a technique that Thomas Edison used to prevent falling asleep using a steel ball. Essentially the app starts with a display that shows the current HR value that the watch alarm is set to and this can be adjusted with buttons 1 and 3 (Mapped to top touch and bottom touch on Bangle 2). This HR settng should be the approximate value you want the alarm to trigger and so you should ideally know both what your HR is currently and what your heartrate normally is during sleep. For your current HR according to the watch, you can simply use the HR monitor available in the Espruino app loader, and then from that you can choose a lower value as the target for the alarm and adjust as required.
When you press the middle button on the side, the HR monitor starts, the alarm will trigger when your heart rate average drops to the limit youve set and has a certain level of steadiness that is determined by a assessing the variance over several readings - the sensitivity of this variance can be adjusted in a variable in the app's code under 'ADVANCED SETTINGS' if needed. The code also has a basic logging function which shows, in a CSV file, when you started the HR tracker and when the alarm was triggered. When you press the middle button on the side, the HR monitor starts, the alarm will trigger when your heart rate average drops to the limit youve set and has a certain level of steadiness that is determined by a assessing the variance over several readings - the sensitivity of this variance can be adjusted in a variable in the app's code under 'ADVANCED SETTINGS' if needed. The code also has a basic logging function which shows, in a CSV file, when you started the HR tracker and when the alarm was triggered.

View File

@ -130,10 +130,23 @@ function checkHR() {
} }
update_target_HR(); update_target_HR();
if (process.env.HWVERSION==1) {
setWatch(btn1Pressed, BTN1, {repeat:true}); // Bangle 1
setWatch(btn2Pressed, BTN2, {repeat:true}); setWatch(btn1Pressed, BTN1, {repeat:true});
setWatch(btn3Pressed, BTN3, {repeat:true}); setWatch(btn2Pressed, BTN2, {repeat:true});
setWatch(btn3Pressed, BTN3, {repeat:true});
} else {
setWatch(btn2Pressed, BTN2, { repeat: true });
// Bangle 2
Bangle.on('touch', function(zone, e) {
if (e.y < g.getHeight() / 2) {
btn1Pressed();
}
if (e.y > g.getHeight() / 2) {
btn3Pressed();
}
});
}
Bangle.on('HRM',function(hrm) { Bangle.on('HRM',function(hrm) {

View File

@ -2,11 +2,11 @@
"id": "edisonsball", "id": "edisonsball",
"name": "Edison's Ball", "name": "Edison's Ball",
"shortName": "Edison's Ball", "shortName": "Edison's Ball",
"version": "0.01", "version": "0.02",
"description": "Hypnagogia/Micro-Sleep alarm for experimental use in exploring sleep transition and combating drowsiness", "description": "Hypnagogia/Micro-Sleep alarm for experimental use in exploring sleep transition and combating drowsiness",
"icon": "app-icon.png", "icon": "app-icon.png",
"tags": "", "tags": "sleep,hyponagogia,quick,nap",
"supports": ["BANGLEJS"], "supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md", "readme": "README.md",
"storage": [ "storage": [
{"name":"edisonsball.app.js","url":"app.js"}, {"name":"edisonsball.app.js","url":"app.js"},