mirror of https://github.com/espruino/BangleApps
Merge branch 'master' of github.com:espruino/BangleApps
commit
97f0e2eda5
|
@ -196,7 +196,7 @@ if (!Bangle.appRect) { // added in 2v11 - polyfill for older firmwares
|
|||
// Append *.boot.js files
|
||||
// These could change bleServices/bleServiceOptions if needed
|
||||
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 bPriority = b.match(getPriority);
|
||||
if (aPriority && bPriority){
|
||||
|
@ -206,7 +206,7 @@ require('Storage').list(/\.boot\.js/).sort((a,b)=>{
|
|||
} else if (!aPriority && bPriority){
|
||||
return 1;
|
||||
}
|
||||
return a > b;
|
||||
return a==b ? 0 : (a>b ? 1 : -1);
|
||||
}).forEach(bootFile=>{
|
||||
// we add a semicolon so if the file is wrapped in (function(){ ... }()
|
||||
// with no semicolon we don't end up with (function(){ ... }()(function(){ ... }()
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: added settings menu to change color
|
||||
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.05: changed text to uppercase, just looks better, removed colons on text
|
||||
|
|
|
@ -109,10 +109,10 @@ function updateSunRiseSunSet(now, lat, lon, line){
|
|||
const infoData = {
|
||||
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_SR: { calc: () => 'Sunrise: ' + sunRise },
|
||||
ID_SS: { calc: () => 'Sunset: ' + sunSet },
|
||||
ID_STEP: { calc: () => 'Steps: ' + getSteps() },
|
||||
ID_BATT: { calc: () => 'Battery: ' + E.getBattery() + '%' },
|
||||
ID_SR: { calc: () => 'Sunrise ' + sunRise },
|
||||
ID_SS: { calc: () => 'Sunset ' + sunSet },
|
||||
ID_STEP: { calc: () => 'Steps ' + getSteps() },
|
||||
ID_BATT: { calc: () => 'Battery ' + E.getBattery() + '%' },
|
||||
ID_HRM: { calc: () => hrmCurrent }
|
||||
};
|
||||
|
||||
|
@ -158,7 +158,7 @@ function drawInfo() {
|
|||
g.setColor('#f00'); // red
|
||||
drawHeartIcon();
|
||||
} else {
|
||||
g.drawString((infoData[infoMode].calc()), w/2, infoLine);
|
||||
g.drawString((infoData[infoMode].calc().toUpperCase()), w/2, infoLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "daisy",
|
||||
"name": "Daisy",
|
||||
"version":"0.04",
|
||||
"version":"0.05",
|
||||
"dependencies": {"mylocation":"app"},
|
||||
"description": "A clock based on the Pastel clock with large ring guage for steps",
|
||||
"icon": "app.png",
|
||||
|
|
|
@ -7,7 +7,7 @@ screen. Very useful if combined with pattern launcher ;)
|
|||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
## Contributors
|
||||
|
|
|
@ -38,3 +38,4 @@
|
|||
Now attempt to use Large/Big/Medium fonts, and allow minimum font size to be configured
|
||||
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.26: Setting to auto-open music
|
||||
|
|
|
@ -13,12 +13,13 @@ and `Messages`:
|
|||
|
||||
* `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
|
||||
* `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
|
||||
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
|
||||
it starts getting clipped.
|
||||
* `Auto-Open Music` - Should the app automatically open when the phone starts playing music?
|
||||
|
||||
## New Messages
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ var fontSmall = "6x8";
|
|||
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
|
||||
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
|
||||
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
|
||||
try {
|
||||
g.setFont("6x8:2");
|
||||
|
@ -50,10 +52,14 @@ var MESSAGES = require("Storage").readJSON("messages.json",1)||[];
|
|||
if (!Array.isArray(MESSAGES)) MESSAGES=[];
|
||||
var onMessagesModified = function(msg) {
|
||||
// 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();
|
||||
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);
|
||||
};
|
||||
function saveMessages() {
|
||||
|
@ -135,6 +141,7 @@ function getMessageImageCol(msg,def) {
|
|||
}
|
||||
|
||||
function showMapMessage(msg) {
|
||||
active = "map";
|
||||
var m;
|
||||
var distance, street, target, eta;
|
||||
m=msg.title.match(/(.*) - (.*)/);
|
||||
|
@ -168,12 +175,14 @@ function showMapMessage(msg) {
|
|||
msg.new = false;
|
||||
saveMessages();
|
||||
layout = undefined;
|
||||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
|
||||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:0});
|
||||
});
|
||||
}
|
||||
|
||||
var updateLabelsInterval;
|
||||
function showMusicMessage(msg) {
|
||||
var updateLabelsInterval;
|
||||
active = "music";
|
||||
openMusic = msg.state=="play";
|
||||
var trackScrollOffset = 0;
|
||||
var artistScrollOffset = 0;
|
||||
var albumScrollOffset = 0;
|
||||
|
@ -194,10 +203,14 @@ function showMusicMessage(msg) {
|
|||
|
||||
function back() {
|
||||
clearInterval(updateLabelsInterval);
|
||||
updateLabelsInterval = undefined;
|
||||
openMusic = false;
|
||||
var wasNew = msg.new;
|
||||
msg.new = false;
|
||||
saveMessages();
|
||||
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() {
|
||||
trackName = reduceStringAndPad(msg.track, trackScrollOffset, 13);
|
||||
|
@ -243,6 +256,7 @@ function showMusicMessage(msg) {
|
|||
}
|
||||
|
||||
function showMessageScroller(msg) {
|
||||
active = "scroller";
|
||||
var bodyFont = fontBig;
|
||||
g.setFont(bodyFont);
|
||||
var lines = [];
|
||||
|
@ -272,6 +286,7 @@ function showMessageScroller(msg) {
|
|||
}
|
||||
|
||||
function showMessageSettings(msg) {
|
||||
active = "settings";
|
||||
E.showMenu({"":{"title":/*LANG*/"Message"},
|
||||
"< Back" : () => showMessage(msg.id),
|
||||
/*LANG*/"View Message" : () => {
|
||||
|
@ -280,12 +295,12 @@ function showMessageSettings(msg) {
|
|||
/*LANG*/"Delete" : () => {
|
||||
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
||||
saveMessages();
|
||||
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0});
|
||||
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
||||
},
|
||||
/*LANG*/"Mark Unread" : () => {
|
||||
msg.new = true;
|
||||
saveMessages();
|
||||
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0});
|
||||
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
||||
},
|
||||
/*LANG*/"Delete all messages" : () => {
|
||||
E.showPrompt(/*LANG*/"Are you sure?", {title:/*LANG*/"Delete All Messages"}).then(isYes => {
|
||||
|
@ -293,7 +308,7 @@ function showMessageSettings(msg) {
|
|||
MESSAGES = [];
|
||||
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) {
|
||||
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 (msg.src=="Maps") {
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
return showMapMessage(msg);
|
||||
if (updateLabelsInterval) {
|
||||
clearInterval(updateLabelsInterval);
|
||||
updateLabelsInterval=undefined;
|
||||
}
|
||||
if (!msg) return checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic:openMusic}); // go home if no message found
|
||||
if (msg.id=="music") {
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
return showMusicMessage(msg);
|
||||
}
|
||||
if (msg.src=="Maps") {
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
return showMapMessage(msg);
|
||||
}
|
||||
active = "message";
|
||||
// Normal text message display
|
||||
var title=msg.title, titleFont = fontLarge, lines;
|
||||
if (title) {
|
||||
|
@ -342,7 +362,7 @@ function showMessage(msgid) {
|
|||
function goBack() {
|
||||
msg.new = false; saveMessages(); // read mail
|
||||
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 = [
|
||||
{type:"btn", src:getBackImage(), cb:goBack} // back
|
||||
|
@ -353,7 +373,7 @@ function showMessage(msgid) {
|
|||
msg.new = false; saveMessages();
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
Bangle.messageResponse(msg,true);
|
||||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
|
||||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
|
||||
}});
|
||||
}
|
||||
if (msg.negative) {
|
||||
|
@ -362,7 +382,7 @@ function showMessage(msgid) {
|
|||
msg.new = false; saveMessages();
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
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();
|
||||
}
|
||||
// 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 (options.showMsgIfUnread && newMessages.length)
|
||||
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?
|
||||
if (options.clockIfAllRead && newMessages.length==0)
|
||||
return load();
|
||||
// we don't have to time out of this screen...
|
||||
cancelReloadTimeout();
|
||||
active = "main";
|
||||
// Otherwise show a menu
|
||||
E.showScroller({
|
||||
h : 48,
|
||||
|
@ -482,5 +506,7 @@ setTimeout(() => {
|
|||
print("Message not seen - reloading");
|
||||
load();
|
||||
}, 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
|
||||
|
|
|
@ -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:
|
||||
{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
|
||||
|
@ -26,6 +33,9 @@ exports.pushMessage = function(event) {
|
|||
messages.unshift(event); // add new messages to the beginning
|
||||
}
|
||||
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);
|
||||
// if in app, process immediately
|
||||
|
@ -34,8 +44,12 @@ exports.pushMessage = function(event) {
|
|||
if (event.t=="remove" && !messages.some(m=>m.new)) {
|
||||
if (global.WIDGETS && WIDGETS.messages) WIDGETS.messages.hide();
|
||||
}
|
||||
// ok, saved now - we only care if it's new
|
||||
if (event.t!="add") {
|
||||
// ok, saved now
|
||||
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;
|
||||
} else if(event.new == false) {
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "messages",
|
||||
"name": "Messages",
|
||||
"version": "0.25",
|
||||
"version": "0.26",
|
||||
"description": "App to display notifications from iOS and Gadgetbridge/Android",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
if (settings.vibrate===undefined) settings.vibrate=".";
|
||||
if (settings.repeat===undefined) settings.repeat=4;
|
||||
if (settings.unreadTimeout===undefined) settings.unreadTimeout=60;
|
||||
settings.openMusic=!!settings.openMusic;
|
||||
settings.maxUnreadTimeout=240;
|
||||
return settings;
|
||||
}
|
||||
|
@ -43,6 +44,11 @@
|
|||
format: v => [/*LANG*/"Small",/*LANG*/"Medium"][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);
|
||||
})
|
||||
|
|
|
@ -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. */
|
||||
if (global.MESSAGES===undefined) (function() {
|
||||
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);
|
||||
})();
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
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.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.
|
||||
|
|
|
@ -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.
|
||||
|
||||
*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.
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ function drawSecondary(n,u) {
|
|||
s = 30; // Font size
|
||||
if (BANGLEJS2) s *= fontFactorB2;
|
||||
buf.setFontVector(s);
|
||||
buf.drawString(u,xu - (BANGLEJS2*20),screenH_TwoThirds-25);
|
||||
buf.drawString(u,xu - (BANGLEJS2*xu/5),screenH_TwoThirds-25);
|
||||
}
|
||||
|
||||
function drawTime() {
|
||||
|
@ -391,7 +391,7 @@ function drawWP() { // from waypoints.json - see README.md
|
|||
buf.setFontAlign(-1,1); //left, bottom
|
||||
if (BANGLEJS2) s *= fontFactorB2;
|
||||
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
|
||||
|
@ -421,7 +421,7 @@ function drawSats(sats) {
|
|||
buf.drawString('A',screenW,140-(BANGLEJS2 * 40));
|
||||
if ( showMax ) {
|
||||
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));
|
||||
|
@ -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
|
||||
setWatch(function(e){
|
||||
function btn1press(longpress) {
|
||||
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;
|
||||
if ( pwrSav ) {
|
||||
LED1.reset();
|
||||
|
@ -564,52 +560,51 @@ if (!BANGLEJS2) { // Buttons for Bangle.js
|
|||
Bangle.setLCDPower(1);
|
||||
LED1.set();
|
||||
}
|
||||
}, BTN2, {repeat:true,edge:"falling"});
|
||||
|
||||
// Toggle between alt or dist
|
||||
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
|
||||
}
|
||||
function btn3press(){
|
||||
if(emulator) console.log("Btn3");
|
||||
cfg.modeA = cfg.modeA+1;
|
||||
if ( cfg.modeA > 2 ) cfg.modeA = 0;
|
||||
if(emulator)console.log("cfg.modeA="+cfg.modeA);
|
||||
savSettings();
|
||||
onGPS(lf);
|
||||
}, BTN1, {repeat:true,edge:"falling"});
|
||||
|
||||
/* Bangle.on('tap', function(data) { // data - {dir, double, x, y, z}
|
||||
}
|
||||
function btn4press(){
|
||||
if(emulator) console.log("Btn4");
|
||||
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
|
||||
cfg.modeA = cfg.modeA+1;
|
||||
if ( cfg.modeA > 2 ) cfg.modeA = 0;
|
||||
if(emulator)console.log("cfg.modeA="+cfg.modeA);
|
||||
}
|
||||
|
||||
function setButtons(){
|
||||
if (!BANGLEJS2) { // Buttons for Bangle.js 1
|
||||
setWatch(function(e) {
|
||||
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
|
||||
{ // right: Bangle.js BTN4
|
||||
cfg.primSpd = !cfg.primSpd;
|
||||
if(emulator)console.log("!cfg.primSpd");
|
||||
}
|
||||
if (e.y < screenH_Half)
|
||||
btn2press();
|
||||
else
|
||||
btn3press();
|
||||
});
|
||||
*/
|
||||
savSettings();
|
||||
onGPS(lf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,18 +695,6 @@ Bangle.on('lcdPower',function(on) {
|
|||
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;
|
||||
try {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "speedalt",
|
||||
"name": "GPS Adventure Sports",
|
||||
"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.",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Terminal Clock",
|
||||
"shortName":"Terminal Clock",
|
||||
"description": "A terminal cli like clock displaying multiple sensor data",
|
||||
"version":"0.01",
|
||||
"version":"0.02",
|
||||
"icon": "app.png",
|
||||
"type": "clock",
|
||||
"tags": "clock",
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
0.05: "Chime the time" (buzz or beep) with up/down swipe added
|
||||
0.06: Redraw widgets when time is updated
|
||||
0.07: Fix problem with "Bangle.CLOCK": github.com/espruino/BangleApps/issues/1437
|
||||
0.08: Redraw widgets only once per minute
|
||||
|
|
|
@ -81,7 +81,7 @@ function draw() {
|
|||
|
||||
executeCommands();
|
||||
|
||||
Bangle.drawWidgets();
|
||||
if (process.env.HWVERSION==2) Bangle.drawWidgets();
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "vectorclock",
|
||||
"name": "Vector Clock",
|
||||
"version": "0.07",
|
||||
"version": "0.08",
|
||||
"description": "A digital clock that uses the built-in vector font.",
|
||||
"icon": "app.png",
|
||||
"type": "clock",
|
||||
|
|
Loading…
Reference in New Issue