Merge branch 'master' of github.com:espruino/BangleApps

pull/2176/head
Gordon Williams 2022-10-10 10:58:20 +01:00
commit 8d99a52f20
7 changed files with 14 additions and 15 deletions

View File

@ -4,4 +4,5 @@
0.04: Fix great circle formula
0.05: Use locale for speed and distance + fix Vector font sizes
0.06: Move waypoints.json (and editor) to 'waypoints' app
0.07: Add support for b2
0.07: Add support for b2
0.08: Fix not displaying of wpindex = 0, correct compass drawing and nm calculation on b2

View File

@ -36,7 +36,7 @@ function drawCompass(course) {
}
xpos+=15;
}
if (wpindex!=0) {
if (wpindex>=0) {
var bpos = brg - course;
if (bpos>180) bpos -=360;
if (bpos<-180) bpos +=360;
@ -220,7 +220,7 @@ function nextwp(inc){
}
function doselect(){
if (selected && wpindex!=0 && waypoints[wpindex].lat===undefined && savedfix.fix) {
if (selected && wpindex>=0 && waypoints[wpindex].lat===undefined && savedfix.fix) {
waypoints[wpindex] ={name:"@"+wp.name, lat:savedfix.lat, lon:savedfix.lon};
wp = waypoints[wpindex];
require("waypoints").save(waypoints);

View File

@ -13,7 +13,7 @@ var loc = {
distance: [
require("locale").distance,
(m) => {
return (m / 1.852).toFixed(3) + "nm ";
return (m / 1852).toFixed(3) + "nm ";
}
]
};
@ -21,7 +21,7 @@ var loc = {
function drawCompass(course) {
if (!candraw) return;
g.setColor(g.theme.fg);
g.reset().clearRect(0, 24, 175, 71);
g.setFont("Vector", 18);
var start = course - 90;
if (start < 0) start += 360;
@ -43,7 +43,7 @@ function drawCompass(course) {
}
xpos += 12;
}
if (wpindex != 0) {
if (wpindex >= 0) {
var bpos = brg - course;
if (bpos > 180) bpos -= 360;
if (bpos < -180) bpos += 360;
@ -106,9 +106,8 @@ function distance(a, b) {
var selected = false;
function drawN() {
g.clearRect(0, 89, 175, 175);
g.reset().clearRect(0, 89, 175, 175);
var txt = loc.speed[locindex](speed);
g.setColor(g.theme.fg);
g.setFont("6x8", 2);
g.drawString("o", 68, 87);
g.setFont("6x8", 1);
@ -117,10 +116,8 @@ function drawN() {
var cs = course.toString().padStart(3, "0");
g.drawString(cs, 2, 89);
g.drawString(txt.substring(0, txt.length - 3), 92, 89);
g.setColor(g.theme.fg);
g.setFont("Vector", 18);
var bs = brg.toString().padStart(3, "0");
g.setColor(g.theme.fg);
g.drawString("Brg:", 1, 128);
g.drawString("Dist:", 1, 148);
g.setColor(selected ? g.theme.bgH : g.theme.bg);
@ -241,7 +238,7 @@ function nextwp(inc) {
}
function doselect() {
if (selected && wpindex != 0 && waypoints[wpindex].lat === undefined && savedfix.fix) {
if (selected && wpindex >= 0 && waypoints[wpindex].lat === undefined && savedfix.fix) {
waypoints[wpindex] = {
name: "@" + wp.name,
lat: savedfix.lat,
@ -265,4 +262,4 @@ drawAll();
startTimers();
Bangle.on('GPS', onGPS);
// Toggle selected
setButtons();
setButtons();

View File

@ -1,7 +1,7 @@
{
"id": "gpsnav",
"name": "GPS Navigation",
"version": "0.07",
"version": "0.08",
"description": "Displays GPS Course and Speed, + Directions to waypoint and waypoint recording, now with waypoint editor",
"screenshots": [{"url":"screenshot-b2.png"}],
"icon": "icon.png",

View File

@ -2,3 +2,4 @@
0.02: Make Bangle.js 2 compatible
0.03: Silently use built in heading when no magnav calibration file is present
0.04: Move waypoints.json (and editor) to 'waypoints' app
0.05: Fix not displaying of wpindex = 0

View File

@ -263,7 +263,7 @@ function nextwp(inc){
}
function doselect(){
if (selected && wpindex!=0 && waypoints[wpindex].lat===undefined && savedfix.fix) {
if (selected && wpindex>=0 && waypoints[wpindex].lat===undefined && savedfix.fix) {
waypoints[wpindex] ={name:"@"+wp.name, lat:savedfix.lat, lon:savedfix.lon};
wp = waypoints[wpindex];
require("waypoints").save(waypoints);

View File

@ -1,7 +1,7 @@
{
"id": "waypointer",
"name": "Way Pointer",
"version": "0.04",
"version": "0.05",
"description": "Navigate to a waypoint using the GPS for bearing and compass to point way, uses the same waypoint interface as GPS Navigation",
"icon": "waypointer.png",
"tags": "tool,outdoors,gps",