kitchen detect missing waypoint.json file
parent
41dde5ff2d
commit
f7dd6badd3
|
|
@ -3085,7 +3085,7 @@
|
||||||
{ "id": "kitchen",
|
{ "id": "kitchen",
|
||||||
"name": "Kitchen Combo",
|
"name": "Kitchen Combo",
|
||||||
"icon": "kitchen.png",
|
"icon": "kitchen.png",
|
||||||
"version":"0.10",
|
"version":"0.11",
|
||||||
"description": "Combination of the Stepo, Walkersclock, Arrow and Waypointer apps into a multiclock format. 'Everything but the kitchen sink'. Requires firmware v2.08.167 or later",
|
"description": "Combination of the Stepo, Walkersclock, Arrow and Waypointer apps into a multiclock format. 'Everything but the kitchen sink'. Requires firmware v2.08.167 or later",
|
||||||
"tags": "tool,outdoors,gps",
|
"tags": "tool,outdoors,gps",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ charge.
|
||||||
*BTN3* - invokes calibration ( can be cancelled if pressed accidentally)
|
*BTN3* - invokes calibration ( can be cancelled if pressed accidentally)
|
||||||
|
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
* detect when calibration data is missing
|
||||||
|
|
||||||
## Acknowledgement
|
## Acknowledgement
|
||||||
|
|
||||||
This app is based in the work done by [jeffmer](https://github.com/jeffmer/JeffsBangleAppsDev)
|
This app is based in the work done by [jeffmer](https://github.com/jeffmer/JeffsBangleAppsDev)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,4 @@
|
||||||
0.08: Improved error handling for missing firmware features, added template app.kit.js
|
0.08: Improved error handling for missing firmware features, added template app.kit.js
|
||||||
0.09: Added heart rate monitor app
|
0.09: Added heart rate monitor app
|
||||||
0.10: Converted Stepo to use direct screen writes, added a Trip Counter feature to stepo
|
0.10: Converted Stepo to use direct screen writes, added a Trip Counter feature to stepo
|
||||||
|
0.11: Detect when waypoints.json is not present, error E-WPT
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,7 @@ The following error codes will be displayed if one of the dependancies is not me
|
||||||
* E-STEPS - no pedomintor widget has been installed, please install the widpedom or the activepedom widgets
|
* E-STEPS - no pedomintor widget has been installed, please install the widpedom or the activepedom widgets
|
||||||
* E-CALIB - no compass calibration data was found, see 'Compass Calibration'
|
* E-CALIB - no compass calibration data was found, see 'Compass Calibration'
|
||||||
* E-FW - require firmware 2v08.187 or later to detect gps and compass power status
|
* E-FW - require firmware 2v08.187 or later to detect gps and compass power status
|
||||||
|
* E-WPT - missing waypoints.json file
|
||||||
|
|
||||||
### Issues / Future enhancements
|
### Issues / Future enhancements
|
||||||
|
|
||||||
|
|
@ -254,3 +255,5 @@ The following error codes will be displayed if one of the dependancies is not me
|
||||||
seconds after the LCD goes off. At present I just rely on using
|
seconds after the LCD goes off. At present I just rely on using
|
||||||
the GPSSetup app and set the GPS power mode that I want.
|
the GPSSetup app and set the GPS power mode that I want.
|
||||||
* Add a small graph to the heart rate monitor app
|
* Add a small graph to the heart rate monitor app
|
||||||
|
* Add a facility to call the Arrow calibration process
|
||||||
|
* Maybe create waypoints.json file if missing
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
// annexed code that might be worth keeping
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Screen Buffer Object that can be shared between faces
|
||||||
|
|
||||||
|
Making into a Class like this means we allocate the memory once
|
||||||
|
and avoid fragmenting the memory when we switch in and out of faces
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
function BUF() {
|
||||||
|
this.pal4color = new Uint16Array([0x0000,0xFFFF,0x7BEF,0xAFE5],0,2); // b,w,grey,greenyellow
|
||||||
|
this.pal4red = new Uint16Array([0x0000,0xFFFF,0xF800,0xAFE5],0,2); // b,w,red,greenyellow
|
||||||
|
this.buf = Graphics.createArrayBuffer(120,120,2,{msb:true});
|
||||||
|
}
|
||||||
|
|
||||||
|
BUF.prototype.flip = function(x,y) {
|
||||||
|
g.drawImage({width:120,height:120,bpp:2, buffer:this.buf.buffer, palette:this.pal4color}, x, y);
|
||||||
|
this.buf.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
BUF.prototype.flip_red = function(x,y) {
|
||||||
|
g.drawImage({width:120,height:120,bpp:2, buffer:this.buf.buffer, palette:this.pal4red}, x, y);
|
||||||
|
this.buf.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
let bufObj = new BUF();
|
||||||
|
|
||||||
|
|
@ -17,13 +17,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(gps,sw, hrm) {
|
function init(gps,sw, hrm) {
|
||||||
showMem("compass init() START");
|
|
||||||
gpsObject = gps;
|
gpsObject = gps;
|
||||||
intervalRefSec = undefined;
|
intervalRefSec = undefined;
|
||||||
bearing = 0; // always point north if GPS is off
|
bearing = 0; // always point north if GPS is off
|
||||||
heading = 0;
|
heading = 0;
|
||||||
oldHeading = 0;
|
oldHeading = 0;
|
||||||
previous = {hding:"-", bs:"-", dst:"-", wp_name:"-", course:999};
|
resetPrevious();
|
||||||
loc = require("locale");
|
loc = require("locale");
|
||||||
CALIBDATA = require("Storage").readJSON("magnav.json",1)||null;
|
CALIBDATA = require("Storage").readJSON("magnav.json",1)||null;
|
||||||
getWaypoint();
|
getWaypoint();
|
||||||
|
|
@ -34,12 +33,9 @@
|
||||||
*/
|
*/
|
||||||
if (!Bangle.isCompassOn()) Bangle.setCompassPower(1);
|
if (!Bangle.isCompassOn()) Bangle.setCompassPower(1);
|
||||||
gps.determineGPSState();
|
gps.determineGPSState();
|
||||||
|
|
||||||
showMem("compass init() END");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function freeResources() {
|
function freeResources() {
|
||||||
showMem("compass freeResources() START");
|
|
||||||
gpsObject = undefined;
|
gpsObject = undefined;
|
||||||
intervalRefSec = undefined;
|
intervalRefSec = undefined;
|
||||||
previous = undefined;
|
previous = undefined;
|
||||||
|
|
@ -50,7 +46,6 @@
|
||||||
CALIBDATA = undefined;
|
CALIBDATA = undefined;
|
||||||
wp = undefined;
|
wp = undefined;
|
||||||
if (Bangle.isCompassOn !== undefined && Bangle.isCompassOn()) Bangle.setCompassPower(0);
|
if (Bangle.isCompassOn !== undefined && Bangle.isCompassOn()) Bangle.setCompassPower(0);
|
||||||
showMem("compass freeResources() END");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTimer() {
|
function startTimer() {
|
||||||
|
|
@ -67,12 +62,6 @@
|
||||||
if (Bangle.isCompassOn !== undefined && Bangle.isCompassOn()) Bangle.setCompassPower(0);
|
if (Bangle.isCompassOn !== undefined && Bangle.isCompassOn()) Bangle.setCompassPower(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMem(msg) {
|
|
||||||
var val = process.memory();
|
|
||||||
var str = msg + " " + Math.round(val.usage*100/val.total) + "%";
|
|
||||||
log_debug(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onButtonShort(btn) {
|
function onButtonShort(btn) {
|
||||||
log_debug("onButtonShort()");
|
log_debug("onButtonShort()");
|
||||||
if (gpsObject.getState() !== gpsObject.GPS_RUNNING) return;
|
if (gpsObject.getState() !== gpsObject.GPS_RUNNING) return;
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ function nextFace(){
|
||||||
// when you feel the buzzer you know you have done a long press
|
// when you feel the buzzer you know you have done a long press
|
||||||
function longPressCheck() {
|
function longPressCheck() {
|
||||||
Bangle.buzz();
|
Bangle.buzz();
|
||||||
debug_log("long PressCheck() buzz");
|
debug_log("BUZZ, long press");
|
||||||
if (pressTimer) {
|
if (pressTimer) {
|
||||||
clearInterval(pressTimer);
|
clearInterval(pressTimer);
|
||||||
debug_log("clear pressTimer 2");
|
debug_log("CLEAR pressTimer 2");
|
||||||
pressTimer = undefined;
|
pressTimer = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,10 +48,10 @@ function buttonPressed(btn) {
|
||||||
} else {
|
} else {
|
||||||
firstPress = getTime();
|
firstPress = getTime();
|
||||||
if (pressTimer) {
|
if (pressTimer) {
|
||||||
debug_log("clear pressTimer 1");
|
debug_log("CLEAR pressTimer 1");
|
||||||
clearInterval(pressTimer);
|
clearInterval(pressTimer);
|
||||||
}
|
}
|
||||||
debug_log("set pressTimer 1");
|
debug_log("SET pressTimer 1");
|
||||||
pressTimer = setInterval(longPressCheck, 1500);
|
pressTimer = setInterval(longPressCheck, 1500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ function buttonPressed(btn) {
|
||||||
function buttonReleased(btn) {
|
function buttonReleased(btn) {
|
||||||
var dur = getTime() - firstPress;
|
var dur = getTime() - firstPress;
|
||||||
if (pressTimer) {
|
if (pressTimer) {
|
||||||
debug_log("clear pressTimer 3");
|
debug_log("CLEAR pressTimer 3");
|
||||||
clearInterval(pressTimer);
|
clearInterval(pressTimer);
|
||||||
pressTimer = undefined;
|
pressTimer = undefined;
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +256,7 @@ GPS.prototype.processFix = function(fix) {
|
||||||
this.gpsState = this.GPS_RUNNING;
|
this.gpsState = this.GPS_RUNNING;
|
||||||
if (!this.last_fix.fix && !(require("Storage").readJSON("setting.json", 1) || {}).quiet) {
|
if (!this.last_fix.fix && !(require("Storage").readJSON("setting.json", 1) || {}).quiet) {
|
||||||
Bangle.buzz(); // buzz on first position
|
Bangle.buzz(); // buzz on first position
|
||||||
debug_log("GPS fix buzz");
|
debug_log("BUZZ - gps fix");
|
||||||
}
|
}
|
||||||
this.last_fix = fix;
|
this.last_fix = fix;
|
||||||
}
|
}
|
||||||
|
|
@ -303,7 +303,7 @@ GPS.prototype.getWPdistance = function() {
|
||||||
//log_debug(this.last_fix);
|
//log_debug(this.last_fix);
|
||||||
//log_debug(this.wp_current);
|
//log_debug(this.wp_current);
|
||||||
|
|
||||||
if (this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
if (this.wp_current.name === "E-WPT" || this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return this.calcDistance(this.last_fix, this.wp_current);
|
return this.calcDistance(this.last_fix, this.wp_current);
|
||||||
|
|
@ -313,14 +313,14 @@ GPS.prototype.getWPbearing = function() {
|
||||||
//log_debug(this.last_fix);
|
//log_debug(this.last_fix);
|
||||||
//log_debug(this.wp_current);
|
//log_debug(this.wp_current);
|
||||||
|
|
||||||
if (this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
if (this.wp_current.name === "E-WPT" || this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return this.calcBearing(this.last_fix, this.wp_current);
|
return this.calcBearing(this.last_fix, this.wp_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
GPS.prototype.loadFirstWaypoint = function() {
|
GPS.prototype.loadFirstWaypoint = function() {
|
||||||
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"NONE"}];
|
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"E-WPT"}];
|
||||||
this.wp_index = 0;
|
this.wp_index = 0;
|
||||||
this.wp_current = waypoints[this.wp_index];
|
this.wp_current = waypoints[this.wp_index];
|
||||||
log_debug(this.wp_current);
|
log_debug(this.wp_current);
|
||||||
|
|
@ -332,7 +332,7 @@ GPS.prototype.getCurrentWaypoint = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GPS.prototype.waypointHasLocation = function() {
|
GPS.prototype.waypointHasLocation = function() {
|
||||||
if (this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
if (this.wp_current.name === "E-WPT" || this.wp_current.name === "NONE" || this.wp_current.lat === undefined || this.wp_current.lat === 0)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -340,12 +340,12 @@ GPS.prototype.waypointHasLocation = function() {
|
||||||
|
|
||||||
GPS.prototype.markWaypoint = function() {
|
GPS.prototype.markWaypoint = function() {
|
||||||
|
|
||||||
if(this.wp_current.name === "NONE")
|
if(this.wp_current.name === "E-WPT" || this.wp_current.name === "NONE")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug("GPS::markWaypoint()");
|
log_debug("GPS::markWaypoint()");
|
||||||
|
|
||||||
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"NONE"}];
|
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"E-WPT"}];
|
||||||
this.wp_current = waypoints[this.wp_index];
|
this.wp_current = waypoints[this.wp_index];
|
||||||
|
|
||||||
if (this.waypointHasLocation()) {
|
if (this.waypointHasLocation()) {
|
||||||
|
|
@ -360,7 +360,7 @@ GPS.prototype.markWaypoint = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GPS.prototype.nextWaypoint = function(inc) {
|
GPS.prototype.nextWaypoint = function(inc) {
|
||||||
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"NONE"}];
|
var waypoints = require("Storage").readJSON("waypoints.json")||[{name:"E-WPT"}];
|
||||||
this.wp_index+=inc;
|
this.wp_index+=inc;
|
||||||
if (this.wp_index>=waypoints.length) this.wp_index=0;
|
if (this.wp_index>=waypoints.length) this.wp_index=0;
|
||||||
if (this.wp_index<0) this.wp_index = waypoints.length-1;
|
if (this.wp_index<0) this.wp_index = waypoints.length-1;
|
||||||
|
|
@ -731,14 +731,14 @@ function TRIP() {
|
||||||
|
|
||||||
TRIP.prototype.resetTrip = function(steps) {
|
TRIP.prototype.resetTrip = function(steps) {
|
||||||
this.tripStart = (0 + steps);
|
this.tripStart = (0 + steps);
|
||||||
console.log("resetTrip starting=" + this.tripStart);
|
log_debug("resetTrip starting=" + this.tripStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRIP.prototype.getTrip = function(steps) {
|
TRIP.prototype.getTrip = function(steps) {
|
||||||
let tripSteps = (0 + steps) - this.tripStart;
|
let tripSteps = (0 + steps) - this.tripStart;
|
||||||
console.log("getTrip steps=" + steps);
|
log_debug("getTrip steps=" + steps);
|
||||||
console.log("getTrip tripStart=" + this.tripStart);
|
log_debug("getTrip tripStart=" + this.tripStart);
|
||||||
console.log("getTrip=" + tripSteps);
|
log_debug("getTrip=" + tripSteps);
|
||||||
return tripSteps;
|
return tripSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -758,7 +758,6 @@ Debug Object
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
function DEBUG() {
|
function DEBUG() {
|
||||||
this.logfile = require("Storage").open("debug.log","a");
|
this.logfile = require("Storage").open("debug.log","a");
|
||||||
}
|
}
|
||||||
|
|
@ -770,7 +769,6 @@ DEBUG.prototype.log = function(msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
debugObj = new DEBUG();
|
debugObj = new DEBUG();
|
||||||
*/
|
|
||||||
|
|
||||||
function debug_log(m) {
|
function debug_log(m) {
|
||||||
//debugObj.log(m);
|
//debugObj.log(m);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue