Skip to content

Commit 7e9ceab

Browse files
author
benny.saxen
committed
bugs corrected
1 parent 86742e5 commit 7e9ceab

12 files changed

+312
-497
lines changed

default.conf

Lines changed: 0 additions & 6 deletions
This file was deleted.

help.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
[Run Mode]
22
Goto:
3+
arrow up step forward
4+
arrow down step backward
5+
arrow right loop forward
6+
arrow left loop backward
7+
38
f step forward
49
b step backward
510
r loop forward
6-
o loop reset
711
p loop backward
12+
13+
o loop reset
814
a goto first step
915
z goto last step
1016
t step to next analogRead/digitalRead
@@ -15,13 +21,12 @@ Animation(realtime time delay):
1521
G step through scenario
1622

1723
Scenario breakpoints:
18-
y View Scenario Breakpoints
19-
x Expanded view of Scenario Breakpoints
24+
c view configuration parameters
25+
y view Scenario Breakpoints
26+
x expanded view of Scenario Breakpoints
2027
v set value analogRead/digitalRead
2128
Current step must be one step before Read
2229
Use 't' to step between Read events.
23-
i set Scenario Breakpoint at current step
24-
Example: a 4 323 (analog pin=4 value=323)
2530

2631
Window:
2732
w toggles window layout mode.

help_command.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,15 @@ list List available sketches (max 100).
77

88
<n> Select sketch according to number in list
99

10-
run <steps> Step until step=<steps>
11-
If no steps given - enter Run Mode
12-
13-
loop <loop> Step until loop <loop>
14-
15-
reset Reset simulation. Current step set to 0
16-
17-
add <...> Add pin-value-point in scenario
18-
Ex. add a 3 100 650
19-
Analog Pin 3 will read values 650
20-
from step 100 and forward.
21-
22-
rem <...> Remove pin-value-point in scenario
23-
Ex. rem d 7 50
24-
Digital Pin 7 will no longer read values
25-
specified at step 50
10+
run Enter Run Mode
2611

2712
info <par> Show info about <par>
2813
- scen Show scenario data
2914
- conf Display configuration
3015
- loop Show loop information
3116
- error Show Servuino errors
3217
- g++ Show compilation errors
33-
- help Show command information
3418

35-
sketch Show current sketch
19+
sketch Show selected sketch
3620

3721
help Show this information

settings.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Simuino Setting Mon Oct 28 21:23:20 2013
2-
SKETCH: helloWorld_UNO.ino
1+
# Simuino Setting Wed Oct 30 19:48:20 2013
2+
SKETCH: sketchbook/helloWorld_UNO.ino

simuino.c

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ int currentValueD[MAX_PIN_DIGITAL_MEGA];
7474
int currentValueA[MAX_PIN_ANALOG_MEGA];
7575
char g_currentSketch[80];
7676
int g_currentSketchStatus = SO_VOID;
77+
int g_runDelay = 0; //millisec
7778

7879

7980
// Limits
@@ -263,7 +264,7 @@ int runStep(int dir)
263264
// Realtime animation
264265
temp = stepDelay[currentStep];
265266
if(temp > 0)microDelay(temp);
266-
267+
iDelay(g_runDelay);
267268
return(0);
268269
}
269270

@@ -286,6 +287,7 @@ int goStep(int step)
286287
//strcpy(stemp,status[currentStep]);
287288
displayStatus();
288289
unoInfo();
290+
iDelay(g_runDelay);
289291
return(0);
290292
}
291293

@@ -515,6 +517,8 @@ void openCommand()
515517
}
516518
else if(strstr(sstr,"list"))
517519
{
520+
sprintf(syscom,"ls sketchbook/*.ino > %s;",fileProjList);
521+
x=system(syscom);
518522
readMsg(fileProjList);
519523
}
520524
else if(strstr(sstr,"sketch"))
@@ -576,48 +580,21 @@ void openCommand()
576580

577581
else if(strstr(sstr,"sav")) //save config
578582
{
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+
589584
}
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)
611588
{
612589
confWinMode = atoi(command[1]);
613590
if(confWinMode > WIN_MODES)confWinMode = 0;
614591
init(confWinMode);
615592
unoInfo();
616593
}
617-
}
618-
else if(strstr(sstr,"loop"))
594+
}
595+
else if(strstr(sstr,"loop"))
619596
{
620-
if(n == 2)loop = atoi(command[1]);
597+
if(n == 2)loop = atoi(command[1]);
621598
loop = checkRange(HEAL,"loop",loop);
622599
runLoops(loop);
623600
}
@@ -700,26 +677,25 @@ void runMode(int stop)
700677
{
701678
if(stop > g_steps)stop = g_steps;
702679
//if(stop > currentStep)
703-
runAll(stop);
680+
runAll(stop);
704681
return;
705682
}
706683

707684
putMsg(3,"Run Mode. Press h for help.");
708685

709686
while(1)
710687
{
688+
if(g_debug == 1)
689+
readFile(g_currentSketch,g_lineSketch[currentStep]);
690+
711691
anyErrors();
712692
if(g_silent==S_NO )mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
713693
if(g_silent==S_YES)mvwprintw(uno,board_h-2,1,"R%1d<",confWinMode);
714694
unoInfo();
715-
716-
if(g_debug == 1)
717-
readFile(g_currentSketch,g_lineSketch[currentStep]);
718-
719-
695+
720696
ch = getchar();
721697

722-
if (ch=='q')
698+
if (ch=='q')
723699
{
724700
return;
725701
}
@@ -730,7 +706,8 @@ void runMode(int stop)
730706
}
731707
else if (ch=='c')
732708
{
733-
readMsg(currentConf);
709+
sprintf(temp,"Simulation Length: %d\n Delay............: %d ms",confSteps,g_runDelay);
710+
putMsg(2,temp);
734711
}
735712
else if (ch=='e')
736713
{
@@ -748,81 +725,103 @@ void runMode(int stop)
748725
{
749726
readMsg(fileServScenario);
750727
}
751-
else if (ch=='G')
728+
else if (ch=='G')
752729
{
753730
runAll(g_steps);
754731
}
755-
else if (ch=='l')
732+
else if (ch=='l')
756733
{
757734
showLoops();
758735
}
759-
else if (ch=='s')
736+
else if (ch=='s')
760737
{
761738
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+
763745
}
764-
else if (ch=='w')
746+
else if (ch=='w')
765747
{
766748
confWinMode++;
767749
if(confWinMode > WIN_MODES)confWinMode = 0;
768750
init(confWinMode);
769751
mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
770752
unoInfo();
771753
}
772-
else if (ch=='a')
754+
else if (ch=='a')
773755
{
774756
goStep(1);
775757
}
776-
else if (ch=='r')
758+
else if (ch=='r')
777759
{
778760
goStep(loopStep[currentLoop+1]);
779761
}
780-
else if (ch=='o')
762+
else if (ch=='o')
781763
{
782764
goStep(loopStep[currentLoop]);
783765
}
784-
else if (ch=='p')
766+
else if (ch=='p')
785767
{
786768
goStep(loopStep[currentLoop-1]);
787769
}
788-
else if (ch=='z')
770+
else if (ch=='z')
789771
{
790772
goStep(g_steps);
791773
}
792-
else if (ch=='k')
774+
else if (ch=='k')
793775
{
794776
resetSim();
795777
init(confWinMode);
796778
unoInfo();
797779
mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
798780
show(uno);
799781
}
800-
else if (ch=='f')// Up Arrow
782+
else if (ch=='f')// Up Arrow
801783
{
802784
goStep(currentStep+1);
803785
}
804-
else if (ch=='b')// Down Arrow
786+
else if (ch=='b')// Down Arrow
805787
{
806788
goStep(currentStep-1);
807789
}
808-
else if (ch=='R') // Right Arrow
790+
else if (ch=='R') // Right Arrow
809791
{
810792
runLoop(S_FORWARD);
811793
}
812-
else if (ch=='P') // Left Arrow
794+
else if (ch=='P') // Left Arrow
813795
{
814796
runLoop(S_BACKWARD);
815797
}
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')
817815
{
818816
runNextRead();
819817
}
820-
else if (ch=='j')
818+
else if (ch=='j')
821819
{
822820
runPrevRead();
823821
}
824-
else if (ch=='i')
822+
else if (ch=='i')
825823
{
824+
ok = 0;
826825
step = currentStep;
827826
sprintf(temp,"(Step:%d) Enter: d/a pin value (q - cancel)",step);
828827
putMsg(2,temp);
@@ -851,6 +850,7 @@ void runMode(int stop)
851850
g_scenSource = 1;
852851
// steps, source, pintype, pinno, pinvalue, pinstep
853852
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);
854854
tmp=system(syscom);
855855
initSim();
856856
readSketchInfo();
@@ -862,12 +862,13 @@ void runMode(int stop)
862862
else
863863
putMsg(2,"Cancelled!");
864864
}
865-
else if (ch=='v')
865+
else if (ch=='v')
866866
{
867867
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);
869870
putMsg(2,temp);
870-
res = analyzeEvent(simulation[step]);
871+
871872
if(res > 0)
872873
{
873874
wgetstr(uno,temp);

simuino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ int readStatus();
7373
void readSerial();
7474
void readTime();
7575
int goStep(int step);
76+
char *replace_str(char *str, char orig[], char rep[]);

0 commit comments

Comments
 (0)