Merge branch 'master' of github.com:espruino/BangleApps

pull/1574/head
Gordon Williams 2022-03-14 09:29:42 +00:00
commit 97f0e2eda5
20 changed files with 140 additions and 108 deletions

View File

@ -196,7 +196,7 @@ if (!Bangle.appRect) { // added in 2v11 - polyfill for older firmwares
// Append *.boot.js files // Append *.boot.js files
// These could change bleServices/bleServiceOptions if needed // These could change bleServices/bleServiceOptions if needed
var getPriority = /.*\.(\d+)\.boot\.js$/; var getPriority = /.*\.(\d+)\.boot\.js$/;
require('Storage').list(/\.boot\.js/).sort((a,b)=>{ require('Storage').list(/\.boot\.js$/).sort((a,b)=>{
var aPriority = a.match(getPriority); var aPriority = a.match(getPriority);
var bPriority = b.match(getPriority); var bPriority = b.match(getPriority);
if (aPriority && bPriority){ if (aPriority && bPriority){
@ -206,7 +206,7 @@ require('Storage').list(/\.boot\.js/).sort((a,b)=>{
} else if (!aPriority && bPriority){ } else if (!aPriority && bPriority){
return 1; return 1;
} }
return a > b; return a==b ? 0 : (a>b ? 1 : -1);
}).forEach(bootFile=>{ }).forEach(bootFile=>{
// we add a semicolon so if the file is wrapped in (function(){ ... }() // we add a semicolon so if the file is wrapped in (function(){ ... }()
// with no semicolon we don't end up with (function(){ ... }()(function(){ ... }() // with no semicolon we don't end up with (function(){ ... }()(function(){ ... }()

View File

@ -2,3 +2,4 @@
0.02: added settings menu to change color 0.02: added settings menu to change color
0.03: fix metadata.json to allow setting as clock 0.03: fix metadata.json to allow setting as clock
0.04: added heart rate which is switched on when cycled to it through up/down touch on rhs 0.04: added heart rate which is switched on when cycled to it through up/down touch on rhs
0.05: changed text to uppercase, just looks better, removed colons on text

View File

@ -109,10 +109,10 @@ function updateSunRiseSunSet(now, lat, lon, line){
const infoData = { const infoData = {
ID_DATE: { calc: () => {var d = (new Date()).toString().split(" "); return d[2] + ' ' + d[1] + ' ' + d[3];} }, ID_DATE: { calc: () => {var d = (new Date()).toString().split(" "); return d[2] + ' ' + d[1] + ' ' + d[3];} },
ID_DAY: { calc: () => {var d = require("locale").dow(new Date()).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} }, ID_DAY: { calc: () => {var d = require("locale").dow(new Date()).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} },
ID_SR: { calc: () => 'Sunrise: ' + sunRise }, ID_SR: { calc: () => 'Sunrise ' + sunRise },
ID_SS: { calc: () => 'Sunset: ' + sunSet }, ID_SS: { calc: () => 'Sunset ' + sunSet },
ID_STEP: { calc: () => 'Steps: ' + getSteps() }, ID_STEP: { calc: () => 'Steps ' + getSteps() },
ID_BATT: { calc: () => 'Battery: ' + E.getBattery() + '%' }, ID_BATT: { calc: () => 'Battery ' + E.getBattery() + '%' },
ID_HRM: { calc: () => hrmCurrent } ID_HRM: { calc: () => hrmCurrent }
}; };
@ -158,7 +158,7 @@ function drawInfo() {
g.setColor('#f00'); // red g.setColor('#f00'); // red
drawHeartIcon(); drawHeartIcon();
} else { } else {
g.drawString((infoData[infoMode].calc()), w/2, infoLine); g.drawString((infoData[infoMode].calc().toUpperCase()), w/2, infoLine);
} }
} }

View File

@ -1,6 +1,6 @@
{ "id": "daisy", { "id": "daisy",
"name": "Daisy", "name": "Daisy",
"version":"0.04", "version":"0.05",
"dependencies": {"mylocation":"app"}, "dependencies": {"mylocation":"app"},
"description": "A clock based on the Pastel clock with large ring guage for steps", "description": "A clock based on the Pastel clock with large ring guage for steps",
"icon": "app.png", "icon": "app.png",

View File

@ -7,7 +7,7 @@ screen. Very useful if combined with pattern launcher ;)
![](screenshot_1.png) ![](screenshot_1.png)
![](screenshot_2.png) ![](screenshot_2.png)
![](screenshot_2.png) ![](screenshot_3.png)
## Contributors ## Contributors

View File

@ -38,3 +38,4 @@
Now attempt to use Large/Big/Medium fonts, and allow minimum font size to be configured Now attempt to use Large/Big/Medium fonts, and allow minimum font size to be configured
0.24: Remove left-over debug statement 0.24: Remove left-over debug statement
0.25: Fix widget memory usage issues if message received and watch repeatedly calls Bangle.drawWidgets (fix #1550) 0.25: Fix widget memory usage issues if message received and watch repeatedly calls Bangle.drawWidgets (fix #1550)
0.26: Setting to auto-open music

View File

@ -13,12 +13,13 @@ and `Messages`:
* `Vibrate` - This is the pattern of buzzes that should be made when a new message is received * `Vibrate` - This is the pattern of buzzes that should be made when a new message is received
* `Repeat` - How often should buzzes repeat - the default of 4 means the Bangle will buzz every 4 seconds * `Repeat` - How often should buzzes repeat - the default of 4 means the Bangle will buzz every 4 seconds
* `Unread Timer` - when a new message is received we go into the Messages app. * `Unread Timer` - When a new message is received we go into the Messages app.
If there is no user input for this amount of time then the app will exit and return If there is no user input for this amount of time then the app will exit and return
to the clock where a ringing bell will be shown in the Widget bar. to the clock where a ringing bell will be shown in the Widget bar.
* `Min Font` - the minimum font size used when displaying messages on the screen. A bigger font * `Min Font` - The minimum font size used when displaying messages on the screen. A bigger font
is chosen if there isn't much message text, but this specifies the smallest the font should get before is chosen if there isn't much message text, but this specifies the smallest the font should get before
it starts getting clipped. it starts getting clipped.
* `Auto-Open Music` - Should the app automatically open when the phone starts playing music?
## New Messages ## New Messages

View File

@ -26,6 +26,8 @@ var fontSmall = "6x8";
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2"; var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2"; var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
var fontLarge = g.getFonts().includes("6x15")?"6x15:2":"6x8:4"; var fontLarge = g.getFonts().includes("6x15")?"6x15:2":"6x8:4";
var active; // active screen
var openMusic = false; // go back to music screen after we handle something else?
// hack for 2v10 firmware's lack of ':size' font handling // hack for 2v10 firmware's lack of ':size' font handling
try { try {
g.setFont("6x8:2"); g.setFont("6x8:2");
@ -50,10 +52,14 @@ var MESSAGES = require("Storage").readJSON("messages.json",1)||[];
if (!Array.isArray(MESSAGES)) MESSAGES=[]; if (!Array.isArray(MESSAGES)) MESSAGES=[];
var onMessagesModified = function(msg) { var onMessagesModified = function(msg) {
// TODO: if new, show this new one // TODO: if new, show this new one
if (msg && msg.new && !((require('Storage').readJSON('setting.json', 1) || {}).quiet)) { if (msg && msg.id!=="music" && msg.new && !((require('Storage').readJSON('setting.json', 1) || {}).quiet)) {
if (WIDGETS["messages"]) WIDGETS["messages"].buzz(); if (WIDGETS["messages"]) WIDGETS["messages"].buzz();
else Bangle.buzz(); else Bangle.buzz();
} }
if (msg && msg.id=="music") {
if (msg.state && msg.state!="play") openMusic = false; // no longer playing music to go back to
if (active!="music") return; // don't open music over other screens
}
showMessage(msg&&msg.id); showMessage(msg&&msg.id);
}; };
function saveMessages() { function saveMessages() {
@ -135,6 +141,7 @@ function getMessageImageCol(msg,def) {
} }
function showMapMessage(msg) { function showMapMessage(msg) {
active = "map";
var m; var m;
var distance, street, target, eta; var distance, street, target, eta;
m=msg.title.match(/(.*) - (.*)/); m=msg.title.match(/(.*) - (.*)/);
@ -168,12 +175,14 @@ function showMapMessage(msg) {
msg.new = false; msg.new = false;
saveMessages(); saveMessages();
layout = undefined; layout = undefined;
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1}); checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:0});
}); });
} }
var updateLabelsInterval;
function showMusicMessage(msg) { function showMusicMessage(msg) {
var updateLabelsInterval; active = "music";
openMusic = msg.state=="play";
var trackScrollOffset = 0; var trackScrollOffset = 0;
var artistScrollOffset = 0; var artistScrollOffset = 0;
var albumScrollOffset = 0; var albumScrollOffset = 0;
@ -194,10 +203,14 @@ function showMusicMessage(msg) {
function back() { function back() {
clearInterval(updateLabelsInterval); clearInterval(updateLabelsInterval);
updateLabelsInterval = undefined;
openMusic = false;
var wasNew = msg.new;
msg.new = false; msg.new = false;
saveMessages(); saveMessages();
layout = undefined; layout = undefined;
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1}); if (wasNew) checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:0,openMusic:0});
else checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
} }
function updateLabels() { function updateLabels() {
trackName = reduceStringAndPad(msg.track, trackScrollOffset, 13); trackName = reduceStringAndPad(msg.track, trackScrollOffset, 13);
@ -243,6 +256,7 @@ function showMusicMessage(msg) {
} }
function showMessageScroller(msg) { function showMessageScroller(msg) {
active = "scroller";
var bodyFont = fontBig; var bodyFont = fontBig;
g.setFont(bodyFont); g.setFont(bodyFont);
var lines = []; var lines = [];
@ -272,6 +286,7 @@ function showMessageScroller(msg) {
} }
function showMessageSettings(msg) { function showMessageSettings(msg) {
active = "settings";
E.showMenu({"":{"title":/*LANG*/"Message"}, E.showMenu({"":{"title":/*LANG*/"Message"},
"< Back" : () => showMessage(msg.id), "< Back" : () => showMessage(msg.id),
/*LANG*/"View Message" : () => { /*LANG*/"View Message" : () => {
@ -280,12 +295,12 @@ function showMessageSettings(msg) {
/*LANG*/"Delete" : () => { /*LANG*/"Delete" : () => {
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id); MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
saveMessages(); saveMessages();
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0}); checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
}, },
/*LANG*/"Mark Unread" : () => { /*LANG*/"Mark Unread" : () => {
msg.new = true; msg.new = true;
saveMessages(); saveMessages();
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0}); checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
}, },
/*LANG*/"Delete all messages" : () => { /*LANG*/"Delete all messages" : () => {
E.showPrompt(/*LANG*/"Are you sure?", {title:/*LANG*/"Delete All Messages"}).then(isYes => { E.showPrompt(/*LANG*/"Are you sure?", {title:/*LANG*/"Delete All Messages"}).then(isYes => {
@ -293,7 +308,7 @@ function showMessageSettings(msg) {
MESSAGES = []; MESSAGES = [];
saveMessages(); saveMessages();
} }
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0}); checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
}); });
}, },
}); });
@ -301,15 +316,20 @@ function showMessageSettings(msg) {
function showMessage(msgid) { function showMessage(msgid) {
var msg = MESSAGES.find(m=>m.id==msgid); var msg = MESSAGES.find(m=>m.id==msgid);
if (!msg) return checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0}); // go home if no message found if (updateLabelsInterval) {
if (msg.src=="Maps") { clearInterval(updateLabelsInterval);
cancelReloadTimeout(); // don't auto-reload to clock now updateLabelsInterval=undefined;
return showMapMessage(msg);
} }
if (!msg) return checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic:openMusic}); // go home if no message found
if (msg.id=="music") { if (msg.id=="music") {
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
return showMusicMessage(msg); return showMusicMessage(msg);
} }
if (msg.src=="Maps") {
cancelReloadTimeout(); // don't auto-reload to clock now
return showMapMessage(msg);
}
active = "message";
// Normal text message display // Normal text message display
var title=msg.title, titleFont = fontLarge, lines; var title=msg.title, titleFont = fontLarge, lines;
if (title) { if (title) {
@ -342,7 +362,7 @@ function showMessage(msgid) {
function goBack() { function goBack() {
msg.new = false; saveMessages(); // read mail msg.new = false; saveMessages(); // read mail
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0}); checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic:openMusic});
} }
var buttons = [ var buttons = [
{type:"btn", src:getBackImage(), cb:goBack} // back {type:"btn", src:getBackImage(), cb:goBack} // back
@ -353,7 +373,7 @@ function showMessage(msgid) {
msg.new = false; saveMessages(); msg.new = false; saveMessages();
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
Bangle.messageResponse(msg,true); Bangle.messageResponse(msg,true);
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1}); checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
}}); }});
} }
if (msg.negative) { if (msg.negative) {
@ -362,7 +382,7 @@ function showMessage(msgid) {
msg.new = false; saveMessages(); msg.new = false; saveMessages();
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
Bangle.messageResponse(msg,false); Bangle.messageResponse(msg,false);
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1}); checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
}}); }});
} }
@ -411,15 +431,19 @@ function checkMessages(options) {
return load(); return load();
} }
// we have >0 messages // we have >0 messages
var newMessages = MESSAGES.filter(m=>m.new); var newMessages = MESSAGES.filter(m=>m.new&&m.id!="music");
// If we have a new message, show it // If we have a new message, show it
if (options.showMsgIfUnread && newMessages.length) if (options.showMsgIfUnread && newMessages.length)
return showMessage(newMessages[0].id); return showMessage(newMessages[0].id);
// no new messages: show playing music? (only if we have playing music to show)
if (options.openMusic && MESSAGES.some(m=>m.id=="music" && m.track && m.state=="play"))
return showMessage('music');
// no new messages - go to clock? // no new messages - go to clock?
if (options.clockIfAllRead && newMessages.length==0) if (options.clockIfAllRead && newMessages.length==0)
return load(); return load();
// we don't have to time out of this screen... // we don't have to time out of this screen...
cancelReloadTimeout(); cancelReloadTimeout();
active = "main";
// Otherwise show a menu // Otherwise show a menu
E.showScroller({ E.showScroller({
h : 48, h : 48,
@ -482,5 +506,7 @@ setTimeout(() => {
print("Message not seen - reloading"); print("Message not seen - reloading");
load(); load();
}, unreadTimeoutSecs*1000); }, unreadTimeoutSecs*1000);
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:1}); // only openMusic on launch if music is new
var newMusic = MESSAGES.some(m=>m.id==="music"&&m.new);
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:1,openMusic:newMusic&&settings.openMusic});
},10); // if checkMessages wants to 'load', do that },10); // if checkMessages wants to 'load', do that

View File

@ -1,3 +1,10 @@
function openMusic() {
// only read settings file for first music message
if ("undefined"==typeof exports._openMusic) {
exports._openMusic = !!((require('Storage').readJSON("messages.settings.json", true) || {}).openMusic);
}
return exports._openMusic;
}
/* Push a new message onto messages queue, event is: /* Push a new message onto messages queue, event is:
{t:"add",id:int, src,title,subject,body,sender,tel, important:bool, new:bool} {t:"add",id:int, src,title,subject,body,sender,tel, important:bool, new:bool}
{t:"add",id:int, id:"music", state, artist, track, etc} // add new {t:"add",id:int, id:"music", state, artist, track, etc} // add new
@ -26,6 +33,9 @@ exports.pushMessage = function(event) {
messages.unshift(event); // add new messages to the beginning messages.unshift(event); // add new messages to the beginning
} }
else Object.assign(messages[mIdx], event); else Object.assign(messages[mIdx], event);
if (event.id=="music" && messages[mIdx].state=="play") {
messages[mIdx].new = true; // new track, or playback (re)started
}
} }
require("Storage").writeJSON("messages.json",messages); require("Storage").writeJSON("messages.json",messages);
// if in app, process immediately // if in app, process immediately
@ -34,8 +44,12 @@ exports.pushMessage = function(event) {
if (event.t=="remove" && !messages.some(m=>m.new)) { if (event.t=="remove" && !messages.some(m=>m.new)) {
if (global.WIDGETS && WIDGETS.messages) WIDGETS.messages.hide(); if (global.WIDGETS && WIDGETS.messages) WIDGETS.messages.hide();
} }
// ok, saved now - we only care if it's new // ok, saved now
if (event.t!="add") { if (event.id=="music" && Bangle.CLOCK && messages[mIdx].new && openMusic()) {
// just load the app to display music: no buzzing
load("messages.app.js");
} else if (event.t!="add") {
// we only care if it's new
return; return;
} else if(event.new == false) { } else if(event.new == false) {
return; return;

View File

@ -1,7 +1,7 @@
{ {
"id": "messages", "id": "messages",
"name": "Messages", "name": "Messages",
"version": "0.25", "version": "0.26",
"description": "App to display notifications from iOS and Gadgetbridge/Android", "description": "App to display notifications from iOS and Gadgetbridge/Android",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",

View File

@ -4,6 +4,7 @@
if (settings.vibrate===undefined) settings.vibrate="."; if (settings.vibrate===undefined) settings.vibrate=".";
if (settings.repeat===undefined) settings.repeat=4; if (settings.repeat===undefined) settings.repeat=4;
if (settings.unreadTimeout===undefined) settings.unreadTimeout=60; if (settings.unreadTimeout===undefined) settings.unreadTimeout=60;
settings.openMusic=!!settings.openMusic;
settings.maxUnreadTimeout=240; settings.maxUnreadTimeout=240;
return settings; return settings;
} }
@ -43,6 +44,11 @@
format: v => [/*LANG*/"Small",/*LANG*/"Medium"][v], format: v => [/*LANG*/"Small",/*LANG*/"Medium"][v],
onchange: v => updateSetting("fontSize", v) onchange: v => updateSetting("fontSize", v)
}, },
/*LANG*/'Auto-Open Music': {
value: !!settings().openMusic,
format: v => v?/*LANG*/'Yes':/*LANG*/'No',
onchange: v => updateSetting("openMusic", v)
},
}; };
E.showMenu(mainmenu); E.showMenu(mainmenu);
}) })

View File

@ -50,5 +50,5 @@ message but then the watch was never viewed. In that case we don't
want to buzz but should still show that there are unread messages. */ want to buzz but should still show that there are unread messages. */
if (global.MESSAGES===undefined) (function() { if (global.MESSAGES===undefined) (function() {
var messages = require("Storage").readJSON("messages.json",1)||[]; var messages = require("Storage").readJSON("messages.json",1)||[];
if (messages.some(m=>m.new)) WIDGETS["messages"].show(true); if (messages.some(m=>m.new&&m.id!="music")) WIDGETS["messages"].show(true);
})(); })();

View File

@ -9,3 +9,4 @@
0.09: Add third screen mode with large clock and waypoint selection display to ease visibility in bright daylight. 0.09: Add third screen mode with large clock and waypoint selection display to ease visibility in bright daylight.
0.10: Add Kalman filter to smooth the speed and altitude values. Can be disabled in settings. 0.10: Add Kalman filter to smooth the speed and altitude values. Can be disabled in settings.
0.11: Now also runs on Bangle.js 2 with basic functionality 0.11: Now also runs on Bangle.js 2 with basic functionality
0.12: Full functionality on Bangle.js 2: Bangle.js 1 buttons mapped to touch areas.

View File

@ -2,23 +2,21 @@
You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint. You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint.
*Note for **Bangle.js 2:** Currently only the BTN3 functionality is working with the Bangle.js 2 button.*
Within the [A]ltitude and [D]istance displays modes one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. Within the [A]ltitude and [D]istance displays modes one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed.
The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information.
## Buttons and Controls ## Buttons and Controls
BTN3 : Cycles the modes between Speed+[A]ltitude, Speed+[D]istance and large Time/Waypoint *(Mapping for **Bangle.js 2**: BTN2 = Touch upper right side; BTN3 = Touch lower right side; BTN4 = Touch left side)*
***Bangle.js 2:** Currently only this button function is working* BTN3 : Cycles the modes between Speed+[A]ltitude, Speed+[D]istance and large Time/Waypoint
### [A]ltitude mode ### [A]ltitude mode
BTN1 : Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. BTN1 : Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded.
BTN1 : Long press > 2 secs resets the recorded maximum values. BTN1 : Long press > 2 secs resets the recorded maximum values. *(Bangle.js 2: Long press > 0.4 secs)*
### [D]istance mode ### [D]istance mode
@ -32,7 +30,7 @@ BTN1 : Select next waypoint.
BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts.
BTN3 : Long press exit and return to watch. BTN3 : Long press exit and return to watch. *(Bangle.js 2: Long press BTN > 2 secs)*
BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display.

View File

@ -349,7 +349,7 @@ function drawSecondary(n,u) {
s = 30; // Font size s = 30; // Font size
if (BANGLEJS2) s *= fontFactorB2; if (BANGLEJS2) s *= fontFactorB2;
buf.setFontVector(s); buf.setFontVector(s);
buf.drawString(u,xu - (BANGLEJS2*20),screenH_TwoThirds-25); buf.drawString(u,xu - (BANGLEJS2*xu/5),screenH_TwoThirds-25);
} }
function drawTime() { function drawTime() {
@ -391,7 +391,7 @@ function drawWP() { // from waypoints.json - see README.md
buf.setFontAlign(-1,1); //left, bottom buf.setFontAlign(-1,1); //left, bottom
if (BANGLEJS2) s *= fontFactorB2; if (BANGLEJS2) s *= fontFactorB2;
buf.setFontVector(s); buf.setFontVector(s);
buf.drawString(nm.substring(0,6),72,screenH_TwoThirds-(BANGLEJS2 * 20)); buf.drawString(nm.substring(0,6),72,screenH_TwoThirds-(BANGLEJS2 * 15));
} }
if ( cfg.modeA == 2 ) { // clock/large mode if ( cfg.modeA == 2 ) { // clock/large mode
@ -421,7 +421,7 @@ function drawSats(sats) {
buf.drawString('A',screenW,140-(BANGLEJS2 * 40)); buf.drawString('A',screenW,140-(BANGLEJS2 * 40));
if ( showMax ) { if ( showMax ) {
buf.setFontAlign(0,1); //centre, bottom buf.setFontAlign(0,1); //centre, bottom
buf.drawString('MAX',120,164); buf.drawString('MAX',screenW_Half,screenH_TwoThirds + 4);
} }
} }
if ( cfg.modeA == 0 ) buf.drawString('D',screenW,140-(BANGLEJS2 * 40)); if ( cfg.modeA == 0 ) buf.drawString('D',screenW,140-(BANGLEJS2 * 40));
@ -536,22 +536,18 @@ function onGPS(fix) {
} }
function setButtons(){
if (!BANGLEJS2) { // Buttons for Bangle.js
// Spd+Dist : Select next waypoint
setWatch(function(e) {
var dur = e.time - e.lastTime;
if ( cfg.modeA == 1 ) {
// Spd+Alt mode - Switch between fix and MAX
if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display
else { max.spd = 0; max.alt = 0; } // Long press resets max values.
}
else nxtWp(1); // Spd+Dist or Clock mode - Select next waypoint
onGPS(lf);
}, BTN1, { edge:"falling",repeat:true});
// Power saving on/off function btn1press(longpress) {
setWatch(function(e){ if(emulator) console.log("Btn1, long="+longpress);
if ( cfg.modeA == 1 ) { // Spd+Alt mode - Switch between fix and MAX
if ( !longpress ) showMax = !showMax; // Short press toggle fix/max display
else { max.spd = 0; max.alt = 0; } // Long press resets max values.
}
else nxtWp(1); // Spd+Dist or Clock mode - Select next waypoint
onGPS(lf);
}
function btn2press(){
if(emulator) console.log("Btn2");
pwrSav=!pwrSav; pwrSav=!pwrSav;
if ( pwrSav ) { if ( pwrSav ) {
LED1.reset(); LED1.reset();
@ -564,52 +560,51 @@ if (!BANGLEJS2) { // Buttons for Bangle.js
Bangle.setLCDPower(1); Bangle.setLCDPower(1);
LED1.set(); LED1.set();
} }
}, BTN2, {repeat:true,edge:"falling"}); }
function btn3press(){
// Toggle between alt or dist if(emulator) console.log("Btn3");
setWatch(function(e){
cfg.modeA = cfg.modeA+1;
if ( cfg.modeA > 2 ) cfg.modeA = 0;
savSettings();
onGPS(lf);
}, BTN3, {repeat:true,edge:"falling"});
// Touch left screen to toggle display
setWatch(function(e){
cfg.primSpd = !cfg.primSpd;
savSettings();
onGPS(lf); // Update display
}, BTN4, {repeat:true,edge:"falling"});
} else { // Buttons for Bangle.js 2
setWatch(function(e){ // Bangle.js BTN3
cfg.modeA = cfg.modeA+1; cfg.modeA = cfg.modeA+1;
if ( cfg.modeA > 2 ) cfg.modeA = 0; if ( cfg.modeA > 2 ) cfg.modeA = 0;
if(emulator)console.log("cfg.modeA="+cfg.modeA); if(emulator)console.log("cfg.modeA="+cfg.modeA);
savSettings(); savSettings();
onGPS(lf); onGPS(lf);
}, BTN1, {repeat:true,edge:"falling"}); }
function btn4press(){
/* Bangle.on('tap', function(data) { // data - {dir, double, x, y, z} if(emulator) console.log("Btn4");
cfg.primSpd = !cfg.primSpd; cfg.primSpd = !cfg.primSpd;
if(emulator)console.log("!cfg.primSpd"); savSettings();
}); */ onGPS(lf); // Update display
}
/* Bangle.on('swipe', function(dir) {
if (dir < 0) { // left: Bangle.js BTN3 function setButtons(){
cfg.modeA = cfg.modeA+1; if (!BANGLEJS2) { // Buttons for Bangle.js 1
if ( cfg.modeA > 2 ) cfg.modeA = 0; setWatch(function(e) {
if(emulator)console.log("cfg.modeA="+cfg.modeA); btn1press(( e.time - e.lastTime) > 2); // > 2 sec. is long press
} }, BTN1, { edge:"falling",repeat:true});
// Power saving on/off (red dot visible if off)
setWatch(btn2press, BTN2, {repeat:true,edge:"falling"});
// Toggle between alt or dist
setWatch(btn3press, BTN3, {repeat:true,edge:"falling"});
// Touch left screen to toggle display
setWatch(btn4press, BTN4, {repeat:true,edge:"falling"});
} else { // Buttons for Bangle.js 2
setWatch(function(e) {
btn1press(( e.time - e.lastTime) > 0.4); // > 0.4 sec. is long press
}, BTN1, { edge:"falling",repeat:true});
Bangle.on('touch', function(btn_l_r, e) {
if(e.x < screenW_Half) btn4press();
else else
{ // right: Bangle.js BTN4 if (e.y < screenH_Half)
cfg.primSpd = !cfg.primSpd; btn2press();
if(emulator)console.log("!cfg.primSpd"); else
} btn3press();
}); });
*/
savSettings();
onGPS(lf);
} }
} }
@ -700,18 +695,6 @@ Bangle.on('lcdPower',function(on) {
else stopDraw(); else stopDraw();
}); });
/*
function onGPSraw(nmea) {
var nofGP = 0, nofBD = 0, nofGL = 0;
if (nmea.slice(3,6) == "GSV") {
// console.log(nmea.slice(1,3) + " " + nmea.slice(11,13));
if (nmea.slice(0,7) == "$GPGSV,") nofGP = Number(nmea.slice(11,13));
if (nmea.slice(0,7) == "$BDGSV,") nofBD = Number(nmea.slice(11,13));
if (nmea.slice(0,7) == "$GLGSV,") nofGL = Number(nmea.slice(11,13));
SATinView = nofGP + nofBD + nofGL;
} }
if(BANGLEJS2) Bangle.on('GPS-raw', onGPSraw);
*/
var gpssetup; var gpssetup;
try { try {

View File

@ -2,7 +2,7 @@
"id": "speedalt", "id": "speedalt",
"name": "GPS Adventure Sports", "name": "GPS Adventure Sports",
"shortName": "GPS Adv Sport", "shortName": "GPS Adv Sport",
"version": "0.11", "version": "0.12",
"description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",

View File

@ -3,7 +3,7 @@
"name": "Terminal Clock", "name": "Terminal Clock",
"shortName":"Terminal Clock", "shortName":"Terminal Clock",
"description": "A terminal cli like clock displaying multiple sensor data", "description": "A terminal cli like clock displaying multiple sensor data",
"version":"0.01", "version":"0.02",
"icon": "app.png", "icon": "app.png",
"type": "clock", "type": "clock",
"tags": "clock", "tags": "clock",

View File

@ -5,3 +5,4 @@
0.05: "Chime the time" (buzz or beep) with up/down swipe added 0.05: "Chime the time" (buzz or beep) with up/down swipe added
0.06: Redraw widgets when time is updated 0.06: Redraw widgets when time is updated
0.07: Fix problem with "Bangle.CLOCK": github.com/espruino/BangleApps/issues/1437 0.07: Fix problem with "Bangle.CLOCK": github.com/espruino/BangleApps/issues/1437
0.08: Redraw widgets only once per minute

View File

@ -81,7 +81,7 @@ function draw() {
executeCommands(); executeCommands();
Bangle.drawWidgets(); if (process.env.HWVERSION==2) Bangle.drawWidgets();
} }
var timeout; var timeout;

View File

@ -1,7 +1,7 @@
{ {
"id": "vectorclock", "id": "vectorclock",
"name": "Vector Clock", "name": "Vector Clock",
"version": "0.07", "version": "0.08",
"description": "A digital clock that uses the built-in vector font.", "description": "A digital clock that uses the built-in vector font.",
"icon": "app.png", "icon": "app.png",
"type": "clock", "type": "clock",