@@ -74,6 +74,7 @@ int currentValueD[MAX_PIN_DIGITAL_MEGA];
74
74
int currentValueA [MAX_PIN_ANALOG_MEGA ];
75
75
char g_currentSketch [80 ];
76
76
int g_currentSketchStatus = SO_VOID ;
77
+ int g_runDelay = 0 ; //millisec
77
78
78
79
79
80
// Limits
@@ -263,7 +264,7 @@ int runStep(int dir)
263
264
// Realtime animation
264
265
temp = stepDelay [currentStep ];
265
266
if (temp > 0 )microDelay (temp );
266
-
267
+ iDelay ( g_runDelay );
267
268
return (0 );
268
269
}
269
270
@@ -286,6 +287,7 @@ int goStep(int step)
286
287
//strcpy(stemp,status[currentStep]);
287
288
displayStatus ();
288
289
unoInfo ();
290
+ iDelay (g_runDelay );
289
291
return (0 );
290
292
}
291
293
@@ -515,6 +517,8 @@ void openCommand()
515
517
}
516
518
else if (strstr (sstr ,"list" ))
517
519
{
520
+ sprintf (syscom ,"ls sketchbook/*.ino > %s;" ,fileProjList );
521
+ x = system (syscom );
518
522
readMsg (fileProjList );
519
523
}
520
524
else if (strstr (sstr ,"sketch" ))
@@ -576,48 +580,21 @@ void openCommand()
576
580
577
581
else if (strstr (sstr ,"sav" )) //save config
578
582
{
579
- if (n == 2 )
580
- {
581
- strcpy (currentConf ,command [1 ]);
582
- strcat (currentConf ,".ino" );
583
-
584
- }
585
- saveSetting ();
586
- readMsg (currentConf );
587
- sprintf (syscom ,"ls *.ino > %s;" ,fileProjList );
588
- x = system (syscom );
583
+
589
584
}
590
- else if (strstr (sstr ,"del" )) //delete config
591
- {
592
- if (n == 2 )
593
- {
594
- strcpy (currentConf ,command [1 ]);
595
- strcat (currentConf ,".ino" );
596
-
597
- }
598
- if (strstr (currentConf ,"default" ) == NULL )
599
- {
600
- sprintf (syscom ,"rm %s;" ,currentConf );
601
- x = system (syscom );
602
- sprintf (syscom ,"ls *.ino > %s;" ,fileProjList );
603
- x = system (syscom );
604
- readMsg (fileProjList );
605
- strcpy (currentConf ,fileDefault );
606
- }
607
- }
608
- else if (strstr (sstr ,"win" )) //windows layout
609
- {
610
- if (n == 2 )
585
+ else if (strstr (sstr ,"win" )) //windows layout
586
+ {
587
+ if (n == 2 )
611
588
{
612
589
confWinMode = atoi (command [1 ]);
613
590
if (confWinMode > WIN_MODES )confWinMode = 0 ;
614
591
init (confWinMode );
615
592
unoInfo ();
616
593
}
617
- }
618
- else if (strstr (sstr ,"loop" ))
594
+ }
595
+ else if (strstr (sstr ,"loop" ))
619
596
{
620
- if (n == 2 )loop = atoi (command [1 ]);
597
+ if (n == 2 )loop = atoi (command [1 ]);
621
598
loop = checkRange (HEAL ,"loop" ,loop );
622
599
runLoops (loop );
623
600
}
@@ -700,26 +677,25 @@ void runMode(int stop)
700
677
{
701
678
if (stop > g_steps )stop = g_steps ;
702
679
//if(stop > currentStep)
703
- runAll (stop );
680
+ runAll (stop );
704
681
return ;
705
682
}
706
683
707
684
putMsg (3 ,"Run Mode. Press h for help." );
708
685
709
686
while (1 )
710
687
{
688
+ if (g_debug == 1 )
689
+ readFile (g_currentSketch ,g_lineSketch [currentStep ]);
690
+
711
691
anyErrors ();
712
692
if (g_silent == S_NO )mvwprintw (uno ,board_h - 2 ,1 ,"R%1d>" ,confWinMode );
713
693
if (g_silent == S_YES )mvwprintw (uno ,board_h - 2 ,1 ,"R%1d<" ,confWinMode );
714
694
unoInfo ();
715
-
716
- if (g_debug == 1 )
717
- readFile (g_currentSketch ,g_lineSketch [currentStep ]);
718
-
719
-
695
+
720
696
ch = getchar ();
721
697
722
- if (ch == 'q' )
698
+ if (ch == 'q' )
723
699
{
724
700
return ;
725
701
}
@@ -730,7 +706,8 @@ void runMode(int stop)
730
706
}
731
707
else if (ch == 'c' )
732
708
{
733
- readMsg (currentConf );
709
+ sprintf (temp ,"Simulation Length: %d\n Delay............: %d ms" ,confSteps ,g_runDelay );
710
+ putMsg (2 ,temp );
734
711
}
735
712
else if (ch == 'e' )
736
713
{
@@ -748,81 +725,103 @@ void runMode(int stop)
748
725
{
749
726
readMsg (fileServScenario );
750
727
}
751
- else if (ch == 'G' )
728
+ else if (ch == 'G' )
752
729
{
753
730
runAll (g_steps );
754
731
}
755
- else if (ch == 'l' )
732
+ else if (ch == 'l' )
756
733
{
757
734
showLoops ();
758
735
}
759
- else if (ch == 's' )
736
+ else if (ch == 's' )
760
737
{
761
738
g_debug ++ ;
762
- if (g_debug > 1 )g_debug = 0 ;
739
+ if (g_debug > 1 )
740
+ {
741
+ g_debug = 0 ;
742
+ putMsg (2 ,"Run Mode. Press h for help." );
743
+ }
744
+
763
745
}
764
- else if (ch == 'w' )
746
+ else if (ch == 'w' )
765
747
{
766
748
confWinMode ++ ;
767
749
if (confWinMode > WIN_MODES )confWinMode = 0 ;
768
750
init (confWinMode );
769
751
mvwprintw (uno ,board_h - 2 ,1 ,"R%1d>" ,confWinMode );
770
752
unoInfo ();
771
753
}
772
- else if (ch == 'a' )
754
+ else if (ch == 'a' )
773
755
{
774
756
goStep (1 );
775
757
}
776
- else if (ch == 'r' )
758
+ else if (ch == 'r' )
777
759
{
778
760
goStep (loopStep [currentLoop + 1 ]);
779
761
}
780
- else if (ch == 'o' )
762
+ else if (ch == 'o' )
781
763
{
782
764
goStep (loopStep [currentLoop ]);
783
765
}
784
- else if (ch == 'p' )
766
+ else if (ch == 'p' )
785
767
{
786
768
goStep (loopStep [currentLoop - 1 ]);
787
769
}
788
- else if (ch == 'z' )
770
+ else if (ch == 'z' )
789
771
{
790
772
goStep (g_steps );
791
773
}
792
- else if (ch == 'k' )
774
+ else if (ch == 'k' )
793
775
{
794
776
resetSim ();
795
777
init (confWinMode );
796
778
unoInfo ();
797
779
mvwprintw (uno ,board_h - 2 ,1 ,"R%1d>" ,confWinMode );
798
780
show (uno );
799
781
}
800
- else if (ch == 'f' )// Up Arrow
782
+ else if (ch == 'f' )// Up Arrow
801
783
{
802
784
goStep (currentStep + 1 );
803
785
}
804
- else if (ch == 'b' )// Down Arrow
786
+ else if (ch == 'b' )// Down Arrow
805
787
{
806
788
goStep (currentStep - 1 );
807
789
}
808
- else if (ch == 'R' ) // Right Arrow
790
+ else if (ch == 'R' ) // Right Arrow
809
791
{
810
792
runLoop (S_FORWARD );
811
793
}
812
- else if (ch == 'P' ) // Left Arrow
794
+ else if (ch == 'P' ) // Left Arrow
813
795
{
814
796
runLoop (S_BACKWARD );
815
797
}
816
- else if (ch == 't' )
798
+ else if (ch == 'A' )// Up Arrow
799
+ {
800
+ goStep (currentStep + 1 );
801
+ }
802
+ else if (ch == 'B' )// Down Arrow
803
+ {
804
+ goStep (currentStep - 1 );
805
+ }
806
+ else if (ch == 'C' ) // Right Arrow
807
+ {
808
+ runLoop (S_FORWARD );
809
+ }
810
+ else if (ch == 'D' ) // Left Arrow
811
+ {
812
+ runLoop (S_BACKWARD );
813
+ }
814
+ else if (ch == 't' )
817
815
{
818
816
runNextRead ();
819
817
}
820
- else if (ch == 'j' )
818
+ else if (ch == 'j' )
821
819
{
822
820
runPrevRead ();
823
821
}
824
- else if (ch == 'i' )
822
+ else if (ch == 'i' )
825
823
{
824
+ ok = 0 ;
826
825
step = currentStep ;
827
826
sprintf (temp ,"(Step:%d) Enter: d/a pin value (q - cancel)" ,step );
828
827
putMsg (2 ,temp );
@@ -851,6 +850,7 @@ void runMode(int stop)
851
850
g_scenSource = 1 ;
852
851
// steps, source, pintype, pinno, pinvalue, pinstep
853
852
sprintf (syscom ,"cd servuino;./servuino %d %d %d %d %d %d %d;" ,confSteps ,g_scenSource ,g_pinType ,g_pinNo ,x ,currentStep ,S_ADD );
853
+ putMsg (2 ,syscom );
854
854
tmp = system (syscom );
855
855
initSim ();
856
856
readSketchInfo ();
@@ -862,12 +862,13 @@ void runMode(int stop)
862
862
else
863
863
putMsg (2 ,"Cancelled!" );
864
864
}
865
- else if (ch == 'v' )
865
+ else if (ch == 'v' )
866
866
{
867
867
step = currentStep ;
868
- sprintf (temp ," Enter value to be read at step %d (q - cancel)" ,step );
868
+ res = analyzeEvent (simulation [step ]);
869
+ sprintf (temp ," Pin:%d Enter value to be read at step %d (q - cancel)" ,g_pinNo ,step );
869
870
putMsg (2 ,temp );
870
- res = analyzeEvent ( simulation [ step ]);
871
+
871
872
if (res > 0 )
872
873
{
873
874
wgetstr (uno ,temp );
0 commit comments