@@ -464,22 +464,27 @@ TABS.receiver.initialize = function (callback) {
464464 }
465465
466466 function update_ui ( ) {
467- // update bars with latest data
468- for ( var i = 0 ; i < RC . active_channels ; i ++ ) {
469- meter_fill_array [ i ] . css ( 'width' , ( ( RC . channels [ i ] - meter_scale . min ) / ( meter_scale . max - meter_scale . min ) * 100 ) . clamp ( 0 , 100 ) + '%' ) ;
470- meter_label_array [ i ] . text ( RC . channels [ i ] ) ;
471- }
472467
473- // push latest data to the main array
474- for ( var i = 0 ; i < RC . active_channels ; i ++ ) {
475- RX_plot_data [ i ] . push ( [ samples , RC . channels [ i ] ] ) ;
476- }
468+ if ( RC . active_channels > 0 ) {
477469
478- // Remove old data from array
479- while ( RX_plot_data [ 0 ] . length > 300 ) {
480- for ( var i = 0 ; i < RX_plot_data . length ; i ++ ) {
481- RX_plot_data [ i ] . shift ( ) ;
470+ // update bars with latest data
471+ for ( var i = 0 ; i < RC . active_channels ; i ++ ) {
472+ meter_fill_array [ i ] . css ( 'width' , ( ( RC . channels [ i ] - meter_scale . min ) / ( meter_scale . max - meter_scale . min ) * 100 ) . clamp ( 0 , 100 ) + '%' ) ;
473+ meter_label_array [ i ] . text ( RC . channels [ i ] ) ;
474+ }
475+
476+ // push latest data to the main array
477+ for ( var i = 0 ; i < RC . active_channels ; i ++ ) {
478+ RX_plot_data [ i ] . push ( [ samples , RC . channels [ i ] ] ) ;
482479 }
480+
481+ // Remove old data from array
482+ while ( RX_plot_data [ 0 ] . length > 300 ) {
483+ for ( var i = 0 ; i < RX_plot_data . length ; i ++ ) {
484+ RX_plot_data [ i ] . shift ( ) ;
485+ }
486+ }
487+
483488 }
484489
485490 // update required parts of the plot
0 commit comments