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