Skip to content

Commit 16a25f2

Browse files
committed
recorder 0.48: Add ability to log average acceleration values
1 parent 5f052d9 commit 16a25f2

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

apps/recorder/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@
6060
Lower accuracy of barometer data to ~1cm (saves about 15b/record)
6161
0.47: Fix 'blip' on speed map on some recordings
6262
Ensure Battery voltage is only stored to 0.01v
63-
Add graphs for Steps+Battery
63+
Add graphs for Steps+Battery
64+
0.48: Add ability to log average acceleration values

apps/recorder/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ You can record
1919
* **BAT** Battery percentage and voltage
2020
* **Steps** Steps counted by the step counter
2121
* **Baro** (Bangle.js 2) Using the built-in barometer to record Temperature, Pressure and Altitude
22+
* **Accel** Average acceleration values in X,Y and Z
2223
* **Core** CoreTemp body temperature *if* you have a CoreTemp device and the https://banglejs.com/apps/?id=coretemp app installed
2324

2425
You can then start/stop recording from the Recorder app itself (and as long as widgets are

apps/recorder/lib.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ exports.getRecorders = function() {
114114
stop : () => {},
115115
draw : (x,y) => g.reset().drawImage(atob("DAwBAAMMeeeeeeeecOMMAAMMMMAA"),x,y)
116116
};
117+
},
118+
accel:function() {
119+
var ax=0,ay=0,az=0,n=0;
120+
function onAccel(a) {
121+
ax += a.x;
122+
ay += a.y;
123+
az += a.z;
124+
n++;
125+
}
126+
return {
127+
name : "Accel",
128+
fields : ["Accel X", "Accel Y", "Accel Z"],
129+
getValues : () => {
130+
if (n<1) n=1;
131+
var r = [(ax/n).toFixed(2), (ay/n).toFixed(2), (az/n).toFixed(2)];
132+
n = ax = ay = az = 0;
133+
return r;
134+
},
135+
start : () => { Bangle.on('accel', onAccel); },
136+
stop : () => { Bangle.removeListener('accel', onAccel); },
137+
draw : (x,y) => g.reset().drawImage(atob("DAwBAAMMeeeeeeeecOMMAAMMMMAA"),x,y)
138+
};
117139
}
118140
};
119141
if (Bangle.getPressure){

apps/recorder/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "recorder",
33
"name": "Recorder",
44
"shortName": "Recorder",
5-
"version": "0.47",
5+
"version": "0.48",
66
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
77
"icon": "app.png",
88
"tags": "tool,outdoors,gps,widget,clkinfo",

0 commit comments

Comments
 (0)