@@ -130,16 +130,16 @@ function BlackboxLogViewer() {
130130 }
131131 }
132132
133- function setVideoOffset ( offset ) {
133+ function setVideoOffset ( offset , withoutRefresh ) { // optionally prevent the graph refresh until later
134134 videoOffset = offset ;
135135
136136 /*
137137 * Round to 2 dec places for display and put a plus at the start for positive values to emphasize the fact it's
138138 * an offset
139139 */
140- $ ( ".video-offset" ) . val ( ( videoOffset >= 0 ? "+" : "" ) + ( videoOffset . toFixed ( 2 ) != videoOffset ? videoOffset . toFixed ( 2 ) : videoOffset ) ) ;
140+ $ ( ".video-offset" ) . val ( ( videoOffset >= 0 ? "+" : "" ) + ( videoOffset . toFixed ( 3 ) != videoOffset ? videoOffset . toFixed ( 3 ) : videoOffset ) ) ;
141141
142- invalidateGraph ( ) ;
142+ if ( wihtoutRefresh ) invalidateGraph ( ) ;
143143 }
144144
145145 function isInteger ( value ) {
@@ -909,13 +909,19 @@ function BlackboxLogViewer() {
909909 }
910910 e . preventDefault ( ) ;
911911 break ;
912- case "M" . charCodeAt ( 0 ) :
913- if ( ! ( shifted ) ) {
912+ case "M" . charCodeAt ( 0 ) :
913+ if ( e . altKey && hasMarker && hasVideo && hasLog ) { // adjust the video sync offset and remove marker
914+ try {
915+ setVideoOffset ( videoOffset + ( stringTimetoMsec ( $ ( ".graph-time-marker" ) . val ( ) ) / 1000000 ) , true ) ;
916+ } catch ( e ) {
917+ console . log ( 'Failed to set video offset' ) ;
918+ }
919+ } else { // Add a marker to graph window
914920 markerTime = currentBlackboxTime ;
915921 $ ( ".graph-time-marker" ) . val ( formatTime ( 0 ) ) ;
916- setMarker ( ! hasMarker ) ;
917- invalidateGraph ( ) ;
918922 }
923+ setMarker ( ! hasMarker ) ;
924+ invalidateGraph ( ) ;
919925 e . preventDefault ( ) ;
920926 break ;
921927 // Add my shortcuts
@@ -941,16 +947,12 @@ function BlackboxLogViewer() {
941947 }
942948 e . preventDefault ( ) ;
943949 break ;
944- case 33 : // pgup arrow - goto start
945- if ( ! ( shifted ) ) {
946- logJumpStart ( ) ;
947- }
950+ case 36 : // home - goto start of log
951+ logJumpStart ( ) ;
948952 e . preventDefault ( ) ;
949953 break ;
950- case 34 : // pgdn arrow - goto end
951- if ( ! ( shifted ) ) {
952- logJumpEnd ( ) ;
953- }
954+ case 35 : // end - goto end of log
955+ logJumpEnd ( ) ;
954956 e . preventDefault ( ) ;
955957 break ;
956958
0 commit comments