gpsrec 0.18: Period counter now uses GPS time rather than counting packets (allows use with GPS Setup)

pull/686/head
Gordon Williams 2021-03-11 10:58:47 +00:00
parent a55ec3f1af
commit cc59d35342
4 changed files with 10 additions and 6 deletions

View File

@ -400,7 +400,7 @@
{ "id": "gpsrec",
"name": "GPS Recorder",
"icon": "app.png",
"version":"0.17",
"version":"0.18",
"interface": "interface.html",
"description": "Application that allows you to record a GPS track. Can run in background",
"tags": "tool,outdoors,gps,widget",
@ -2971,5 +2971,5 @@
{"name":"stepo.app.js","url":"app.js"},
{"name":"stepo.img","url":"icon.js","evaluate":true}
]
}
}
]

View File

@ -19,3 +19,4 @@
0.15: Add plotTrack method to allow current track to be plotted on a map (#395)
0.16: Add gpsrec app to Settings menu
0.17: Disable recording if storage is full (fix #574)
0.18: Period counter now uses GPS time rather than counting packets (allows use with GPS Setup)

View File

@ -44,6 +44,7 @@ function showMainMenu() {
min: 1,
max: 120,
step: 1,
format: v=>v+"s",
onchange: v => {
settings.recording = false;
settings.period = v;

View File

@ -3,8 +3,8 @@
var hasFix = false;
var fixToggle = false; // toggles once for each reading
var gpsTrack; // file for GPS track
var periodCtr = 0;
var gpsOn = false;
var lastFixTime;
// draw your widget
function draw() {
@ -26,9 +26,11 @@
fixToggle = !fixToggle;
WIDGETS["gpsrec"].draw();
if (hasFix) {
periodCtr--;
if (periodCtr<=0) {
periodCtr = settings.period;
var period = 1000000;
if (lastFixTime!==undefined)
period = fix.time.getTime() - lastFixTime;
if (period > settings.period*1000) {
lastFixTime = fix.time.getTime();
try {
if (gpsTrack) gpsTrack.write([
fix.time.getTime(),