@@ -441,8 +441,14 @@ uploadDebugBtn.onchange = function() {
441
441
// split the data into lines
442
442
const lines = data . split ( '\n' ) ;
443
443
444
+ // get constants from the first line
445
+ const firstLine = lines [ 0 ] . split ( ', ' ) ;
446
+ const maxVel = parseFloat ( firstLine [ 0 ] ) ;
447
+ const trackWidth = parseFloat ( firstLine [ 1 ] ) ;
448
+ debugData = new DebugDataParams ( maxVel , trackWidth ) ;
449
+
444
450
// loop to get path points
445
- let i = 0 ;
451
+ let i = 1 ;
446
452
while ( lines [ i ] . substr ( 0 , 5 ) != 'debug' ) {
447
453
const line = lines [ i ] . split ( ', ' ) ;
448
454
const x = parseFloat ( line [ 0 ] ) ;
@@ -486,9 +492,9 @@ uploadDebugBtn.onchange = function() {
486
492
// render the debug data
487
493
debugDataTime = 0 ;
488
494
debugTimeSlider . value = 0 ;
495
+ renderGraphs ( ) ;
489
496
renderField ( ) ;
490
497
renderDebug ( ) ;
491
- debugDataTime -- ;
492
498
debugTimeSlider . value = debugDataTime ;
493
499
} ;
494
500
reader . readAsText ( this . files [ this . files . length - 1 ] ) ;
@@ -501,6 +507,7 @@ uploadDebugBtn.onchange = function() {
501
507
modeBtn . onclick = function ( ) {
502
508
const cols = document . getElementsByClassName ( 'sliderContainer' ) ;
503
509
const cols2 = document . getElementsByClassName ( 'debugContainer' ) ;
510
+ const cols3 = document . getElementsByClassName ( 'graph' ) ;
504
511
if ( cols [ 0 ] . style . display === 'none' ) {
505
512
mode = 0 ;
506
513
// set the interval on the render function
@@ -515,6 +522,10 @@ modeBtn.onclick = function() {
515
522
for ( i = 0 ; i < cols2 . length ; i ++ ) {
516
523
cols2 [ i ] . style . display = 'none' ;
517
524
}
525
+ // hide graphs
526
+ for ( i = 0 ; i < cols3 . length ; i ++ ) {
527
+ cols3 [ i ] . style . display = 'none' ;
528
+ }
518
529
} else {
519
530
mode = 1 ;
520
531
// clear the interval on render
@@ -529,6 +540,10 @@ modeBtn.onclick = function() {
529
540
for ( i = 0 ; i < cols2 . length ; i ++ ) {
530
541
cols2 [ i ] . style . display = 'flex' ;
531
542
}
543
+ // show graphs
544
+ for ( i = 0 ; i < cols3 . length ; i ++ ) {
545
+ cols3 [ i ] . style . display = 'flex' ;
546
+ }
532
547
}
533
548
} ;
534
549
@@ -539,11 +554,13 @@ modeBtn.onclick = function() {
539
554
rewindBtn . onclick = function ( ) {
540
555
if ( debugDataTime > 0 ) {
541
556
debugDataTime -- ;
557
+ if ( debugDataTime == 19 ) {
558
+ debugDataTime -- ;
559
+ }
542
560
debugTimeSlider . value = debugDataTime ;
561
+ renderGraphs ( ) ;
543
562
renderField ( ) ;
544
563
renderDebug ( ) ;
545
- debugDataTime -- ;
546
- debugTimeSlider . value -- ;
547
564
}
548
565
} ;
549
566
@@ -554,7 +571,7 @@ rewindBtn.onclick = function() {
554
571
pauseBtn . onclick = function ( ) {
555
572
debugRun = ! debugRun ;
556
573
if ( debugRun == true ) {
557
- if ( debugDataTime == debugDataList . length - 1 ) {
574
+ if ( debugDataTime == debugDataList . length ) {
558
575
debugDataTime = 0 ;
559
576
}
560
577
clearInterval ( intervalId ) ;
@@ -569,13 +586,12 @@ pauseBtn.onclick = function() {
569
586
* @brief fast forward button pressed
570
587
*/
571
588
forwardBtn . onclick = function ( ) {
572
- if ( debugDataTime < debugDataList . length - 1 ) {
589
+ if ( debugDataTime < debugDataList . length - 1 ) {
573
590
debugDataTime ++ ;
574
591
debugTimeSlider . value = debugDataTime ;
592
+ renderGraphs ( ) ;
575
593
renderField ( ) ;
576
594
renderDebug ( ) ;
577
- debugDataTime -- ;
578
- debugTimeSlider . value -- ;
579
595
}
580
596
} ;
581
597
@@ -586,9 +602,8 @@ forwardBtn.onclick = function() {
586
602
debugTimeSlider . oninput = function ( ) {
587
603
debugDataTime = this . value ;
588
604
if ( debugSet == true ) {
605
+ renderGraphs ( ) ;
589
606
renderField ( ) ;
590
607
renderDebug ( ) ;
591
- debugDataTime -- ;
592
- debugTimeSlider . value = debugDataTime ;
593
608
}
594
609
} ;
0 commit comments