Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
pirxpilot committed Feb 27, 2024
1 parent 6f7d769 commit e33dfb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/kompas.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ function compassHeading({ alpha, beta, gamma }) {
const cY = Math.cos(_y);
const cZ = Math.cos(_z);

const Vx = - cZ * sY - sZ * sX * cY;
const Vy = - sZ * sY + cZ * sX * cY;
const Vx = -cZ * sY - sZ * sX * cY;
const Vy = -sZ * sY + cZ * sX * cY;

// Calculate compass heading
let heading = Math.atan( Vx / Vy );
let heading = Math.atan(Vx / Vy);

// Convert from half unit circle to whole unit circle
if (Vy < 0) {
Expand Down
12 changes: 6 additions & 6 deletions test/kompas.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ function dispatch(options) {
}

describe('kompas', function () {
beforeEach(function() {
beforeEach(function () {
this.k = kompas().watch();
});

afterEach(function() {
afterEach(function () {
this.k.clear();
});

it('must display heading if provided', function (_, done) {
this.k.on('heading', function(heading) {
setTimeout(function() {
this.k.on('heading', function (heading) {
setTimeout(function () {
heading.should.equal(270);
done();
}, 0);
Expand All @@ -28,8 +28,8 @@ describe('kompas', function () {
});

it('must calculate heading if not provided', function (_, done) {
this.k.on('heading', function(heading) {
setTimeout(function() {
this.k.on('heading', function (heading) {
setTimeout(function () {
heading.should.be.within(-360, 360);
done();
}, 0);
Expand Down

0 comments on commit e33dfb8

Please sign in to comment.