Skip to content

Commit 2d8b1e8

Browse files
authored
Merge branch 'espruino:master' into iosWeatherUpdates
2 parents 4a424b4 + daafdc8 commit 2d8b1e8

36 files changed

+686
-74
lines changed

apps/clock_info/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
0.15: Fix error when displaying a category with only one clockinfo (fix #3728)
1717
0.16: Add BLE clkinfo entry
1818
0.17: Fix BLE icon alignment and border on some clocks
19+
0.18: Tweak BLE icon to add gap and ensure middle of B isn't filled

apps/clock_info/lib.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ exports.load = function() {
128128
get: function() {
129129
return {
130130
text: this.isOn() ? "On" : "Off",
131-
img: atob("GBiBAAAAAAAAAAAYAAAcAAAWAAATAAARgAMRgAGTAADWAAB8AAA4AAA4AAB8AADWAAGTAAMRgAARgAATAAAWAAAcAAAYAAAAAAAAAA==")
131+
img: atob("GBiBAAAAAAAAAAAYAAAcAAAWAAATAAARgAMRgAGTAADGAAB8AAA4AAA4AAB8AADGAAGTAAMRgAARgAATAAAWAAAcAAAYAAAAAAAAAA==")
132+
// small gaps added to BLE icon to ensure middle of B isn't filled
132133
};
133134
},
134135
run: function() {

apps/clock_info/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "clock_info",
22
"name": "Clock Info Module",
33
"shortName": "Clock Info",
4-
"version":"0.17",
4+
"version":"0.18",
55
"description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)",
66
"icon": "app.png",
77
"type": "module",

apps/health/ChangeLog

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@
3434
0.30: Minor code improvements
3535
0.31: Add support for new health format (storing more data)
3636
Added graphs for Temperature and Battery
37-
0.32: If getting HRM every 3/10 minutes, don't turn it on if the Bangle is charging or hasn't moved and is face down/up
37+
0.32: If getting HRM every 3/10 minutes, don't turn it on if the Bangle is charging or hasn't moved and is face down/up
38+
0.33: Ensure readAllRecordsSince always includes the current day
39+
Speed improvements (put temporary functions in RAM where possible)
40+
0.34: Fix readFullDatabase (was skipping first month of data)

apps/health/lib.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ exports.getDecoder = function(fileContents) {
4141
return {
4242
r : 10, // record length
4343
clr : "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
44-
decode : h => { var v = {
45-
steps : (h.charCodeAt(0)<<8) | h.charCodeAt(1),
46-
bpmMin : h.charCodeAt(2),
47-
bpmMax : h.charCodeAt(3),
48-
movement : h.charCodeAt(4)*8,
49-
battery : h.charCodeAt(5)&127,
50-
isCharging : !!(h.charCodeAt(5)&128),
51-
temperature : h.charCodeAt(6)/2, // signed?
52-
altitude : ((h.charCodeAt(7)&31)<<8)|h.charCodeAt(8), // signed?
53-
activity : exports.ACTIVITY[h.charCodeAt(7)>>5]
44+
decode : h => { "ram"; var d = h.charCodeAt.bind(h), v = {
45+
steps : (d(0)<<8) | d(1),
46+
bpmMin : d(2),
47+
bpmMax : d(3),
48+
movement : d(4)*8,
49+
battery : d(5)&127,
50+
isCharging : !!(d(5)&128),
51+
temperature : d(6)/2, // signed?
52+
altitude : ((d(7)&31)<<8)|d(8), // signed?
53+
activity : exports.ACTIVITY[d(7)>>5]
5454
};
5555
if (v.temperature>80) v.temperature-=128;
5656
v.bpm = (v.bpmMin+v.bpmMax)/2;
5757
if (v.altitude > 7500) v.altitude-=8192;
5858
return v;
5959
},
60-
encode : health => {var alt=health.altitude&8191;return String.fromCharCode(
60+
encode : health => { "ram"; var alt=health.altitude&8191;return String.fromCharCode(
6161
health.steps>>8,health.steps&255, // 16 bit steps
6262
health.bpmMin || health.bpm, // 8 bit bpm
6363
health.bpmMax || health.bpm, // 8 bit bpm
@@ -66,23 +66,24 @@ exports.getDecoder = function(fileContents) {
6666
0|Math.round(health.temperature*2),
6767
(alt>>8)|(Math.max(0,exports.ACTIVITY.indexOf(health.activity))<<5),alt&255,
6868
0 // tbd
69-
)}
69+
);}
7070
};
7171
} else { // HEALTH1
7272
return {
7373
r : 4, // record length
7474
clr : "\xFF\xFF\xFF\xFF",
75-
decode : h => ({
75+
decode : h => { "ram"; return {
7676
steps : (h.charCodeAt(0)<<8) | h.charCodeAt(1),
7777
bpm : h.charCodeAt(2),
7878
bpmMin : h.charCodeAt(2),
7979
bpmMax : h.charCodeAt(2),
8080
movement : h.charCodeAt(3)*8
81-
}),
82-
encode : health => String.fromCharCode(
81+
};},
82+
encode : health => { "ram"; return String.fromCharCode(
8383
health.steps>>8,health.steps&255, // 16 bit steps
8484
health.bpm, // 8 bit bpm
85-
Math.min(health.movement, 255))
85+
Math.min(health.movement, 255));
86+
}
8687
};
8788
}
8889
};
@@ -111,12 +112,10 @@ exports.readAllRecords = function(d, cb) {
111112
// Read the entire database. There is no guarantee that the months are read in order.
112113
exports.readFullDatabase = function(cb) {
113114
require("Storage").list(/health-[0-9]+-[0-9]+.raw/).forEach(val => {
114-
console.log(val);
115115
var parts = val.split('-');
116116
var y = parseInt(parts[1],10);
117-
var mo = parseInt(parts[2].replace('.raw', ''),10);
118-
119-
exports.readAllRecords(new Date(y, mo, 1), (r) => {
117+
var mo = parseInt(parts[2].replace('.raw', ''),10) - 1;
118+
exports.readAllRecords(new Date(y, mo, 1), (r) => {"ram";
120119
r.date = new Date(y, mo, r.day, r.hr, r.min);
121120
cb(r);
122121
});
@@ -127,9 +126,9 @@ exports.readFullDatabase = function(cb) {
127126
// There may be some records for the day of the timestamp previous to the timestamp
128127
exports.readAllRecordsSince = function(d, cb) {
129128
var currentDate = new Date().getTime();
130-
var di = d;
129+
var di = new Date(d.toISOString().substr(0,10)); // copy date (ignore time)
131130
while (di.getTime() <= currentDate) {
132-
exports.readDay(di, (r) => {
131+
exports.readDay(di, (r) => {"ram";
133132
r.date = new Date(di.getFullYear(), di.getMonth(), di.getDate(), r.hr, r.min);
134133
cb(r);
135134
});
@@ -149,7 +148,7 @@ exports.readDailySummaries = function(d, cb) {
149148
if (h!=inf.clr) cb(Object.assign(inf.decode(h), {day:day+1}));
150149
idx += DB_RECORDS_PER_DAY*inf.r;
151150
}
152-
}
151+
};
153152

154153
// Read all records from the given day
155154
exports.readDay = function(d, cb) {
@@ -167,4 +166,4 @@ exports.readDay = function(d, cb) {
167166
idx += inf.r;
168167
}
169168
}
170-
}
169+
};

apps/health/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "health",
33
"name": "Health Tracking",
44
"shortName": "Health",
5-
"version": "0.32",
5+
"version": "0.34",
66
"description": "Logs health data and provides an app to view it",
77
"icon": "app.png",
88
"tags": "tool,system,health",

apps/hrmmar/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Measurements from the build in PPG-Sensor (Photoplethysmograph) is sensitive to motion and can be corrupted with Motion Artifacts (MA). This module allows to remove these.
44

5+
**WARNING:** On Bangle.js 2 this has been found to make heart rate readings [substantially less accurate in some cases](https://github.com/orgs/espruino/discussions/7738#discussioncomment-13594093) (the HRM already has built in motion artefact removal).
6+
57
## Settings
68

79
* **MA removal**

apps/hrmmar/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"shortName":"HRM MA removal",
55
"icon": "app.png",
66
"version":"0.02",
7-
"description": "Removes Motion Artifacts in Bangle.js's heart rate sensor data.",
7+
"description": "Removes Motion Artifacts in Bangle.js's heart rate sensor data. **WARNING:** On Bangle.js 2 this has been found to make heart rate readings substantially less accurate in some cases.",
88
"type": "bootloader",
99
"tags": "health",
1010
"supports": ["BANGLEJS","BANGLEJS2"],

apps/jwalk/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Japanese Walking Timer
2+
3+
A simple timer designed to help you manage your walking intervals, whether you're in a relaxed mode or an intense workout!
4+
5+
![](screenshot.png)
6+
7+
## Usage
8+
9+
- The timer starts with a default total duration and interval duration, which can be adjusted in the settings.
10+
- Tap the screen to pause or resume the timer.
11+
- The timer will switch modes between "Relax" and "Intense" at the end of each interval.
12+
- The display shows the current time, the remaining interval time, and the total time left.
13+
14+
## Creator
15+
16+
[Fabian Köll] ([Koell](https://github.com/Koell))
17+
18+
19+
## Icon
20+
21+
[Icon](https://www.koreanwikiproject.com/wiki/images/2/2f/%E8%A1%8C.png)

apps/jwalk/app-icon.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)