diff --git a/index.html b/index.html index 2b28a881..243efe44 100755 --- a/index.html +++ b/index.html @@ -224,7 +224,7 @@

Log sync

- + diff --git a/js/main.js b/js/main.js index 8a362741..3caee9d4 100644 --- a/js/main.js +++ b/js/main.js @@ -130,16 +130,16 @@ function BlackboxLogViewer() { } } - function setVideoOffset(offset) { + function setVideoOffset(offset, withoutRefresh) { // optionally prevent the graph refresh until later videoOffset = offset; /* * Round to 2 dec places for display and put a plus at the start for positive values to emphasize the fact it's * an offset */ - $(".video-offset").val((videoOffset >= 0 ? "+" : "") + (videoOffset.toFixed(2) != videoOffset ? videoOffset.toFixed(2) : videoOffset)); + $(".video-offset").val((videoOffset >= 0 ? "+" : "") + (videoOffset.toFixed(3) != videoOffset ? videoOffset.toFixed(3) : videoOffset)); - invalidateGraph(); + if (wihtoutRefresh) invalidateGraph(); } function isInteger(value) { @@ -909,13 +909,19 @@ function BlackboxLogViewer() { } e.preventDefault(); break; - case "M".charCodeAt(0): - if (!(shifted)) { + case "M".charCodeAt(0): + if (e.altKey && hasMarker && hasVideo && hasLog) { // adjust the video sync offset and remove marker + try{ + setVideoOffset(videoOffset + (stringTimetoMsec($(".graph-time-marker").val()) / 1000000), true); + } catch(e) { + console.log('Failed to set video offset'); + } + } else { // Add a marker to graph window markerTime = currentBlackboxTime; $(".graph-time-marker").val(formatTime(0)); - setMarker(!hasMarker); - invalidateGraph(); } + setMarker(!hasMarker); + invalidateGraph(); e.preventDefault(); break; // Add my shortcuts @@ -941,16 +947,12 @@ function BlackboxLogViewer() { } e.preventDefault(); break; - case 33: // pgup arrow - goto start - if (!(shifted)) { - logJumpStart(); - } + case 36: // home - goto start of log + logJumpStart(); e.preventDefault(); break; - case 34: // pgdn arrow - goto end - if (!(shifted)) { - logJumpEnd(); - } + case 35: // end - goto end of log + logJumpEnd(); e.preventDefault(); break; diff --git a/js/tools.js b/js/tools.js index 53770662..b6b12984 100644 --- a/js/tools.js +++ b/js/tools.js @@ -189,7 +189,7 @@ function formatTime(msec, displayMsec) { function stringTimetoMsec(input) { try { - var matches = input.match(/([0-9]+)(\D)*([0-9]+)*\D*([0-9]+)*/); + var matches = input.match(/([+-]?[0-9]+)(\D)*([0-9]+)*\D*([0-9]+)*/); if(matches.length>2) { // there is a placeholder - either : or . if(matches[2] == ':'){ // time has been entered MM:SS.SSS