Finally fixing Bangle.js compass `heading`. Firmware 2v15.68 fixes it, but the bootloader now adds a patch on earlier firmwares. All apps using compass now updated to remove their individual fixes.

pull/2214/head
Gordon Williams 2022-11-01 10:16:28 +00:00
parent 72e1086541
commit dd9dcc1bb5
37 changed files with 73 additions and 73 deletions

2
apps/alpinenav/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: New App!
0.02: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -224,7 +224,7 @@ Bangle.on('mag', function (m) {
if (isNaN(m.heading)) if (isNaN(m.heading))
compass_heading = "---"; compass_heading = "---";
else else
compass_heading = 360 - Math.round(m.heading); compass_heading = Math.round(m.heading);
current_colour = g.getColor(); current_colour = g.getColor();
g.reset(); g.reset();
g.setColor(background_colour); g.setColor(background_colour);

View File

@ -1,7 +1,7 @@
{ {
"id": "alpinenav", "id": "alpinenav",
"name": "Alpine Nav", "name": "Alpine Nav",
"version": "0.01", "version": "0.02",
"description": "App that performs GPS monitoring to track and display position relative to a given origin in realtime", "description": "App that performs GPS monitoring to track and display position relative to a given origin in realtime",
"icon": "app-icon.png", "icon": "app-icon.png",
"tags": "outdoors,gps", "tags": "outdoors,gps",

View File

@ -2,3 +2,4 @@
0.02: Fixed Whirlpool galaxy RA/DA, larger compass display, fixed moonphase overlapping battery widget 0.02: Fixed Whirlpool galaxy RA/DA, larger compass display, fixed moonphase overlapping battery widget
0.03: Update to use Bangle.setUI instead of setWatch 0.03: Update to use Bangle.setUI instead of setWatch
0.04: Tell clock widgets to hide. 0.04: Tell clock widgets to hide.
0.05: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -834,7 +834,7 @@ Bangle.on('mag', function (m) {
if (isNaN(m.heading)) if (isNaN(m.heading))
compass_heading = "---"; compass_heading = "---";
else else
compass_heading = 360 - Math.round(m.heading); compass_heading = Math.round(m.heading);
// g.setColor("#000000"); // g.setColor("#000000");
// g.fillRect(160, 10, 160, 20); // g.fillRect(160, 10, 160, 20);
g.setColor(display_colour); g.setColor(display_colour);

View File

@ -1,7 +1,7 @@
{ {
"id": "astral", "id": "astral",
"name": "Astral Clock", "name": "Astral Clock",
"version": "0.04", "version": "0.05",
"description": "Clock that calculates and displays Alt Az positions of all planets, Sun as well as several other astronomy targets (customizable) and current Moon phase. Coordinates are calculated by GPS & time and onscreen compass assists orienting. See Readme before using.", "description": "Clock that calculates and displays Alt Az positions of all planets, Sun as well as several other astronomy targets (customizable) and current Moon phase. Coordinates are calculated by GPS & time and onscreen compass assists orienting. See Readme before using.",
"icon": "app-icon.png", "icon": "app-icon.png",
"type": "clock", "type": "clock",

3
apps/beer/ChangeLog Normal file
View File

@ -0,0 +1,3 @@
0.01: New App!
0.02: Added adjustment for Bangle.js magnetometer heading fix
Bangle.js 2 compatibility

View File

@ -1 +1 @@
require("heatshrink").decompress(atob("mEwghC/AB0O/4AG8AXNgYXHmAXl94XH+AXNn4XH/wXW+YX/C6oWHAAIXN7sz9vdAAoXN9sznvuAAXf/vuC53jC4Xd7wXQ93jn3u9vv9vt7wXT/4tBAgIXQ7wvCC4PgC5sO6czIQJfBC6PumaPDC6wwCC50NYAJcBVgIDBCxrAFbgYXP7yoDF6TADL4YXPVAIXCRyAXC7wXW9zwBC6cNC9zABC4gWQC653CR4fQC6x3TF6gXXI4M9d6wAEC9EN73dAAZfQgczAAkwC/4XXAH4")) require("heatshrink").decompress(atob("mEw4cA///wH9/++1P+u3//3/qv/gv+KHkJkmABxcBBwNJkmQCJYOByQCCCBUCCItJkARQkgQHggLBku25IRDJQ4LCtu27Mt2RKJCInbAQIRLpYROglt24OB6wSC7dwLQ4LB9u2EgfbsARJ8u2mwRO+u3CNJtHCJFpCINALJoRCpCiGBoMSdQcpegIRGyaPB+QRDkARIyQRBc4YRKyet23iCJxHB6QRBzOJCJ+dCJY1CpfMGphrCp2YNZlL54CBEZgLBAQoRBiTFFCNMvmQRPndiEcJHEyQQECJMpAYIRQyARQwAROI4IAGB4wCBNAoRmhIRHCA4A/AAo"))

View File

@ -127,6 +127,8 @@
var img_nofix = require("heatshrink").decompress(atob("mUyxH+ACYhJDygtYGsqLVF8u02gziGBoyhQ5gwDGRozRGCQydGCgybGCwyZC5gAaGPQwnGRAwpGQ4xwGFYyFDKsrlYxYDCsBmUyg4yXLyUsFwMyq1WAgUsNCRjUmVXroAEq8yMbcllkskwCEkplDmQwDq0sC54xEHQ9RqQAGqIwCFgOBAASYBSgMBltRAA0sgJsOGJeBxAAGwMrgIXIloxOJYNSvl8CwIDCqMBlYxNC4wxQDIOCwVYDIIDBGJ9YwV8rADBwRJCSqAVCAYaVMC4oxCPYYxQSo4xMSpIxPY4T5HY54XIMbIxKgwXKfKjhEllWGJNWlgXJGLNXruCGI+CrtXGKP+GJB9HMZ6VO/wxJcI8lfJclfKAxKfJEAGJIXLGKSvBWYQZCMZbfEqTHBGJYyFfIo1DGJ4tDGJQwCGJB9IMZyVNGIYyEfJQxPfJgwEMgoZJgAxMltRAA0tGJQyEksslkmAQklGINXxDTBFwIDCq8rC4YACC4gwJMowAJldWAAwwBABowIGJ4AYGJIymGBQylGBgyjGBwyhGCAzeF6YycGCwzYF7IzVF7o1PDqYA==")); var img_nofix = require("heatshrink").decompress(atob("mUyxH+ACYhJDygtYGsqLVF8u02gziGBoyhQ5gwDGRozRGCQydGCgybGCwyZC5gAaGPQwnGRAwpGQ4xwGFYyFDKsrlYxYDCsBmUyg4yXLyUsFwMyq1WAgUsNCRjUmVXroAEq8yMbcllkskwCEkplDmQwDq0sC54xEHQ9RqQAGqIwCFgOBAASYBSgMBltRAA0sgJsOGJeBxAAGwMrgIXIloxOJYNSvl8CwIDCqMBlYxNC4wxQDIOCwVYDIIDBGJ9YwV8rADBwRJCSqAVCAYaVMC4oxCPYYxQSo4xMSpIxPY4T5HY54XIMbIxKgwXKfKjhEllWGJNWlgXJGLNXruCGI+CrtXGKP+GJB9HMZ6VO/wxJcI8lfJclfKAxKfJEAGJIXLGKSvBWYQZCMZbfEqTHBGJYyFfIo1DGJ4tDGJQwCGJB9IMZyVNGIYyEfJQxPfJgwEMgoZJgAxMltRAA0tGJQyEksslkmAQklGINXxDTBFwIDCq8rC4YACC4gwJMowAJldWAAwwBABowIGJ4AYGJIymGBQylGBgyjGBwyhGCAzeF6YycGCwzYF7IzVF7o1PDqYA=="));
var img_fix = require("heatshrink").decompress(atob("mUyxH+ACYhJDygtYGsqLVF94zaDYkq6wAOlQyYJo2A63VAAIoC2m0GI16My5/H5/V64ABGQIwBGQ+rTKwWHkhiBGIYwDGQ3VZioVIqoiBGAJhEGRFPGSYTIYwQxCGA4yFqodJGKeqSgQwJGQmkGKQSJfAYwLGQfPDxQwRgHVfAi/EAA4xLGQwRLYwb5BABoxQCBcA43G5wABAgIAMEBgxQ0QxB54xB5gAG4xgBBYOiGJ4PMGInPGIhcCGIt4EJoxPvHM5oxBGAnO6xrCGoXMqgxdpwxD5qQFL4QADlQxdgAhBGILIDMYoADEBwwPgCHBfQzHDAAb4NACTIIAA74OACLIIMo7GOACQoBZAoHBHQPNA4QwggGiZBA5B54HBY0DIKMYtUGMMqFYLIGY4jGhZAr6FAAYwiZAgxIY0TIFfQgADvAfR/zISGJTGR/wxRkj6CGJBiSGKL6DGP4xOGSKVDGAwxRGAQxU5oxcGR75DGJEkGCYxPlXM5vPGA/MlQxUGR1OGIL4I5lOGCgyOqgxBShHMqgwVGJt4GJd4GKwyMvHG5vGABAxMGBQyM1mtABWsGC4yLGBYABGDAyKGKwwQGZKVUF6b/OABowWGbAvZGaovdGp4dTA")); var img_fix = require("heatshrink").decompress(atob("mUyxH+ACYhJDygtYGsqLVF94zaDYkq6wAOlQyYJo2A63VAAIoC2m0GI16My5/H5/V64ABGQIwBGQ+rTKwWHkhiBGIYwDGQ3VZioVIqoiBGAJhEGRFPGSYTIYwQxCGA4yFqodJGKeqSgQwJGQmkGKQSJfAYwLGQfPDxQwRgHVfAi/EAA4xLGQwRLYwb5BABoxQCBcA43G5wABAgIAMEBgxQ0QxB54xB5gAG4xgBBYOiGJ4PMGInPGIhcCGIt4EJoxPvHM5oxBGAnO6xrCGoXMqgxdpwxD5qQFL4QADlQxdgAhBGILIDMYoADEBwwPgCHBfQzHDAAb4NACTIIAA74OACLIIMo7GOACQoBZAoHBHQPNA4QwggGiZBA5B54HBY0DIKMYtUGMMqFYLIGY4jGhZAr6FAAYwiZAgxIY0TIFfQgADvAfR/zISGJTGR/wxRkj6CGJBiSGKL6DGP4xOGSKVDGAwxRGAQxU5oxcGR75DGJEkGCYxPlXM5vPGA/MlQxUGR1OGIL4I5lOGCgyOqgxBShHMqgwVGJt4GJd4GKwyMvHG5vGABAxMGBQyM1mtABWsGC4yLGBYABGDAyKGKwwQGZKVUF6b/OABowWGbAvZGaovdGp4dTA"));
var W = g.getWidth(), H = g.getHeight();
// https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js // https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js
function project(latlong) { function project(latlong) {
var d = Math.PI / 180, var d = Math.PI / 180,
@ -170,32 +172,30 @@ Bangle.on('GPS', function(f) {
Bangle.on('mag', function(m) { Bangle.on('mag', function(m) {
if (!Bangle.isLCDOn()) return; if (!Bangle.isLCDOn()) return;
var headingrad = m.heading*Math.PI/180; // in radians var headingrad = (360-m.heading)*Math.PI/180; // in radians
if (!isFinite(headingrad)) headingrad=0; if (!isFinite(headingrad)) headingrad=0;
if (nearest) if (nearest)
g.drawImage(img_fix,120,120,{ g.drawImage(img_fix,W/2,H/2,{
rotate: (Math.PI/2)+headingrad-nearestangle, rotate: (Math.PI/2)+headingrad-nearestangle,
scale:3, scale:3,
}); });
else else
g.drawImage(img_nofix,120,120,{ g.drawImage(img_nofix,W/2,H/2,{
rotate: headingrad, rotate: headingrad,
scale:2, scale:2,
}); });
g.clearRect(60,0,180,24); g.clearRect(0,0,W,24).setFontAlign(0,0).setFont("6x8");
g.setFontAlign(0,0);
g.setFont("6x8");
if (fix.fix) { if (fix.fix) {
g.drawString(nearest ? nearest.name : "---",120,4); g.drawString(nearest ? nearest.name : "---",W/2,4);
g.setFont("6x8",2); g.setFont("6x8",2);
g.drawString(nearest ? Math.round(nearestdist)+"m" : "---",120,16); g.drawString(nearest ? Math.round(nearestdist)+"m" : "---",W/2,16);
} else { } else {
g.drawString(fix.satellites+" satellites",120,4); g.drawString(fix.satellites+" satellites",W/2,4);
} }
}); });
Bangle.setCompassPower(1); Bangle.setCompassPower(1);
Bangle.setGPSPower(1); Bangle.setGPSPower(1);
g.clear();`; g.setColor("#fff").setBgColor("#000").clear();`;
sendCustomizedApp({ sendCustomizedApp({
storage:[ storage:[

View File

@ -1,11 +1,11 @@
{ {
"id": "beer", "id": "beer",
"name": "Beer Compass", "name": "Beer Compass",
"version": "0.01", "version": "0.02",
"description": "Uploads all the pubs in an area onto your watch, so it can always point you at the nearest one", "description": "Uploads all the pubs in an area onto your watch, so it can always point you at the nearest one",
"icon": "app.png", "icon": "app.png",
"tags": "", "tags": "",
"supports": ["BANGLEJS"], "supports": ["BANGLEJS","BANGLEJS2"],
"custom": "custom.html", "custom": "custom.html",
"storage": [ "storage": [
{"name":"beer.app.js"}, {"name":"beer.app.js"},

View File

@ -55,3 +55,5 @@
0.49: Store first found clock as a setting to speed up further boots 0.49: Store first found clock as a setting to speed up further boots
0.50: Allow setting of screen rotation 0.50: Allow setting of screen rotation
Remove support for 2v11 and earlier firmware Remove support for 2v11 and earlier firmware
0.51: Remove patches for 2v10 firmware (BEEPSET and setUI)
Add patch to ensure that compass heading is corrected

View File

@ -76,28 +76,12 @@ if (s.brightness && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightne
if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${E.toJS(s.passkey.toString())}, mitm:1, display:1});\n`; if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${E.toJS(s.passkey.toString())}, mitm:1, display:1});\n`;
if (s.whitelist) boot+=`NRF.on('connect', function(addr) { if (!(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`; if (s.whitelist) boot+=`NRF.on('connect', function(addr) { if (!(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`;
if (s.rotate) boot+=`g.setRotation(${s.rotate&3},${s.rotate>>2});\n` // screen rotation if (s.rotate) boot+=`g.setRotation(${s.rotate&3},${s.rotate>>2});\n` // screen rotation
// Pre-2v10 firmwares without a theme/setUI // ================================================== FIXING OLDER FIRMWARES
delete g.theme; // deleting stops us getting confused by our own decl. builtins can't be deleted // 2v15.68 and before had compass heading inverted.
if (!g.theme) { if (process.version.replace("v","")<215.68)
boot += `g.theme={fg:-1,bg:0,fg2:-1,bg2:7,fgH:-1,bgH:0x02F7,dark:true};\n`; boot += `Bangle.on('mag',e=>{if(!isNaN(e.heading)) e.heading=360-e.heading;});`;
}
try {
Bangle.setUI({}); // In 2v12.xx we added the option for mode to be an object - for 2v12 and earlier, add a fix if it fails with an object supplied
} catch(e) {
boot += `Bangle._setUI = Bangle.setUI;
Bangle.setUI=function(mode, cb) {
if (Bangle.uiRemove) {
Bangle.uiRemove();
delete Bangle.uiRemove;
}
if ("object"==typeof mode) {
// TODO: handle mode.back?
mode = mode.mode;
}
Bangle._setUI(mode, cb);
};\n`;
}
// ================================================== BOOT.JS
// Append *.boot.js files // Append *.boot.js files
// These could change bleServices/bleServiceOptions if needed // These could change bleServices/bleServiceOptions if needed
var bootFiles = require('Storage').list(/\.boot\.js$/).sort((a,b)=>{ var bootFiles = require('Storage').list(/\.boot\.js$/).sort((a,b)=>{

View File

@ -1,7 +1,7 @@
{ {
"id": "boot", "id": "boot",
"name": "Bootloader", "name": "Bootloader",
"version": "0.50", "version": "0.51",
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
"icon": "bootloader.png", "icon": "bootloader.png",
"type": "bootloader", "type": "bootloader",

View File

@ -5,3 +5,4 @@
0.05: Fix bearing not clearing correctly (visible in single or double digit bearings) 0.05: Fix bearing not clearing correctly (visible in single or double digit bearings)
0.06: Add button for force compass calibration 0.06: Add button for force compass calibration
0.07: Use 360-heading to output the correct heading value (fix #1866) 0.07: Use 360-heading to output the correct heading value (fix #1866)
0.08: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -20,7 +20,7 @@ ag.setColor(1).fillCircle(AGM,AGM,AGM-1,AGM-1);
ag.setColor(0).fillCircle(AGM,AGM,AGM-11,AGM-11); ag.setColor(0).fillCircle(AGM,AGM,AGM-11,AGM-11);
function arrow(r,c) { function arrow(r,c) {
r=r*Math.PI/180; r=(360-r)*Math.PI/180;
var p = Math.PI/2; var p = Math.PI/2;
ag.setColor(c).fillPoly([ ag.setColor(c).fillPoly([
AGM+AGH*Math.sin(r), AGM-AGH*Math.cos(r), AGM+AGH*Math.sin(r), AGM-AGH*Math.cos(r),
@ -34,7 +34,7 @@ var oldHeading = 0;
Bangle.on('mag', function(m) { Bangle.on('mag', function(m) {
if (!Bangle.isLCDOn()) return; if (!Bangle.isLCDOn()) return;
g.reset(); g.reset();
if (isNaN(m.heading)) { if (isNaN(m.heading)) {
if (!wasUncalibrated) { if (!wasUncalibrated) {
g.clearRect(0,24,W,48); g.clearRect(0,24,W,48);
g.setFontAlign(0,-1).setFont("6x8"); g.setFontAlign(0,-1).setFont("6x8");
@ -49,7 +49,7 @@ Bangle.on('mag', function(m) {
g.setFontAlign(0,0).setFont("6x8",3); g.setFontAlign(0,0).setFont("6x8",3);
var y = 36; var y = 36;
g.clearRect(M-40,24,M+40,48); g.clearRect(M-40,24,M+40,48);
g.drawString(Math.round(360-m.heading),M,y,true); g.drawString(Math.round(m.heading),M,y,true);
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "compass", "id": "compass",
"name": "Compass", "name": "Compass",
"version": "0.07", "version": "0.08",
"description": "Simple compass that points North", "description": "Simple compass that points North",
"icon": "compass.png", "icon": "compass.png",
"screenshots": [{"url":"screenshot_compass.png"}], "screenshots": [{"url":"screenshot_compass.png"}],

View File

@ -1 +1,2 @@
0.01: Create dotmatrix clock app 0.01: Create dotmatrix clock app
0.02: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -186,7 +186,7 @@ function drawCompass(lastHeading) {
'NW' 'NW'
]; ];
const cps = Bangle.getCompass(); const cps = Bangle.getCompass();
let angle = cps.heading; let angle = 360-cps.heading;
let heading = angle? let heading = angle?
directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]: directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]:
"-- "; "-- ";
@ -351,4 +351,4 @@ Bangle.on('faceUp', (up) => {
setSensors(1); setSensors(1);
resetDisplayTimeout(); resetDisplayTimeout();
} }
}); });

View File

@ -1,7 +1,7 @@
{ {
"id": "dotmatrixclock", "id": "dotmatrixclock",
"name": "Dotmatrix Clock", "name": "Dotmatrix Clock",
"version": "0.01", "version": "0.02",
"description": "A clear white-on-blue dotmatrix simulated clock", "description": "A clear white-on-blue dotmatrix simulated clock",
"icon": "dotmatrixclock.png", "icon": "dotmatrixclock.png",
"type": "clock", "type": "clock",

View File

@ -3,3 +3,4 @@
0.03: Fix listener for accel always active 0.03: Fix listener for accel always active
Use custom UI with swipes instead of leftright Use custom UI with swipes instead of leftright
0.04: Fix compass heading 0.04: Fix compass heading
0.05: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -1,7 +1,7 @@
{ {
"id": "gpstrek", "id": "gpstrek",
"name": "GPS Trekking", "name": "GPS Trekking",
"version": "0.04", "version": "0.05",
"description": "Helper for tracking the status/progress during hiking. Do NOT depend on this for navigation!", "description": "Helper for tracking the status/progress during hiking. Do NOT depend on this for navigation!",
"icon": "icon.png", "icon": "icon.png",
"screenshots": [{"url":"screen1.png"},{"url":"screen2.png"},{"url":"screen3.png"},{"url":"screen4.png"}], "screenshots": [{"url":"screen1.png"},{"url":"screen2.png"},{"url":"screen3.png"},{"url":"screen4.png"}],

View File

@ -24,13 +24,13 @@ function onGPS(fix) {
} }
function onMag(e) { function onMag(e) {
if (!state.compassHeading) state.compassHeading = e.heading; if (!state.compassHeading) state.compassHeading = 360-e.heading;
//if (a+180)mod 360 == b then //if (a+180)mod 360 == b then
//return (a+b)/2 mod 360 and ((a+b)/2 mod 360) + 180 (they are both the solution, so you may choose one depending if you prefer counterclockwise or clockwise direction) //return (a+b)/2 mod 360 and ((a+b)/2 mod 360) + 180 (they are both the solution, so you may choose one depending if you prefer counterclockwise or clockwise direction)
//else //else
//return arctan( (sin(a)+sin(b)) / (cos(a)+cos(b) ) //return arctan( (sin(a)+sin(b)) / (cos(a)+cos(b) )
/* /*
let average; let average;
let a = radians(compassHeading); let a = radians(compassHeading);
@ -112,7 +112,7 @@ function stop(bg){
saveState(); saveState();
Bangle.drawWidgets(); Bangle.drawWidgets();
} }
function initState(){ function initState(){
//cleanup volatile state here //cleanup volatile state here
state.currentPos={}; state.currentPos={};

View File

@ -1,3 +1,4 @@
0.01: New App! 0.01: New App!
0.02: Change img when no fix 0.02: Change img when no fix
0.03: Add HTML class for Spectre.CSS 0.03: Add HTML class for Spectre.CSS
0.04: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -187,7 +187,7 @@ Bangle.on('GPS', function(f) {
Bangle.on('mag', function(m) { Bangle.on('mag', function(m) {
if (!Bangle.isLCDOn()) return; if (!Bangle.isLCDOn()) return;
var headingrad = m.heading*Math.PI/180; // in radians var headingrad = (360-m.heading)*Math.PI/180; // in radians
if (!isFinite(headingrad)) headingrad=0; if (!isFinite(headingrad)) headingrad=0;
if (nearest) if (nearest)
g.drawImage(img_fix,120,120,{ g.drawImage(img_fix,120,120,{

View File

@ -1,7 +1,7 @@
{ {
"id": "osmpoi", "id": "osmpoi",
"name": "POI Compass", "name": "POI Compass",
"version": "0.03", "version": "0.04",
"description": "Uploads all the points of interest in an area onto your watch, same as Beer Compass with more p.o.i.", "description": "Uploads all the points of interest in an area onto your watch, same as Beer Compass with more p.o.i.",
"icon": "app.png", "icon": "app.png",
"tags": "tool,outdoors,gps", "tags": "tool,outdoors,gps",

View File

@ -1,3 +1,4 @@
0.01: Initial check-in. 0.01: Initial check-in.
0.02: Make internal menu time out + small fixes. 0.02: Make internal menu time out + small fixes.
0.03: Autolight feature. 0.03: Autolight feature.
0.04: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -70,7 +70,7 @@ class Options {
delay delay
); );
} }
bless(k) { bless(k) {
Object.defineProperty(this, k, { Object.defineProperty(this, k, {
get: () => this.backing[k], get: () => this.backing[k],
@ -103,7 +103,7 @@ class Options {
if (this.bored) clearTimeout(this.bored); if (this.bored) clearTimeout(this.bored);
this.bored = setTimeout(_ => this.showMenu(), 15000); this.bored = setTimeout(_ => this.showMenu(), 15000);
} }
reset() { reset() {
this.backing = {__proto__: this.constructor.defaults}; this.backing = {__proto__: this.constructor.defaults};
this.writeBack(0); this.writeBack(0);
@ -145,7 +145,7 @@ class RomanOptions extends Options {
Defaults: _ => {this.reset(); this.interact();} Defaults: _ => {this.reset(); this.interact();}
}; };
} }
interact() {this.showMenu(this.menu);} interact() {this.showMenu(this.menu);}
} }
@ -337,7 +337,7 @@ const events = {
// colour: colour, dramatic?: bool, event?: any} // colour: colour, dramatic?: bool, event?: any}
fixed: [{time: Number.POSITIVE_INFINITY}], // indexed by ms absolute fixed: [{time: Number.POSITIVE_INFINITY}], // indexed by ms absolute
wall: [{time: Number.POSITIVE_INFINITY}], // indexed by nominal ms + TZ ms wall: [{time: Number.POSITIVE_INFINITY}], // indexed by nominal ms + TZ ms
clean: function(now, l) { clean: function(now, l) {
let o = now.getTimezoneOffset() * 60000; let o = now.getTimezoneOffset() * 60000;
let tf = now.getTime() + l, tw = tf - o; let tf = now.getTime() + l, tw = tf - o;
@ -345,7 +345,7 @@ const events = {
while (this.wall[0].time <= tw) this.wall.shift(); while (this.wall[0].time <= tw) this.wall.shift();
while (this.fixed[0].time <= tf) this.fixed.shift(); while (this.fixed[0].time <= tf) this.fixed.shift();
}, },
scan: function(now, from, to, f) { scan: function(now, from, to, f) {
result = Infinity; result = Infinity;
let o = now.getTimezoneOffset() * 60000; let o = now.getTimezoneOffset() * 60000;
@ -482,7 +482,7 @@ class Sidebar {
compassI, compassI,
this.x + 4 + imageWidth(compassI) / 2, this.x + 4 + imageWidth(compassI) / 2,
this.y + 4 + imageHeight(compassI) / 2, this.y + 4 + imageHeight(compassI) / 2,
a ? {rotate: c.heading / 180 * Math.PI} : undefined a ? {rotate: (360-c.heading) / 180 * Math.PI} : undefined
); );
this.y += 4 + imageHeight(compassI); this.y += 4 + imageHeight(compassI);
} }
@ -535,13 +535,13 @@ class Roman {
static pos(p, r) { static pos(p, r) {
let h = r * rectW / 2; let h = r * rectW / 2;
let v = r * rectH / 2; let v = r * rectH / 2;
p = (p + 1) % 12; p = (p + 1) % 12;
return p <= 2 ? [faceCX + h * (p - 1), faceCY - v] return p <= 2 ? [faceCX + h * (p - 1), faceCY - v]
: p < 6 ? [faceCX + h, faceCY + v / 2 * (p - 4)] : p < 6 ? [faceCX + h, faceCY + v / 2 * (p - 4)]
: p <= 8 ? [faceCX - h * (p - 7), faceCY + v] : p <= 8 ? [faceCX - h * (p - 7), faceCY + v]
: [faceCX - h, faceCY - v / 2 * (p - 10)]; : [faceCX - h, faceCY - v / 2 * (p - 10)];
} }
alert(e, date, now, past) { alert(e, date, now, past) {
const g = this.g; const g = this.g;
g.setColor(e.colour); g.setColor(e.colour);
@ -564,7 +564,7 @@ class Roman {
} }
return Infinity; return Infinity;
} }
render(d, rate) { render(d, rate) {
const g = this.g; const g = this.g;
const state = this.state || (g.clear(true), this.state = {}); const state = this.state || (g.clear(true), this.state = {});
@ -625,7 +625,7 @@ class Roman {
for (let h = keyHour; h < keyHour + 12; h++) { for (let h = keyHour; h < keyHour + 12; h++) {
g.drawString( g.drawString(
numeral(h % 24, options), numeral(h % 24, options),
faceX + layout[h % 12 * 2], faceX + layout[h % 12 * 2],
faceY + layout[h % 12 * 2 + 1] faceY + layout[h % 12 * 2 + 1]
); );
} }
@ -643,7 +643,7 @@ class Roman {
(e, t, p) => this.alert(e, t, d, p) (e, t, p) => this.alert(e, t, d, p)
); );
if (rate > requestedRate) rate = requestedRate; if (rate > requestedRate) rate = requestedRate;
// Hands // Hands
// Here we are using incremental hands for hours and minutes. // Here we are using incremental hands for hours and minutes.
// If we quantised, we could use hand-crafted bitmaps, though. // If we quantised, we could use hand-crafted bitmaps, though.
@ -668,7 +668,7 @@ class Clock {
this.rates = {}; this.rates = {};
this.options.on('done', () => this.start()); this.options.on('done', () => this.start());
this.listeners = { this.listeners = {
charging: _ => {face.doIcons('charging'); this.active();}, charging: _ => {face.doIcons('charging'); this.active();},
lock: _ => {face.doIcons('locked'); this.active();}, lock: _ => {face.doIcons('locked'); this.active();},
@ -723,7 +723,7 @@ class Clock {
this.face.reset(); // Cancel any ongoing background rendering this.face.reset(); // Cancel any ongoing background rendering
return this; return this;
} }
active() { active() {
const prev = this.rate; const prev = this.rate;
const now = Date.now(); const now = Date.now();

View File

@ -1,7 +1,7 @@
{ "id": "pooqroman", { "id": "pooqroman",
"name": "pooq Roman watch face", "name": "pooq Roman watch face",
"shortName":"pooq Roman", "shortName":"pooq Roman",
"version":"0.03", "version":"0.04",
"description": "A classic watch face with a certain dynamicity. Most amusing in 24h mode. Slide up to show more hands, down for less(!). By design does not support standard widgets, sorry!", "description": "A classic watch face with a certain dynamicity. Most amusing in 24h mode. Slide up to show more hands, down for less(!). By design does not support standard widgets, sorry!",
"icon": "app.png", "icon": "app.png",
"type": "clock", "type": "clock",

View File

@ -1,3 +1,4 @@
0.01: New App! 0.01: New App!
0.02: Change color from red->yellow to ease readability (fix #710) 0.02: Change color from red->yellow to ease readability (fix #710)
0.03: Color/positioning change to allow it to work with Bangle.js 1 (although not pretty) 0.03: Color/positioning change to allow it to work with Bangle.js 1 (although not pretty)
0.04: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -231,7 +231,7 @@ document.getElementById("upload").addEventListener("click", function() {
if (!Bangle.isLCDOn()) return; if (!Bangle.isLCDOn()) return;
arrow(oldHeading,g.theme.bg); arrow(oldHeading,g.theme.bg);
var heading = m.heading + nextAngle; var heading = (360-m.heading) + nextAngle;
arrow(heading,"#f00"); arrow(heading,"#f00");
oldHeading = heading; oldHeading = heading;
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "route", "id": "route",
"name": "Route Viewer", "name": "Route Viewer",
"version": "0.03", "version": "0.04",
"description": "Upload a KML file of a route, and have your watch display a map with how far around it you are", "description": "Upload a KML file of a route, and have your watch display a map with how far around it you are",
"icon": "app.png", "icon": "app.png",
"tags": "", "tags": "",

View File

@ -3,3 +3,4 @@
0.03: Silently use built in heading when no magnav calibration file is present 0.03: Silently use built in heading when no magnav calibration file is present
0.04: Move waypoints.json (and editor) to 'waypoints' app 0.04: Move waypoints.json (and editor) to 'waypoints' app
0.05: Fix not displaying of wpindex = 0 0.05: Fix not displaying of wpindex = 0
0.06: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -80,7 +80,7 @@ function tiltfixread(O,S){
var m = Bangle.getCompass(); var m = Bangle.getCompass();
if (O === undefined || S === undefined) { if (O === undefined || S === undefined) {
// no valid calibration from magnav, use built in // no valid calibration from magnav, use built in
return 360-m.heading; return m.heading;
} }
var g = Bangle.getAccel(); var g = Bangle.getAccel();
m.dx =(m.x-O.x)*S.x; m.dy=(m.y-O.y)*S.y; m.dz=(m.z-O.z)*S.z; m.dx =(m.x-O.x)*S.x; m.dy=(m.y-O.y)*S.y; m.dz=(m.z-O.z)*S.z;

View File

@ -1,7 +1,7 @@
{ {
"id": "waypointer", "id": "waypointer",
"name": "Way Pointer", "name": "Way Pointer",
"version": "0.05", "version": "0.06",
"description": "Navigate to a waypoint using the GPS for bearing and compass to point way, uses the same waypoint interface as GPS Navigation", "description": "Navigate to a waypoint using the GPS for bearing and compass to point way, uses the same waypoint interface as GPS Navigation",
"icon": "waypointer.png", "icon": "waypointer.png",
"tags": "tool,outdoors,gps", "tags": "tool,outdoors,gps",

View File

@ -1,3 +1,4 @@
... ...
0.02: First update with ChangeLog Added 0.02: First update with ChangeLog Added
0.03: Move waypoints.json (and editor) to 'waypoints' app 0.03: Move waypoints.json (and editor) to 'waypoints' app
0.04: Added adjustment for Bangle.js magnetometer heading fix

View File

@ -134,7 +134,7 @@ function read_heading() {
Bangle.setCompassPower(1); Bangle.setCompassPower(1);
var d = 0; var d = 0;
var m = Bangle.getCompass(); var m = Bangle.getCompass();
if (!isNaN(m.heading)) d = -m.heading; if (!isNaN(m.heading)) d = m.heading;
heading = d; heading = d;
} }

View File

@ -2,7 +2,7 @@
"id": "wpmoto", "id": "wpmoto",
"name": "Waypointer Moto", "name": "Waypointer Moto",
"shortName": "Waypointer Moto", "shortName": "Waypointer Moto",
"version": "0.03", "version": "0.04",
"description": "Waypoint-based motorcycle navigation aid", "description": "Waypoint-based motorcycle navigation aid",
"icon": "wpmoto.png", "icon": "wpmoto.png",
"tags": "tool,outdoors,gps", "tags": "tool,outdoors,gps",