Add files via upload
parent
b5fc57f544
commit
2dbec19f1e
|
|
@ -1,4 +1,4 @@
|
||||||
# Regatta Timer with 5-4-1 countdown
|
# Regatta Timer 5-4-1 countdown
|
||||||
|
|
||||||
## Modes
|
## Modes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Regatta Timer
|
* Regatta Timer
|
||||||
*
|
* speed of advance
|
||||||
*/
|
*/
|
||||||
const DEBUG = false;
|
|
||||||
const Layout = require("Layout");
|
const Layout = require("Layout");
|
||||||
const locale = require("locale").name.substring(0, 2);
|
const locale = require("locale").name.substring(0, 2);
|
||||||
|
|
||||||
|
|
@ -37,7 +36,7 @@ function Regattatimer() {
|
||||||
return {
|
return {
|
||||||
layout: undefined,
|
layout: undefined,
|
||||||
mode: "idle", // idle, start, race"
|
mode: "idle", // idle, start, race"
|
||||||
countdown: DEBUG ? 1 : 300, // 5 minutes
|
countdown: 300, // 5 minutes
|
||||||
counter: undefined,
|
counter: undefined,
|
||||||
interval: undefined,
|
interval: undefined,
|
||||||
raceTimeStart: undefined,
|
raceTimeStart: undefined,
|
||||||
|
|
@ -64,10 +63,10 @@ function Regattatimer() {
|
||||||
],
|
],
|
||||||
|
|
||||||
settings: Object.assign({
|
settings: Object.assign({
|
||||||
|
"debug": false,
|
||||||
"dial": "numeric",
|
"dial": "numeric",
|
||||||
"gps": false,
|
"gps": false,
|
||||||
"compass": false,
|
"compass": false,
|
||||||
"language": "en",
|
|
||||||
"fgColor": "#FFFF00",
|
"fgColor": "#FFFF00",
|
||||||
"bgColor": "#000000"
|
"bgColor": "#000000"
|
||||||
}, require('Storage').readJSON("regattatimer.json", true) || {}),
|
}, require('Storage').readJSON("regattatimer.json", true) || {}),
|
||||||
|
|
@ -84,7 +83,7 @@ function Regattatimer() {
|
||||||
}, require('Storage').readJSON("translations.json", true) || {}),
|
}, require('Storage').readJSON("translations.json", true) || {}),
|
||||||
|
|
||||||
translate: function(slug) {
|
translate: function(slug) {
|
||||||
return this.translations[this.settings.language][slug];
|
return this.translations[locale][slug];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* During the start phase, the the clock counts down 5 4 1 minutes.
|
* During the start phase, the the clock counts down 5 4 1 minutes.
|
||||||
|
|
@ -261,7 +260,6 @@ function Regattatimer() {
|
||||||
{type: "txt", font: "10%", label: "-", col: this.settings.fgColor, pad: 4, filly: 1, fillx: 1, id: "satellites"},
|
{type: "txt", font: "10%", label: "-", col: this.settings.fgColor, pad: 4, filly: 1, fillx: 1, id: "satellites"},
|
||||||
{type: "txt", font: "10%", label: "00:00", col: this.settings.fgColor, pad: 4, filly: 1, fillx: 1, halign: 1, id: "daytime"},
|
{type: "txt", font: "10%", label: "00:00", col: this.settings.fgColor, pad: 4, filly: 1, fillx: 1, halign: 1, id: "daytime"},
|
||||||
]}
|
]}
|
||||||
|
|
||||||
]},{lazy:true});
|
]},{lazy:true});
|
||||||
},
|
},
|
||||||
onGPS: function(fix) {
|
onGPS: function(fix) {
|
||||||
|
|
@ -269,7 +267,7 @@ function Regattatimer() {
|
||||||
if(fix.fix && isFinite(fix.speed)) {
|
if(fix.fix && isFinite(fix.speed)) {
|
||||||
this.layout.speed.label = fix.speed.toFixed(2); //m[1];
|
this.layout.speed.label = fix.speed.toFixed(2); //m[1];
|
||||||
}
|
}
|
||||||
this. layout.satellites.label = "Satellites ".concat(fix.satellites);
|
this. layout.satellites.label = "Sats: ".concat(fix.satellites);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
|
|
@ -308,6 +306,10 @@ function Regattatimer() {
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
|
|
||||||
|
if(this.settings.debug) {
|
||||||
|
this.countdown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.setLayoutIdle();
|
this.setLayoutIdle();
|
||||||
|
|
||||||
Bangle.setLCDPower(1);
|
Bangle.setLCDPower(1);
|
||||||
|
|
@ -347,22 +349,22 @@ var regattatimer = Regattatimer()
|
||||||
|
|
||||||
regattatimer.init();
|
regattatimer.init();
|
||||||
|
|
||||||
if(regattatimer.gps) {
|
if(regattatimer.settings.gps) {
|
||||||
Bangle.setGPSPower(1);
|
Bangle.setGPSPower(1);
|
||||||
Bangle.on('GPS', regattatimer.onGPS.bind(regattatimer));
|
Bangle.on('GPS', regattatimer.onGPS.bind(regattatimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(regattatimer.compass) {
|
if(regattatimer.settings.compass) {
|
||||||
Bangle.setCompassPower(1);
|
Bangle.setCompassPower(1);
|
||||||
Bangle.on('mag', regattatimer.onCompass.bind(regattatimer));
|
Bangle.on('mag', regattatimer.onCompass.bind(regattatimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on('kill',function() {
|
Bangle.on('kill',function() {
|
||||||
if(regattatimer.gps) {
|
if(regattatimer.settings.gps) {
|
||||||
Bangle.setGPSPower(0);
|
Bangle.setGPSPower(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(regattatimer.compass) {
|
if(regattatimer.settings.compass) {
|
||||||
Bangle.setCompassPower(0);
|
Bangle.setCompassPower(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"id": "regattatimer",
|
"id": "regattatimer",
|
||||||
"name": "Regatta Timer",
|
"name": "Regatta Timer",
|
||||||
"shortName": "Regatta T.",
|
"shortName": "RegattaTimer",
|
||||||
"version": "0.2",
|
"version": "0.2",
|
||||||
"description": "Regatta Timer with classic 5-4-1 Countdown",
|
"description": "Regatta Timer with 5-4-1 Countdown",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [{"url":"screenshot.png"}],
|
||||||
"tags": "tool,outdoors,sailing,race,regatta,boat,timer",
|
"tags": "tool,outdoors,sailing,race,regatta,boat,timer",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"debug": false,
|
||||||
"dial": "numeric",
|
"dial": "numeric",
|
||||||
"gps": false,
|
"gps": false,
|
||||||
"compass": false,
|
"compass": false,
|
||||||
"language": "en",
|
|
||||||
"fgColor": "#FFFF00",
|
"fgColor": "#FFFF00",
|
||||||
"bgColor": "#000000"
|
"bgColor": "#000000"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
var file = "regattatimer.json";
|
var file = "regattatimer.json";
|
||||||
// Load settings
|
// Load settings
|
||||||
var settings = Object.assign({
|
var settings = Object.assign({
|
||||||
|
"debug": false,
|
||||||
"dial": "numeric",
|
"dial": "numeric",
|
||||||
"gps": false,
|
"gps": false,
|
||||||
"compass": false,
|
"compass": false,
|
||||||
"language": "en",
|
|
||||||
"fgColor": "#FFFF00",
|
"fgColor": "#FFFF00",
|
||||||
"bgColor": "#000000"
|
"bgColor": "#000000"
|
||||||
}, require('Storage').readJSON(file, true) || {});
|
}, require('Storage').readJSON(file, true) || {});
|
||||||
|
|
@ -41,6 +41,13 @@
|
||||||
settings.dial = v;
|
settings.dial = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'DEBUG': {
|
||||||
|
value: !!settings.debug, // 0| converts undefined to 0
|
||||||
|
onchange: v => {
|
||||||
|
settings.debug = v;
|
||||||
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue