Merge pull request #707 from hughbarney/master

kitchen combo compass, disable BTN1,BTN2 until GPS status is RUNNING and first position fix received
master
Gordon Williams 2021-04-06 08:54:39 +01:00 committed by GitHub
commit 55de3ce372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 14 deletions

View File

@ -3045,7 +3045,7 @@
{ "id": "kitchen", { "id": "kitchen",
"name": "Kitchen Combo", "name": "Kitchen Combo",
"icon": "kitchen.png", "icon": "kitchen.png",
"version":"0.01", "version":"0.02",
"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",
"readme": "README.md", "readme": "README.md",

2
apps/kitchen/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: First version
0.02: compass disable BTN1,BTN2 while waiting for GPS to reach RUNNING status

View File

@ -106,6 +106,8 @@
} }
function onButtonShort(btn) { function onButtonShort(btn) {
log_debug("onButtonShort()");
if (gpsObject.getState() !== gpsObject.GPS_RUNNING) return;
switch(btn) { switch(btn) {
case 1: case 1:
log_debug("prev waypoint"); log_debug("prev waypoint");
@ -128,7 +130,6 @@
log_debug("markWaypoint()"); log_debug("markWaypoint()");
if (btn !== 1) return; if (btn !== 1) return;
if (gpsObject.getState() !== gpsObject.GPS_RUNNING) return; if (gpsObject.getState() !== gpsObject.GPS_RUNNING) return;
log_debug("markWaypoint()"); log_debug("markWaypoint()");
gpsObject.markWaypoint(); gpsObject.markWaypoint();
@ -143,8 +144,8 @@
wp_distance = gpsObject.getWPdistance(); wp_distance = gpsObject.getWPdistance();
wp_bearing = gpsObject.getWPbearing(); wp_bearing = gpsObject.getWPbearing();
log_debug(wp); log_debug(wp);
log_debug(wp_distance); log_debug("wp_distance:" + wp_distance);
log_debug(wp_bearing); log_debug("wp_bearing:" + wp_bearing);
} }
// takes 32ms // takes 32ms
@ -205,16 +206,8 @@
var d = tiltfixread(CALIBDATA.offset,CALIBDATA.scale); var d = tiltfixread(CALIBDATA.offset,CALIBDATA.scale);
heading = newHeading(d,heading); heading = newHeading(d,heading);
if (gpsObject.getState() === gpsObject.GPS_RUNNING) { getWaypoint();
wp_dist = gpsObject.getWPdistance();
wp_bearing = gpsObject.getWPbearing();
bearing = wp_bearing;
} else {
bearing = 0;
wp_distance = 0;
wp_bearing = 0;
}
var dir = bearing - heading; var dir = bearing - heading;
if (dir < 0) dir += 360; if (dir < 0) dir += 360;
if (dir > 360) dir -= 360; if (dir > 360) dir -= 360;