Skip to content

Commit 54f8807

Browse files
authored
Merge branch 'espruino:master' into Weather-Feels-Like-Updates
2 parents 76c3801 + 1743ef8 commit 54f8807

File tree

12 files changed

+1094
-416
lines changed

12 files changed

+1094
-416
lines changed

apps/ios/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
0.18: Fix UTF8 conversion (check for `font` library, not `fonts`)
2020
0.19: Convert numeric weather values to int from BangleDumpWeather shortcut
2121
0.20: Add feels-like temperature data field to weather parsing from BangleDumpWeather shortcut.
22+
0.21: Add BangleDumpLocation shortcut, to update location data on watch without needing to use the watch's GPS, and added more app names/ ids.

apps/ios/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@ for now. It's just a few bucks/pounds/euro's.
3535
If you like to try a free app first, you can always use NRF Toolbox or
3636
Bluetooth BLE Device Finder to find and connect your Bangle.
3737

38-
### Weather and Calendar
38+
### Weather, Calendar, and Location
3939

40-
By using the `Shortcuts` app on your phone, you can send weather and calendar data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data.
40+
By using the `Shortcuts` app on your phone, you can send weather, calendar, and location data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data.
4141

42-
While you may write your own shortcuts if you prefer (for example, to get weather from a different source), two are provided:
42+
While you may write your own shortcuts if you prefer (for example, to get weather from a different source), three are provided:
4343

44-
- Calendar shortcut: https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f
45-
- Weather shortcut: https://www.icloud.com/shortcuts/106c68bfac3746fe9a55761a3be8d092
44+
- [Calendar shortcut](https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f)
45+
- [Weather shortcut](https://www.icloud.com/shortcuts/106c68bfac3746fe9a55761a3be8d092)
46+
- [Location shortcut](https://www.icloud.com/shortcuts/853c41e09a8e491f893a63b464d73ea1)
4647

47-
The weather shortcut requires an OpenWeatherMap api key, which you can get for free from https://openweathermap.org/api. The shortcut will prompt you for this when you add it to your phone.
48+
Note: The shortcuts must keep the names defaulted by the shortcut in order for the watch to detect the weather, calender, or location data. If you rename it from `BangleDump...` to something else, it will no longer get the info, and just display it as a notification on the watch.
4849

4950
These shortcuts can also be automated to run periodically, for example every hour, using the `Automation` tab in the Shortcuts app.
5051

51-
The shortcuts will send a notification, which can be annoying. One potential workaround for this would be to create a focus mode, and have an automation:
52+
The shortcuts will send a notification. Even though the notification is deleted as soon as Bangle.js receives it, it can be quite annoying. One potential workaround for this would be to create a focus mode, and have an automation:
5253
- activate the focus mode (hiding notifications from the shortcut)
5354
- run the shortcut
5455
- deactivate the focus mode
@@ -60,4 +61,9 @@ Please file any issues on https://github.com/espruino/BangleApps/issues/new?titl
6061

6162
## Creator
6263

63-
Gordon Williams
64+
- Gordon Williams
65+
66+
## Contributors
67+
68+
- RKBoss6
69+
- stweedo

apps/ios/boot.js

Lines changed: 91 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,56 @@ E.on('notify',msg=>{
7878
"com.apple.reminders": "Reminders",
7979
"com.apple.shortcuts": "Shortcuts",
8080
"com.apple.TestFlight": "TestFlight",
81-
"com.apple.ScreenTimeNotifications": "ScreenTime",
81+
"com.apple.ScreenTimeNotifications": "Screen Time",
8282
"com.apple.wifid.usernotification": "WiFi",
83+
"com.apple.Maps": "Maps",
84+
"com.apple.Music": "Apple Music",
85+
"com.apple.AppStore": "App Store",
86+
"com.apple.Preferences": "Settings",
87+
"com.apple.calculator": "Calculator",
88+
"com.apple.camera": "Camera",
89+
"com.apple.weather": "Weather",
90+
"com.apple.VoiceMemos": "Voice Memos",
91+
"com.apple.News": "News",
92+
"com.apple.tv": "Apple TV",
93+
"com.apple.findmy": "Find My",
94+
"com.apple.compass": "Compass",
95+
"com.apple.measure": "Measure",
8396
"com.atebits.Tweetie2": "Twitter",
84-
"com.burbn.instagram" : "Instagram",
97+
"com.burbn.instagram": "Instagram",
8598
"com.facebook.Facebook": "Facebook",
8699
"com.facebook.Messenger": "Messenger",
87-
"com.google.Chromecast" : "Google Home",
88-
"com.google.Gmail" : "GMail",
89-
"com.google.hangouts" : "Hangouts",
90-
"com.google.ios.youtube" : "YouTube",
91-
"com.hammerandchisel.discord" : "Discord",
92-
"com.ifttt.ifttt" : "IFTTT",
93-
"com.jumbo.app" : "Jumbo",
94-
"com.linkedin.LinkedIn" : "LinkedIn",
100+
"com.google.Chromecast": "Google Home",
101+
"com.google.Gmail": "GMail",
102+
"com.google.hangouts": "Hangouts",
103+
"com.google.ios.youtube": "YouTube",
104+
"com.google.ios.chrome": "Google Chrome",
105+
"com.google.Maps": "Google Maps",
106+
"com.google.Drive": "Google Drive",
107+
"com.google.GoogleMobile": "Google",
108+
"com.hammerandchisel.discord": "Discord",
109+
"com.ifttt.ifttt": "IFTTT",
110+
"com.jumbo.app": "Jumbo",
111+
"com.linkedin.LinkedIn": "LinkedIn",
95112
"com.marktplaats.iphone": "Marktplaats",
96-
"com.microsoft.Office.Outlook" : "Outlook Mail",
97-
"com.nestlabs.jasper.release" : "Nest",
98-
"com.netflix.Netflix" : "Netflix",
99-
"com.reddit.Reddit" : "Reddit",
113+
"com.microsoft.Office.Outlook": "Outlook Mail",
114+
"com.microsoft.Office.Word": "Microsoft Word",
115+
"com.microsoft.Office.Excel": "Microsoft Excel",
116+
"com.microsoft.Office.Powerpoint": "Microsoft PowerPoint",
117+
"com.nestlabs.jasper.release": "Nest",
118+
"com.netflix.Netflix": "Netflix",
119+
"com.reddit.Reddit": "Reddit",
100120
"com.skype.skype": "Skype",
101121
"com.skype.SkypeForiPad": "Skype",
102122
"com.spotify.client": "Spotify",
123+
"com.soundcloud.TouchApp": "SoundCloud",
124+
"com.disney.disneyplus": "Disney+",
125+
"com.hbo.hbonow": "HBO Max",
126+
"com.amazon.Amazon": "Amazon Shopping",
127+
"com.amazon.AmazonVideo": "Prime Video",
128+
"com.dropbox.Dropbox": "Dropbox",
129+
"com.evernote.iPhone.Evernote": "Evernote",
130+
"com.trello": "Trello",
103131
"com.storytel.iphone": "Storytel",
104132
"com.strava.stravaride": "Strava",
105133
"com.tinyspeck.chatlyio": "Slack",
@@ -110,20 +138,22 @@ E.on('notify',msg=>{
110138
"com.valvesoftware.Steam": "Steam",
111139
"com.vilcsak.bitcoin2": "Coinbase",
112140
"com.wordfeud.free": "WordFeud",
113-
"com.yourcompany.PPClient": "PayPal",
141+
"com.paypal.PPClient": "PayPal",
114142
"com.zhiliaoapp.musically": "TikTok",
143+
"com.pinterest": "Pinterest",
144+
"com.tumblr.tumblr": "Tumblr",
115145
"de.no26.Number26": "N26",
116146
"io.robbie.HomeAssistant": "Home Assistant",
117147
"net.superblock.Pushover": "Pushover",
118148
"net.weks.prowl": "Prowl",
119149
"net.whatsapp.WhatsApp": "WhatsApp",
120-
"nl.ah.Appie": "Albert Heijn",
121150
"nl.postnl.TrackNTrace": "PostNL",
122151
"org.whispersystems.signal": "Signal",
123152
"ph.telegra.Telegraph": "Telegram",
124-
"tv.twitch": "Twitch",
125-
// could also use NRF.ancsGetAppInfo(msg.appId) here
126-
};
153+
"tv.twitch": "Twitch"
154+
};
155+
156+
127157

128158
//if (appNames[msg.appId]) msg.a
129159
if (msg.title === "BangleDumpCalendar") {
@@ -191,7 +221,7 @@ E.on('notify',msg=>{
191221
wind: d.wind,
192222
wdir: d.wdir,
193223
loc: d.loc
194-
}
224+
};
195225
// Convert string fields to numbers for iOS weather shortcut
196226
const numFields = ['code', 'wdir', 'temp','feels', 'hi', 'lo', 'hum', 'wind', 'uv', 'rain'];
197227
numFields.forEach(field => {
@@ -201,6 +231,47 @@ E.on('notify',msg=>{
201231
NRF.ancsAction(msg.uid, false);
202232
return;
203233
}
234+
235+
if (msg.title === "BangleDumpLocation") {
236+
237+
const d = JSON.parse(msg.message);
238+
239+
/* Example:
240+
{"lat":"2912.0744", "lon":"2333.332", "city":"Chicago"}*/
241+
let locationJson = {
242+
t: "location",
243+
lat:d.lat,
244+
lon:d.lon,
245+
city:d.city
246+
247+
};
248+
// Convert string fields to numbers
249+
const numFields = ['lat', 'lon'];
250+
numFields.forEach(field => {
251+
if (locationJson[field] != null) locationJson[field] = +locationJson[field];
252+
});
253+
254+
//load mylocation file
255+
let myLocationJson = Object.assign({
256+
lat: d.lat,
257+
lon: d.lon,
258+
location:d.city
259+
}, require("Storage").readJSON("mylocation.json", true) || {});
260+
//remove notification from phone
261+
NRF.ancsAction(msg.uid, false);
262+
if(Math.abs(myLocationJson.lat - locationJson.lat) < 0.0001 && Math.abs(myLocationJson.lon -locationJson.lon) < 0.0001){
263+
//same location, do not write
264+
return;
265+
}
266+
267+
myLocationJson.lon=locationJson.lon;
268+
myLocationJson.lat=locationJson.lat;
269+
myLocationJson.location=locationJson.city;
270+
require("Storage").write("mylocation.json",myLocationJson);
271+
272+
273+
return;
274+
}
204275

205276
require("messages").pushMessage({
206277
t : msg.event,

apps/ios/metadata.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"id": "ios",
33
"name": "iOS Integration",
4-
"version": "0.20",
5-
"description": "Display/pull notifications, music, weather, and agenda from iOS devices",
4+
"version": "0.21",
5+
"description": "Display/pull notifications, music, weather, location, and agenda from iOS devices",
66
"icon": "app.png",
77
"tags": "tool,system,ios,apple,messages,notifications",
88
"dependencies": {"messages":"module"},
9+
"dependencies" : {"mylocation":"app" },
910
"supports": ["BANGLEJS","BANGLEJS2"],
1011
"readme": "README.md",
1112
"storage": [

apps/powermanager/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
Log additional timestamp for trace log
1515
0.11: Minor code improvements
1616
0.12: Round monotonic percentage, rename to stable percentage/voltage
17+
0.13: Fix stable percentage not updating

apps/powermanager/boot.js

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require('Storage').readJSON("powermanager.default.json", true) || {},
44
require('Storage').readJSON("powermanager.json", true) || {}
55
);
6-
6+
77
if (settings.log) {
88
let logFile = require('Storage').open("powermanager.log","a");
99
let def = require('Storage').readJSON("powermanager.def.json", true) || {};
@@ -12,7 +12,7 @@
1212
let hw = require('Storage').readJSON("powermanager.hw.json", true) || {};
1313
if (!hw.start) hw.start = Date.now();
1414
if (!hw.power) hw.power = {};
15-
15+
1616
const saveEvery = 1000 * 60 * 5;
1717
const TO_WRAP = ["GPS","Compass","Barometer","HRM","LCD"];
1818

@@ -28,9 +28,7 @@
2828
require('Storage').writeJSON("powermanager.hw.json", hw);
2929
}
3030
}
31-
32-
33-
31+
3432
setInterval(save, saveEvery);
3533

3634
E.on("kill", ()=>{
@@ -77,7 +75,6 @@
7775
})(Bangle[functionName]);
7876
}
7977

80-
8178
let wrapDeferred = ((o,t) => (a) => {
8279
if (a == eval || typeof a == "string") {
8380
return o.apply(this, arguments);
@@ -133,25 +130,19 @@
133130
handleCharging(Bangle.isCharging());
134131
}
135132

136-
var savedBatPercent=E.getBattery();
137133
if (settings.forceMonoPercentage){
138-
var newPercent =Math.round((E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery())/6);
139-
134+
var p = Math.round((E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery())/4);
135+
var op = E.getBattery;
140136
E.getBattery = function() {
141-
142-
if(Bangle.isCharging()){
143-
if(newPercent > savedBatPercent)
144-
savedBatPercent = newPercent;
145-
}else{
146-
if(newPercent < savedBatPercent)
147-
savedBatPercent = newPercent;
148-
}
149-
return savedBatPercent;
150-
};
137+
var current = Math.round((op()+op()+op()+op())/4);
138+
if (Bangle.isCharging() && current > p) p = current;
139+
if (!Bangle.isCharging() && current < p) p = current;
140+
return p;
141+
};
151142
}
152143

153144
if (settings.forceMonoVoltage){
154-
var v = (NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery())/6;
145+
var v = (NRF.getBattery()+NRF.getBattery()+NRF.getBattery()+NRF.getBattery())/4;
155146
var ov = NRF.getBattery;
156147
NRF.getBattery = function() {
157148
var current = (ov()+ov()+ov()+ov())/4;

apps/powermanager/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "powermanager",
33
"name": "Power Manager",
44
"shortName": "Power Manager",
5-
"version": "0.12",
5+
"version": "0.13",
66
"description": "Allow configuration of warnings for battery charging, stabilization of voltage, stabilization of battery percentage, and battery logging.",
77
"icon": "app.png",
88
"type": "bootloader",

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: 22 additions & 4 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
@@ -29,12 +30,29 @@ Some apps like the [Run app](https://banglejs.com/apps/?id=run) are able to auto
2930
as well. They need to define a `foobar.recorder.js` file - see the `getRecorders`
3031
function in `lib.js` for more information.
3132

32-
## Graphing
33+
## Viewing and Downloading Data
3334

34-
You can download the information to the PC using [the App Loader](https://banglejs.com/apps/?id=recorder). Connect
35-
to your Bangle, then in `My Apps` click the disk icon next to the `Recorder` app to download data.
35+
You can download and visualize the information using [the App Loader](https://banglejs.com/apps/?id=recorder). Connect
36+
to your Bangle, then in `My Apps` click the disk icon next to the `Recorder` app to access the download interface.
3637

37-
You can also view some information on the watch.
38+
### Interactive Web Interface
39+
40+
The download interface provides individual track visualization with:
41+
42+
* **Interactive Leaflet maps** - Each GPS track gets its own map using OpenStreetMap tiles
43+
* **Track statistics** - Distance, duration, and track points automatically calculated
44+
* **Start/End markers** - Green circles mark track start, red circles mark end points
45+
* **Interactive track points** - Click anywhere along the GPS track to see detailed data at that point
46+
* **Data popups** - View available data for each point (time, heart rate, altitude, speed, steps, battery, barometer - if recorded)
47+
* **Interactive charts** - Collapsible graphs for heart rate, battery, steps, elevation, speed, and barometer data with PNG export
48+
* **Download options** - KML, GPX, and CSV formats for individual tracks or all at once
49+
* **Settings** - Option to include/exclude entries without GPS coordinates
50+
* **Unit preferences** - Choose between metric, imperial, or auto-detect based on your locale
51+
* **Mobile responsive** - Works well on all devices
52+
53+
### On-Watch Visualization
54+
55+
You can also view some information on the watch:
3856

3957
* Tap `View Tracks`
4058
* Tap on the Track number you're interested in, and you'll see a page with information about that track...

0 commit comments

Comments
 (0)