mirror of https://github.com/espruino/BangleApps
parent
0677f027d0
commit
71964b041e
|
@ -4,4 +4,3 @@
|
||||||
0.04: Fix Font size
|
0.04: Fix Font size
|
||||||
0.05: Initial portable version
|
0.05: Initial portable version
|
||||||
0.06: Outsource tilt compensation to library
|
0.06: Outsource tilt compensation to library
|
||||||
0.07: Add tiltfix() for compensation on given sensor values
|
|
||||||
|
|
|
@ -22,10 +22,11 @@ exports.calibrate = () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.tiltfix = (m,g,O,S) => {
|
exports.tiltfixread = (O,S) => {
|
||||||
if (O & S) {
|
"ram"
|
||||||
|
var m = Bangle.getCompass();
|
||||||
|
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;
|
||||||
}
|
|
||||||
var d = Math.atan2(-m.dx,m.dy)*180/Math.PI;
|
var d = Math.atan2(-m.dx,m.dy)*180/Math.PI;
|
||||||
if (d<0) d+=360;
|
if (d<0) d+=360;
|
||||||
var phi = Math.atan(-g.x/-g.z);
|
var phi = Math.atan(-g.x/-g.z);
|
||||||
|
@ -38,10 +39,3 @@ exports.tiltfix = (m,g,O,S) => {
|
||||||
if (psi<0) psi+=360;
|
if (psi<0) psi+=360;
|
||||||
return psi;
|
return psi;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.tiltfixread = (O,S) => {
|
|
||||||
"ram"
|
|
||||||
var m = Bangle.getCompass({noTiltComp: true});
|
|
||||||
var g = Bangle.getAccel();
|
|
||||||
return exports.tiltfix(m,g,O,S);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "magnav",
|
"id": "magnav",
|
||||||
"name": "Navigation Compass",
|
"name": "Navigation Compass",
|
||||||
"version": "0.07",
|
"version": "0.06",
|
||||||
"description": "Compass with linear display as for GPSNAV. Has Tilt compensation and remembers calibration.",
|
"description": "Compass with linear display as for GPSNAV. Has Tilt compensation and remembers calibration.",
|
||||||
"screenshots": [{"url":"screenshot-b2.png"},{"url":"screenshot-light-b2.png"}],
|
"screenshots": [{"url":"screenshot-b2.png"},{"url":"screenshot-light-b2.png"}],
|
||||||
"icon": "magnav.png",
|
"icon": "magnav.png",
|
||||||
|
|
Loading…
Reference in New Issue