@@ -134,12 +134,13 @@ function BlackboxLogViewer() {
134134
135135 if ( frame ) {
136136
137+ var currentFlightMode = frame [ flightLog . getMainFieldIndexByName ( "flightModeFlags" ) ] ;
138+
137139 if ( hasTable ) { // Only redraw the table if it is enabled
138140
139141 var
140142 rows = [ ] ,
141- rowCount = Math . ceil ( fieldNames . length / 2 ) ,
142- currentFlightMode = frame [ flightLog . getMainFieldIndexByName ( "flightModeFlags" ) ] ;
143+ rowCount = Math . ceil ( fieldNames . length / 2 ) ;
143144
144145 for ( i = 0 ; i < rowCount ; i ++ ) {
145146 var
@@ -164,14 +165,21 @@ function BlackboxLogViewer() {
164165 }
165166
166167 table . append ( rows . join ( "" ) ) ;
168+
167169 }
168-
169- // update time field on toolbar
170+
171+ // Update flight mode flags on status bar
172+ $ ( "#status-bar .flight-mode" ) . text (
173+ fieldPresenter . decodeFieldToFriendly ( null , 'flightModeFlags' , currentFlightMode , null )
174+ ) ;
175+
176+ // update time field on status bar
170177 $ ( ".graph-time" ) . val ( formatTime ( ( currentBlackboxTime - flightLog . getMinTime ( ) ) / 1000 , true ) ) ;
171178 if ( hasMarker ) {
172- $ ( ".graph-time- marker" ) . val ( formatTime ( ( currentBlackboxTime - markerTime ) / 1000 , true ) ) ;
179+ $ ( "#status-bar . marker-offset " ) . text ( 'Marker Offset ' + formatTime ( ( currentBlackboxTime - markerTime ) / 1000 , true ) + 'ms' ) ;
173180 }
174181
182+
175183 // Update the Legend Values
176184 if ( graphLegend ) graphLegend . updateValues ( flightLog , frame ) ;
177185 }
@@ -313,7 +321,7 @@ function BlackboxLogViewer() {
313321 */
314322 function renderSelectedLogInfo ( ) {
315323 $ ( ".log-index" ) . val ( flightLog . getLogIndex ( ) ) ;
316-
324+
317325 if ( flightLog . getNumCellsEstimate ( ) ) {
318326 $ ( ".log-cells" ) . text ( flightLog . getNumCellsEstimate ( ) + "S (" + Number ( flightLog . getReferenceVoltageMillivolts ( ) / 1000 ) . toFixed ( 2 ) + "V)" ) ;
319327 $ ( ".log-cells-header,.log-cells" ) . css ( 'display' , 'block' ) ;
@@ -328,6 +336,12 @@ function BlackboxLogViewer() {
328336 $ ( ".log-device-uid-header,.log-device-uid" ) . css ( 'display' , 'none' ) ;
329337 }
330338
339+ // Add log version information to status bar
340+ var sysConfig = flightLog . getSysConfig ( ) ;
341+ $ ( '#status-bar .version' ) . text ( ( ( sysConfig [ 'Firmware revision' ] != null ) ?( sysConfig [ 'Firmware revision' ] ) :'' ) ) ;
342+ $ ( '#status-bar .looptime' ) . text ( ( ( sysConfig [ 'loopTime' ] != null ) ?( sysConfig [ 'loopTime' ] + 'us (' + ( 1000000 / sysConfig [ 'loopTime' ] ) . toFixed ( 0 ) + 'Hz)' ) :'' ) ) ;
343+ $ ( '#status-bar .lograte' ) . text ( ( ( sysConfig [ 'frameIntervalPDenom' ] != null && sysConfig [ 'frameIntervalPNum' ] != null ) ?( 'Logging Sample Rate : ' + sysConfig [ 'frameIntervalPNum' ] + '/' + sysConfig [ 'frameIntervalPDenom' ] ) :'' ) ) ;
344+
331345 seekBar . setTimeRange ( flightLog . getMinTime ( ) , flightLog . getMaxTime ( ) , currentBlackboxTime ) ;
332346 seekBar . setActivityRange ( flightLog . getSysConfig ( ) . minthrottle , flightLog . getSysConfig ( ) . maxthrottle ) ;
333347
@@ -954,6 +968,65 @@ function BlackboxLogViewer() {
954968
955969 keysDialog . show ( ) ;
956970 } ) ;
971+
972+ $ ( "#status-bar .marker-offset" ) . click ( function ( e ) {
973+ setCurrentBlackboxTime ( markerTime ) ;
974+ invalidateGraph ( ) ;
975+ } ) ;
976+
977+ $ ( '#status-bar .bookmark-1' ) . click ( function ( e ) {
978+ setCurrentBlackboxTime ( bookmarkTimes [ 1 ] ) ;
979+ invalidateGraph ( ) ;
980+ } ) ;
981+
982+ $ ( '#status-bar .bookmark-2' ) . click ( function ( e ) {
983+ setCurrentBlackboxTime ( bookmarkTimes [ 2 ] ) ;
984+ invalidateGraph ( ) ;
985+ } ) ;
986+
987+ $ ( '#status-bar .bookmark-3' ) . click ( function ( e ) {
988+ setCurrentBlackboxTime ( bookmarkTimes [ 3 ] ) ;
989+ invalidateGraph ( ) ;
990+ } ) ;
991+
992+ $ ( '#status-bar .bookmark-4' ) . click ( function ( e ) {
993+ setCurrentBlackboxTime ( bookmarkTimes [ 4 ] ) ;
994+ invalidateGraph ( ) ;
995+ } ) ;
996+
997+ $ ( '#status-bar .bookmark-5' ) . click ( function ( e ) {
998+ setCurrentBlackboxTime ( bookmarkTimes [ 5 ] ) ;
999+ invalidateGraph ( ) ;
1000+ } ) ;
1001+
1002+ $ ( '#status-bar .bookmark-6' ) . click ( function ( e ) {
1003+ setCurrentBlackboxTime ( bookmarkTimes [ 6 ] ) ;
1004+ invalidateGraph ( ) ;
1005+ } ) ;
1006+
1007+ $ ( '#status-bar .bookmark-7' ) . click ( function ( e ) {
1008+ setCurrentBlackboxTime ( bookmarkTimes [ 7 ] ) ;
1009+ invalidateGraph ( ) ;
1010+ } ) ;
1011+
1012+ $ ( '#status-bar .bookmark-8' ) . click ( function ( e ) {
1013+ setCurrentBlackboxTime ( bookmarkTimes [ 8 ] ) ;
1014+ invalidateGraph ( ) ;
1015+ } ) ;
1016+
1017+ $ ( '#status-bar .bookmark-9' ) . click ( function ( e ) {
1018+ setCurrentBlackboxTime ( bookmarkTimes [ 9 ] ) ;
1019+ invalidateGraph ( ) ;
1020+ } ) ;
1021+
1022+ $ ( '#status-bar .bookmark-clear' ) . click ( function ( e ) {
1023+ bookmarkTimes = null ;
1024+ for ( var i = 1 ; i <= 9 ; i ++ ) {
1025+ $ ( '#status-bar .bookmark-' + i ) . css ( 'visibility' , 'hidden' ) ;
1026+ }
1027+ $ ( '#status-bar .bookmark-clear' ) . css ( 'visibility' , 'hidden' ) ;
1028+ invalidateGraph ( ) ;
1029+ } ) ;
9571030
9581031 if ( FlightLogVideoRenderer . isSupported ( ) ) {
9591032 $ ( ".btn-video-export" ) . click ( function ( e ) {
@@ -1038,15 +1111,17 @@ function BlackboxLogViewer() {
10381111 case "M" . charCodeAt ( 0 ) :
10391112 if ( e . altKey && hasMarker && hasVideo && hasLog ) { // adjust the video sync offset and remove marker
10401113 try {
1041- setVideoOffset ( videoOffset + ( stringTimetoMsec ( $ ( ".graph-time- marker" ) . val ( ) ) / 1000000 ) , true ) ;
1114+ setVideoOffset ( videoOffset + ( stringTimetoMsec ( $ ( "#status-bar . marker-offset " ) . text ( ) ) / 1000000 ) , true ) ;
10421115 } catch ( e ) {
10431116 console . log ( 'Failed to set video offset' ) ;
10441117 }
10451118 } else { // Add a marker to graph window
10461119 markerTime = currentBlackboxTime ;
1047- $ ( ".graph-time-marker" ) . val ( formatTime ( 0 ) ) ;
1120+ $ ( "#status-bar .marker-offset" ) . text ( 'Marker Offset ' + formatTime ( 0 ) + 'ms' ) ;
1121+
10481122 }
10491123 setMarker ( ! hasMarker ) ;
1124+ $ ( "#status-bar .marker-offset" ) . css ( 'visibility' , ( hasMarker ) ?'visible' :'hidden' ) ;
10501125 invalidateGraph ( ) ;
10511126 e . preventDefault ( ) ;
10521127 break ;
@@ -1084,13 +1159,24 @@ function BlackboxLogViewer() {
10841159 // Special Case : Shift Alt 0 clears all bookmarks
10851160 if ( e . which == 48 ) {
10861161 bookmarkTimes = null ;
1162+ for ( var i = 1 ; i <= 9 ; i ++ ) {
1163+ $ ( '#status-bar .bookmark-' + i ) . css ( 'visibility' , 'hidden' ) ;
1164+ }
1165+ $ ( '#status-bar .bookmark-clear' ) . css ( 'visibility' , 'hidden' ) ;
10871166 } else {
10881167 if ( bookmarkTimes == null ) bookmarkTimes = new Array ( ) ;
10891168 if ( bookmarkTimes [ e . which - 48 ] == null ) {
10901169 bookmarkTimes [ e . which - 48 ] = currentBlackboxTime ; // Save current time to bookmark
10911170 } else {
10921171 bookmarkTimes [ e . which - 48 ] = null ; // clear the bookmark
10931172 }
1173+ $ ( '#status-bar .bookmark-' + ( e . which - 48 ) ) . css ( 'visibility' , ( ( bookmarkTimes [ e . which - 48 ] != null ) ?( 'visible' ) :( 'hidden' ) ) ) ;
1174+ var countBookmarks = 0 ;
1175+ for ( var i = 0 ; i <= 9 ; i ++ ) {
1176+ countBookmarks += ( bookmarkTimes [ i ] != null ) ?1 :0 ;
1177+ }
1178+ $ ( '#status-bar .bookmark-clear' ) . css ( 'visibility' , ( ( countBookmarks > 0 ) ?( 'visible' ) :( 'hidden' ) ) ) ;
1179+
10941180 }
10951181 invalidateGraph ( ) ;
10961182 }
0 commit comments