mirror of https://github.com/espruino/BangleApps
Add more apps
parent
a5cf31075b
commit
532d2d3695
53
apps.json
53
apps.json
|
@ -20,5 +20,58 @@
|
||||||
{"name":"-compass","file":"compass.js"},
|
{"name":"-compass","file":"compass.js"},
|
||||||
{"name":"*compass","file":"compass-icon.js"}
|
{"name":"*compass","file":"compass-icon.js"}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{ "id": "clock",
|
||||||
|
"name": "Morphing Clock",
|
||||||
|
"icon": "clock-morphing.png",
|
||||||
|
"description": "7 segment clock that morphs between minutes and hours",
|
||||||
|
"tags": "clock",
|
||||||
|
"storage": [
|
||||||
|
{"name":"+clock","file":"clock.json"},
|
||||||
|
{"name":"-clock","file":"clock-morphing.js"},
|
||||||
|
{"name":"*clock","file":"clock-icon.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ "id": "gpstime",
|
||||||
|
"name": "GPS Time",
|
||||||
|
"icon": "gpstime.png",
|
||||||
|
"description": "Update the Bangle.js's clock based on the time from the GPS receiver",
|
||||||
|
"tags": "tool",
|
||||||
|
"storage": [
|
||||||
|
{"name":"+gpstime","file":"gpstime.json"},
|
||||||
|
{"name":"-gpstime","file":"gpstime.js"},
|
||||||
|
{"name":"*gpstime","file":"gpstime-icon.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ "id": "openloc",
|
||||||
|
"name": "Open Location / Plus Codes",
|
||||||
|
"description": "Convert your current GPS location to a series of characters",
|
||||||
|
"tags": "tool,outdoors",
|
||||||
|
"storage": [
|
||||||
|
{"name":"+openloc","file":"openlocation.json"},
|
||||||
|
{"name":"-openloc","file":"openlocation.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ "id": "speedo",
|
||||||
|
"name": "Speedo",
|
||||||
|
"icon": "speedo.png",
|
||||||
|
"description": "Show the current speed according to the GPS",
|
||||||
|
"tags": "tool,outdoors",
|
||||||
|
"storage": [
|
||||||
|
{"name":"+speedo","file":"speedo.json"},
|
||||||
|
{"name":"-speedo","file":"speedo.js"},
|
||||||
|
{"name":"*speedo","file":"speedo-icon.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ "id": "slevel",
|
||||||
|
"name": "Spirit Level",
|
||||||
|
"icon": "spiritlevel.png",
|
||||||
|
"description": "Show the current angle of the watch, so you can use it to make sure something is absolutely flat",
|
||||||
|
"tags": "tool",
|
||||||
|
"storage": [
|
||||||
|
{"name":"+slevel","file":"spiritlevel.json"},
|
||||||
|
{"name":"-slevel","file":"spiritlevel.js"},
|
||||||
|
{"name":"*slevel","file":"spiritlevel-icon.js"}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
equire("heatshrink").decompress(atob("mEwghC/AE8IxAAEwAWVDB4WIDBwWJAAIWPmf//8zDBpFDwYVBAAc4JJYWJDAoXKn4SC+EPAgXzC5JGCx4qDC4n//BIIEIRCEC4v/GBBdHC4xhCIw5dDC5BhCJAgXCRQoXGJAQXEUhAXHJAyNGC5KRCC7p2FC5B4CC5kggQXOBwvyBQMvSA4XL+EIwCoIC8ZHCgYXNO44LBBIiPPCAIwFC5DXGAAMwGAjvPGA4XIwYXHGALBDnAXFhCQHGAaOFwAXGPA4bFC4xIMIxIXDJBJGEC4xICSJCNEIwowEMJBdCFwwXEMJBdCC5BICDA4WDIw4wEAAMzCoMzBAgWIDAwAGCxRJEAAxFJDBgWNDBAWPAH4AYA=="))
|
|
@ -0,0 +1,190 @@
|
||||||
|
// Enable 'Set Current Time' in Settings -> Communications before sending
|
||||||
|
(function(){ // make our own scope so this is GC'd when intervals are cleared
|
||||||
|
// Offscreen buffer
|
||||||
|
var buf = Graphics.createArrayBuffer(240,86,1,{msb:true});
|
||||||
|
function flip() { g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},0,50);
|
||||||
|
}
|
||||||
|
// The last time that we displayed
|
||||||
|
var lastTime = " ";
|
||||||
|
// If animating, this is the interval's id
|
||||||
|
var animInterval;
|
||||||
|
|
||||||
|
/* Get array of lines from digit d to d+1.
|
||||||
|
n is the amount (0..1)
|
||||||
|
maxFive is true is this digit only counts 0..5 */
|
||||||
|
const DIGITS = {
|
||||||
|
" ":n=>[],
|
||||||
|
"0":n=>[
|
||||||
|
[n,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[n,2,1,2],
|
||||||
|
[n,1,n,2],
|
||||||
|
[n,0,n,1]],
|
||||||
|
"1":n=>[
|
||||||
|
[1-n,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[1-n,1,1,1],
|
||||||
|
[1-n,1,1-n,2],
|
||||||
|
[1-n,2,1,2]],
|
||||||
|
"2":n=>[
|
||||||
|
[0,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[0,1,1,1],
|
||||||
|
[0,1+n,0,2],
|
||||||
|
[1,2-n,1,2],
|
||||||
|
[0,2,1,2]],
|
||||||
|
"3":n=>[
|
||||||
|
[0,0,1-n,0],
|
||||||
|
[0,0,0,n],
|
||||||
|
[1,0,1,1],
|
||||||
|
[0,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[n,2,1,2]],
|
||||||
|
"4":n=>[
|
||||||
|
[0,0,0,1],
|
||||||
|
[1,0,1-n,0],
|
||||||
|
[1,0,1,1-n],
|
||||||
|
[0,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[1-n,2,1,2]],
|
||||||
|
"5": (n,maxFive)=>maxFive ? [ // 5 -> 0
|
||||||
|
[0,0,0,1],
|
||||||
|
[0,0,1,0],
|
||||||
|
[n,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[0,2,1,2],
|
||||||
|
[0,2,0,2],
|
||||||
|
[1,1-n,1,1],
|
||||||
|
[0,1,0,1+n]] : [ // 5 -> 6
|
||||||
|
[0,0,0,1],
|
||||||
|
[0,0,1,0],
|
||||||
|
[0,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[0,2,1,2],
|
||||||
|
[0,2-n,0,2]],
|
||||||
|
"6":n=>[
|
||||||
|
[0,0,0,1-n],
|
||||||
|
[0,0,1,0],
|
||||||
|
[n,1,1,1],
|
||||||
|
[1,1-n,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[n,2,1,2],
|
||||||
|
[0,1-n,0,2-2*n]],
|
||||||
|
"7":n=>[
|
||||||
|
[0,0,0,n],
|
||||||
|
[0,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[1-n,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[1-n,2,1,2],
|
||||||
|
[1-n,1,1-n,2]],
|
||||||
|
"8":n=>[
|
||||||
|
[0,0,0,1],
|
||||||
|
[0,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[0,1,1,1],
|
||||||
|
[1,1,1,2],
|
||||||
|
[0,2,1,2],
|
||||||
|
[0,1,0,2-n]],
|
||||||
|
"9":n=>[
|
||||||
|
[0,0,0,1],
|
||||||
|
[0,0,1,0],
|
||||||
|
[1,0,1,1],
|
||||||
|
[0,1,1-n,1],
|
||||||
|
[0,1,0,1+n],
|
||||||
|
[1,1,1,2],
|
||||||
|
[0,2,1,2]],
|
||||||
|
":":n=>[
|
||||||
|
[0.4,0.4,0.6,0.4],
|
||||||
|
[0.6,0.4,0.6,0.6],
|
||||||
|
[0.6,0.6,0.4,0.6],
|
||||||
|
[0.4,0.4,0.4,0.6],
|
||||||
|
[0.4,1.4,0.6,1.4],
|
||||||
|
[0.6,1.4,0.6,1.6],
|
||||||
|
[0.6,1.6,0.4,1.6],
|
||||||
|
[0.4,1.4,0.4,1.6]]
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Draw a transition between lastText and thisText.
|
||||||
|
'n' is the amount - 0..1 */
|
||||||
|
function draw(lastText,thisText,n) {
|
||||||
|
buf.clear();
|
||||||
|
var x = 1; // x offset
|
||||||
|
const p = 2; // padding around digits
|
||||||
|
var y = p; // y offset
|
||||||
|
const s = 34; // character size
|
||||||
|
for (var i=0;i<lastText.length;i++) {
|
||||||
|
var lastCh = lastText[i];
|
||||||
|
var thisCh = thisText[i];
|
||||||
|
if (thisCh==":") x-=4;
|
||||||
|
var ch, chn = n;
|
||||||
|
if (lastCh!==undefined &&
|
||||||
|
(thisCh-1==lastCh ||
|
||||||
|
(thisCh==0 && lastCh==5) ||
|
||||||
|
(thisCh==0 && lastCh==9)))
|
||||||
|
ch = lastCh;
|
||||||
|
else {
|
||||||
|
ch = thisCh;
|
||||||
|
chn = 0;
|
||||||
|
}
|
||||||
|
var l = DIGITS[ch](chn,lastCh==5 && thisCh==0);
|
||||||
|
l.forEach(c=>{
|
||||||
|
if (c[0]!=c[2]) // horiz
|
||||||
|
buf.fillRect(x+c[0]*s,y+c[1]*s-p,x+c[2]*s,y+c[3]*s+p);
|
||||||
|
else if (c[1]!=c[3]) // vert
|
||||||
|
buf.fillRect(x+c[0]*s-p,y+c[1]*s,x+c[2]*s+p,y+c[3]*s);
|
||||||
|
});
|
||||||
|
if (thisCh==":") x-=4;
|
||||||
|
x+=s+p+7;
|
||||||
|
}
|
||||||
|
y += 2*s;
|
||||||
|
var d = new Date();
|
||||||
|
buf.setFont("6x8");
|
||||||
|
buf.setFontAlign(-1,-1);
|
||||||
|
buf.drawString(("0"+d.getSeconds()).substr(-2), x, y-8);
|
||||||
|
// date
|
||||||
|
buf.setFontAlign(0,-1);
|
||||||
|
var date = d.toString().substr(0,15);
|
||||||
|
buf.drawString(date, buf.getWidth()/2, y+8);
|
||||||
|
flip();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show the current time, and animate if needed */
|
||||||
|
function showTime() {
|
||||||
|
if (!Bangle.isLCDOn()) return;
|
||||||
|
if (animInterval) return; // in animation - quit
|
||||||
|
var d = new Date();
|
||||||
|
var t = (" "+d.getHours()).substr(-2)+":"+
|
||||||
|
("0"+d.getMinutes()).substr(-2);
|
||||||
|
var l = lastTime;
|
||||||
|
// same - don't animate
|
||||||
|
if (t==l) {
|
||||||
|
draw(t,l,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var n = 0;
|
||||||
|
animInterval = setInterval(function() {
|
||||||
|
n += 1/10;
|
||||||
|
if (n>=1) {
|
||||||
|
n=1;
|
||||||
|
clearInterval(animInterval);
|
||||||
|
animInterval=0;
|
||||||
|
}
|
||||||
|
draw(l,t,n);
|
||||||
|
}, 20);
|
||||||
|
lastTime = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bangle.on('lcdPower',function(on) {
|
||||||
|
if (on) {
|
||||||
|
showTime();
|
||||||
|
drawWidgets();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
g.clear();
|
||||||
|
// Update time once a second
|
||||||
|
setInterval(showTime, 1000);
|
||||||
|
showTime();
|
||||||
|
})();
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name":"Clock",
|
||||||
|
"icon":"*clock",
|
||||||
|
"src":"-clock"
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwghC/AH8A1QWVhWq0AuVAAIuVAAIwT1WinQwTFwMzmQwTCYMjlUqGCIuBlWi0UzC6JdBIoMjC4UDmAuOkYXBPAWgmczLp2ilUiVAUDC4IwLFwIUBLoJ2BFwQwM1WjCgJ1DFwQwLFwJ1B0SQCkQWDGBQXBCgK9BDgKQBAAgwJOwUzRgIDBC54wCkZdGPBwACRgguDBIIwLFxEJBQIwLFxGaBYQwKFxQwLgAWGmQuBcAQwJC48ifYYwJgUidgsyC4L7DGBIXBdohnBCgL7BcYIXIGAqMCIoL7DL5IwERgIUBLoL7BO5QXBGAK7DkWiOxQXGFwOjFoUyFxZhDgBdCCgJ1CCxYxCgBABkcqOwIuNGAQXC0S9BLpgAFXoIwBmYuPAAYwCLp4wHFyYwDFyYwDFygwCCyoA/AFQA="))
|
|
@ -0,0 +1,64 @@
|
||||||
|
var img = require("heatshrink").decompress(atob("mEwghC/AH8A1QWVhWq0AuVAAIuVAAIwT1WinQwTFwMzmQwTCYMjlUqGCIuBlWi0UzC6JdBIoMjC4UDmAuOkYXBPAWgmczLp2ilUiVAUDC4IwLFwIUBLoJ2BFwQwM1WjCgJ1DFwQwLFwJ1B0SQCkQWDGBQXBCgK9BDgKQBAAgwJOwUzRgIDBC54wCkZdGPBwACRgguDBIIwLFxEJBQIwLFxGaBYQwKFxQwLgAWGmQuBcAQwJC48ifYYwJgUidgsyC4L7DGBIXBdohnBCgL7BcYIXIGAqMCIoL7DL5IwERgIUBLoL7BO5QXBGAK7DkWiOxQXGFwOjFoUyFxZhDgBdCCgJ1CCxYxCgBABkcqOwIuNGAQXC0S9BLpgAFXoIwBmYuPAAYwCLp4wHFyYwDFyYwDFygwCCyoA/AFQA="));
|
||||||
|
|
||||||
|
Bangle.setLCDPower(1);
|
||||||
|
Bangle.setLCDTimeout(0);
|
||||||
|
|
||||||
|
g.clear();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var fix;
|
||||||
|
Bangle.on('GPS',function(f) {
|
||||||
|
fix = f;
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
g.clearRect(90,30,239,90);
|
||||||
|
if (fix.fix) {
|
||||||
|
g.drawString("GPS",170,40);
|
||||||
|
g.drawString("Acquired",170,60);
|
||||||
|
} else {
|
||||||
|
g.drawString("Waiting for",170,40);
|
||||||
|
g.drawString("GPS Fix",170,60);
|
||||||
|
}
|
||||||
|
g.setFont("6x8");
|
||||||
|
g.drawString(fix.satellites+" satellites",170,80);
|
||||||
|
|
||||||
|
g.clearRect(0,100,239,239);
|
||||||
|
var t = fix.time.toString().split(" ");/*
|
||||||
|
[
|
||||||
|
"Sun",
|
||||||
|
"Nov",
|
||||||
|
"10",
|
||||||
|
"2019",
|
||||||
|
"15:55:35",
|
||||||
|
"GMT+0100"
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
//g.setFont("6x8",2);
|
||||||
|
//g.drawString(t[0],120,110); // day
|
||||||
|
g.setFont("6x8",3);
|
||||||
|
g.drawString(t[1]+" "+t[2],120,135); // date
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.drawString(t[3],120,160); // year
|
||||||
|
g.setFont("6x8",3);
|
||||||
|
g.drawString(t[4],120,185); // time
|
||||||
|
// timezone
|
||||||
|
var tz = (new Date()).getTimezoneOffset()/60;
|
||||||
|
if (tz==0) tz="UTC";
|
||||||
|
else if (tz>0) tz="UTC+"+tz;
|
||||||
|
else tz="UTC"+tz;
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.drawString(tz,120,210); // gmt
|
||||||
|
g.setFontAlign(0,0,3);
|
||||||
|
g.drawString("Set",230,120);
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
});
|
||||||
|
|
||||||
|
setInterval(function() {
|
||||||
|
g.drawImage(img,48,48,{scale:1.5,rotate:Math.sin(getTime()*2)/2});
|
||||||
|
},100);
|
||||||
|
setWatch(function() {
|
||||||
|
setTime(fix.time.getTime()/1000);
|
||||||
|
}, BTN2, {repeat:true});
|
||||||
|
|
||||||
|
Bangle.setGPSPower(1)
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name":"GPS Time",
|
||||||
|
"icon":"*gpstime",
|
||||||
|
"src":"-gpstime"
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
!function(e,t){"function"==typeof define&&define.amd?define(["b"],function(r){return e.returnExportsGlobal=t()}):"object"==typeof module&&module.exports?module.exports=t(require("b")):e.OpenLocationCode=t()}(this,function(){var e={};e.CODE_PRECISION_NORMAL=10,e.CODE_PRECISION_EXTRA=11;var t="23456789CFGHJMPQRVWX",r=t.length,n=[20,1,.05,.0025,125e-6],o=(e.getAlphabet=function(){return t},e.isValid=function(e){if(!e||"string"!=typeof e)return!1;if(-1==e.indexOf("+"))return!1;if(e.indexOf("+")!=e.lastIndexOf("+"))return!1;if(1==e.length)return!1;if(e.indexOf("+")>8||e.indexOf("+")%2==1)return!1;if(e.indexOf("0")>-1){if(0==e.indexOf("0"))return!1;var r=e.match(new RegExp("(0+)","g"));if(r.length>1||r[0].length%2==1||r[0].length>6)return!1;if("+"!=e.charAt(e.length-1))return!1}if(e.length-e.indexOf("+")-1==1)return!1;for(var n=0,o=(e=e.replace(new RegExp("\\++"),"").replace(new RegExp("0+"),"")).length;n<o;n++){var i=e.charAt(n).toUpperCase();if("+"!=i&&-1==t.indexOf(i))return!1}return!0}),i=e.isShort=function(e){return!!o(e)&&(e.indexOf("+")>=0&&e.indexOf("+")<8)},a=e.isFull=function(e){return!!o(e)&&(!i(e)&&(!(t.indexOf(e.charAt(0).toUpperCase())*r>=180)&&!(e.length>1&&t.indexOf(e.charAt(1).toUpperCase())*r>=360)))},u=e.encode=function(t,r,n){if(t=Number(t),r=Number(r),n=void 0===n?e.CODE_PRECISION_NORMAL:Number(n),isNaN(t)||isNaN(r)||isNaN(n))throw"ValueError: Parameters are not numbers";if(n<2||n<10&&n%2==1)throw"IllegalArgumentException: Invalid Open Location Code length";t=l(t),r=h(r),90==t&&(t-=d(n));var o=s(t,r,Math.min(n,10));return n>10&&(o+=c(t,r,n-10)),o},f=e.decode=function(e){if(!a(e))throw"IllegalArgumentException: Passed Open Location Code is not a valid full code: "+e;e=(e=(e=e.replace("+","")).replace(new RegExp("0+"),"")).toUpperCase();var t=g(e.substring(0,10));if(e.length<=10)return t;var r=C(e.substring(10));return x(t.latitudeLo+r.latitudeLo,t.longitudeLo+r.longitudeLo,t.latitudeLo+r.latitudeHi,t.longitudeLo+r.longitudeHi,t.codeLength+r.codeLength)},l=(e.recoverNearest=function(e,t,r){if(!i(e)){if(a(e))return e;throw"ValueError: Passed short code is not valid: "+e}if(t=Number(t),r=Number(r),isNaN(t)||isNaN(r))throw"ValueError: Reference position are not numbers";t=l(t),r=h(r);var n=8-(e=e.toUpperCase()).indexOf("+"),o=Math.pow(20,2-n/2),d=o/2,s=f(u(t,r).substr(0,n)+e);return t+d<s.latitudeCenter&&s.latitudeCenter-o>=-90?s.latitudeCenter-=o:t-d>s.latitudeCenter&&s.latitudeCenter+o<=90&&(s.latitudeCenter+=o),r+d<s.longitudeCenter?s.longitudeCenter-=o:r-d>s.longitudeCenter&&(s.longitudeCenter+=o),u(s.latitudeCenter,s.longitudeCenter,s.codeLength)},e.shorten=function(e,t,r){if(!a(e))throw"ValueError: Passed code is not valid and full: "+e;if(-1!=e.indexOf("0"))throw"ValueError: Cannot shorten padded codes: "+e;var e=e.toUpperCase(),o=f(e);if(o.codeLength<6)throw"ValueError: Code length must be at least 6";if(t=Number(t),r=Number(r),isNaN(t)||isNaN(r))throw"ValueError: Reference position are not numbers";t=l(t),r=h(r);for(var i=Math.max(Math.abs(o.latitudeCenter-t),Math.abs(o.longitudeCenter-r)),u=n.length-2;u>=1;u--)if(i<.3*n[u])return e.substring(2*(u+1));return e},function(e){return Math.min(90,Math.max(-90,e))}),d=function(e){return e<=10?Math.pow(20,Math.floor(e/-2+2)):Math.pow(20,-3)/Math.pow(5,e-10)},h=function(e){for(;e<-180;)e+=360;for(;e>=180;)e-=360;return e},s=function(e,r,o){for(var i="",a=e+90,u=r+180,f=0;f<o;){var l=n[Math.floor(f/2)],d=Math.floor(a/l);a-=d*l,i+=t.charAt(d),f+=1,u-=(d=Math.floor(u/l))*l,i+=t.charAt(d),8==(f+=1)&&f<o&&(i+="+")}return i.length<8&&(i+=Array(8-i.length+1).join("0")),8==i.length&&(i+="+"),i},c=function(e,r,n){var o="",i=125e-6,a=125e-6;e+=90,r+=180;for(var u=(e%=1)%i,f=(r%=1)%a,l=0;l<n;l++){var d=Math.floor(u/(i/5)),h=Math.floor(f/(a/4));u-=d*(i/=5),f-=h*(a/=4),o+=t.charAt(4*d+h)}return o},g=function(e){var t=p(e,0),r=p(e,1);return new x(t[0]-90,r[0]-180,t[1]-90,r[1]-180,e.length)},p=function(e,r){for(var o=0,i=0;2*o+r<e.length;)i+=t.indexOf(e.charAt(2*o+r))*n[o],o+=1;return[i,i+n[o-1]]},C=function(e){for(var r=0,n=0,o=125e-6,i=125e-6,a=0;a<e.length;){var u=t.indexOf(e.charAt(a));r+=Math.floor(u/4)*(o/=5),n+=u%4*(i/=4),a+=1}return x(r,n,r+o,n+i,e.length)},x=e.CodeArea=function(t,r,n,o,i){return new e.CodeArea.fn.init(t,r,n,o,i)};return x.fn=x.prototype={init:function(e,t,r,n,o){this.latitudeLo=e,this.longitudeLo=t,this.latitudeHi=r,this.longitudeHi=n,this.codeLength=o,this.latitudeCenter=Math.min(e+(r-e)/2,90),this.longitudeCenter=Math.min(t+(n-t)/2,180)}},x.fn.init.prototype=x.fn,e});
|
||||||
|
|
||||||
|
Bangle.setGPSPower(1);
|
||||||
|
var fix;
|
||||||
|
Bangle.removeAllListeners();
|
||||||
|
Bangle.on('GPS',function(f) {
|
||||||
|
fix=f;
|
||||||
|
g.clear();
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
if (!f.fix) {
|
||||||
|
g.setFont("6x8",3);
|
||||||
|
g.drawString("Waiting for",120,70);
|
||||||
|
g.drawString("GPS Fix",120,110);
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.drawString(f.satellites+" satellites",120,170);
|
||||||
|
} else {
|
||||||
|
g.setFont("6x8",5);
|
||||||
|
var code = OpenLocationCode.encode(fix.lat,fix.lon);
|
||||||
|
var mid = code.length/2;
|
||||||
|
g.drawString(code.substr(0,mid),120,100);
|
||||||
|
g.drawString(code.substr(mid),120,140);
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"name":"Open Location",
|
||||||
|
"src":"-openloc"
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("lkkggLIgMRAAIfPCYYACiAUTFxoUCiUzAAUhCxYUCiYUDAAMyIhQUC+czkUTmUiCwgqIHwQZCmIDBkczAgIsGBgIUBCIQVDJAQsGFQILBEYIRC+IrCmJDCFggVBFIQVCiSBCn8hJgIsFKoQkCSgYJFLIoHDABROBCoZAEABbLCIAjTEABA6CCoS9BRwYAHpvRUIRCBU4bRCCg/doJyCiBWBPwoUIAgPzCoZVKjvd6JuDCogSGilEind6huEEwIVBn4VG7oABCggVFQIItEHoIABYopSCCpZUDCoaUBCoUikRWECo0SkTGCK5bcHIIjuLCpLFKAAjbQAAjbCgB0BLgJEKBoMSFYQVCmSaDxAAEA4MvmaCCgEAgIbBLIYVFBASuDCoQHBAwIVKiU/AgIVBIQIAECpAWBKwQVNBYoUCIQQAPCoYsGABJADACgA="))
|
|
@ -0,0 +1,24 @@
|
||||||
|
Bangle.setGPSPower(1);
|
||||||
|
Bangle.setLCDMode("doublebuffered");
|
||||||
|
var lastFix = {fix:0,satellites:0};
|
||||||
|
function onGPS(fix) {
|
||||||
|
lastFix = fix;
|
||||||
|
g.clear();
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
g.setFont("6x8");
|
||||||
|
g.drawString(fix.satellites+" satellites",120,6);
|
||||||
|
if (fix.fix) {
|
||||||
|
var txt = (fix.speed<20) ? fix.speed.toFixed(1) : Math.round(fix.speed);
|
||||||
|
var s = 80;
|
||||||
|
g.setFontVector(s);
|
||||||
|
g.drawString(txt,120,80);
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.drawString("km/h",120,80+16+s/2);
|
||||||
|
} else {
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.drawString("Waiting for GPS",120,80);
|
||||||
|
}
|
||||||
|
g.flip();
|
||||||
|
}
|
||||||
|
onGPS(lastFix);
|
||||||
|
Bangle.on('GPS', onGPS);
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name":"Speedo",
|
||||||
|
"icon":"*speedo",
|
||||||
|
"src":"-speedo"
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwghC/AF8OoMRC6nu8kRiAuT93uGCgWBGCguCGCgsBoMUGCQuBFYMRDAIwQFQUhDAIFCFx/hiUyC4NOGAKMP8MRmYwBjwwBCxkEFAIXBiYwBC4PuC5hxCC4IwCDwPgC5gpBpxxBiMSL4QWMgQpBIIKnEFxsikcxOISODCxkDmUiLIQADFxsjUIQWELp0iLwYuQgMzkUiFydBkcyFycOoMSXoIuST4YuTB4NBZwIuSABAuPAA5dQdSQuBoIXBLwouPiUxGAguOC4imDRh3hC4wuMgBABC44WMgBxBI4wuNgBxCC4MhAoQWNC4IwBU4guOgEBFQVBiguQGAi7PGBCMPGBAuRGAoWSGAYuTAH4AcA="))
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
g.clear();
|
||||||
|
var old = {x:0,y:0};
|
||||||
|
Bangle.on('accel',function(v) {
|
||||||
|
var d = Math.sqrt(v.x*v.x+v.y*v.y);
|
||||||
|
var ang = Math.atan2(d,Math.abs(v.z))*180/Math.PI;
|
||||||
|
|
||||||
|
g.setColor(1,1,1);
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.setFontAlign(0,-1);
|
||||||
|
g.clearRect(60,0,180,16);
|
||||||
|
g.drawString(ang.toFixed(1),120,0);
|
||||||
|
var n = {
|
||||||
|
x:E.clip(120+v.x*256,4,236),
|
||||||
|
y:E.clip(120+v.y*256,4,236)};
|
||||||
|
g.clearRect(old.x-3,old.y-3,old.x+6,old.y+6);
|
||||||
|
g.setColor(1,1,1);
|
||||||
|
g.fillRect(n.x-3,n.y-3,n.x+6,n.y+6);
|
||||||
|
g.setColor(1,0,0);
|
||||||
|
g.drawCircle(120,120,20);
|
||||||
|
g.drawCircle(120,120,60);
|
||||||
|
g.drawCircle(120,120,100);
|
||||||
|
old = n;
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name":"Spirit Level",
|
||||||
|
"icon":"*slevel",
|
||||||
|
"src":"-slevel"
|
||||||
|
}
|
Loading…
Reference in New Issue