Podpora pro nahravani skriptu

This commit is contained in:
Petr Baudis 2012-09-25 03:38:19 +02:00
parent 57c0ea70d9
commit 6ff4c2d562
2 changed files with 207 additions and 188 deletions

View file

@ -14,6 +14,7 @@ Public konfigurace_experiment_cas_zhasnuteho_stimulu As Integer
Public konfigurace_experiment_cas_piti As Integer Public konfigurace_experiment_cas_piti As Integer
Public konfigurace_experiment_cas_dalsi_ciklus As Integer Public konfigurace_experiment_cas_dalsi_ciklus As Integer
Public konfigurace_experiment_nahoda As Boolean Public konfigurace_experiment_nahoda As Boolean
Public konfigurace_experiment_skript As New String[]
Public konfigurace_experiment_neopakovat As Boolean Public konfigurace_experiment_neopakovat As Boolean
Public konfigurace_experiment_vypni_stimul As Boolean Public konfigurace_experiment_vypni_stimul As Boolean
Public konfigurace_experiment_vypni_stimul_pauza_enable As Boolean Public konfigurace_experiment_vypni_stimul_pauza_enable As Boolean
@ -1154,6 +1155,15 @@ Dim arr_strings As String[]
SysLogWrite("PARAMETRY_OBNOVENY") SysLogWrite("PARAMETRY_OBNOVENY")
End End
Public Sub BtnNahrajSkript_Click()
SysLogWrite("NAHRANI_SKRIPTU")
konfigurace_experiment_skript = Split(File.LOAD("/ratbox/skripty/" & TxtSkriptNazev.Text), "\n")
'konfigurace_experiment_skript contains one extra element at the end because the last line is terminated by a newline character
konfigurace_pocet_cyklu = konfigurace_experiment_skript.Length - 1
TxtPocetCiklu.Text = Str(konfigurace_pocet_cyklu)
SysLogWrite("SKRIPT_NAHRAN")
End
Public Sub TmrCasovac_Timer() Public Sub TmrCasovac_Timer()
buffer_casovac = buffer_casovac + 1 buffer_casovac = buffer_casovac + 1
TxtInfoCasovac.text = Str(buffer_casovac) TxtInfoCasovac.text = Str(buffer_casovac)
@ -1337,7 +1347,9 @@ Dim exp_souhrn_odpoved As Integer
TimerExperimentMils.Enabled = True TimerExperimentMils.Enabled = True
exp_genstim: exp_genstim:
ExpLogWrite("CYKLUS" & ";" & tmp_cyklus & ";" & "NULL" & ";" & "NaN") ExpLogWrite("CYKLUS" & ";" & tmp_cyklus & ";" & "NULL" & ";" & "NaN")
If konfigurace_experiment_nahoda = True Then If konfigurace_experiment_skript.Length > 0 Then
tmp_stimul_idx = CInt(Val(konfigurace_experiment_skript[tmp_cyklus]))
Else If konfigurace_experiment_nahoda = True Then
tmp_stimul_idx = Rnd(1, 7) tmp_stimul_idx = Rnd(1, 7)
'ExpLogWrite("NAHODNY_STIMUL" & ";" & tmp_stimul_idx & ";" & "NULL" & ";" & "NaN") 'ExpLogWrite("NAHODNY_STIMUL" & ";" & tmp_stimul_idx & ";" & "NULL" & ";" & "NaN")
Else Else

View file

@ -1,4 +1,5 @@
# Gambas Form File 3.0 # Gambas Form File 3.0
{ Form Form { Form Form
Move(0,0,1400,798) Move(0,0,1400,798)
#Scaled = False #Scaled = False
@ -13,7 +14,6 @@
Alignment = Align.Center Alignment = Align.Center
} }
{ TimerSystime #Timer { TimerSystime #Timer
#MoveScaled(0,0)
Enabled = True Enabled = True
Delay = 250 Delay = 250
} }
@ -333,13 +333,13 @@
Alignment = Align.Center Alignment = Align.Center
} }
{ Label23 Label { Label23 Label
Move(126,378,63,49) Move(144,368,63,49)
Font = Font["Bold,+2"] Font = Font["Bold,+2"]
Text = ("0") Text = ("0")
Alignment = Align.Center Alignment = Align.Center
} }
{ TmrCasovac #Timer { TmrCasovac #Timer
#MoveScaled(1,1) #Move(8,8)
} }
{ TxtInfoTimeout TextBox { TxtInfoTimeout TextBox
Move(532,7,70,21) Move(532,7,70,21)
@ -359,14 +359,14 @@
Text = ("Pripoj / Odpoj") Text = ("Pripoj / Odpoj")
} }
{ SerialPort1 #SerialPort { SerialPort1 #SerialPort
#MoveScaled(2,2) #Move(16,16)
} }
{ Separator1 Separator { Separator1 Separator
Move(14,35,1218,7) Move(14,35,1218,7)
Foreground = &H000000& Foreground = &H000000&
} }
{ Separator2 Separator { Separator2 Separator
Move(7,357,1218,21) Move(8,344,1218,21)
} }
{ Separator3 Separator { Separator3 Separator
Move(700,49,7,301) Move(700,49,7,301)
@ -495,11 +495,11 @@
Value = CheckBox.True Value = CheckBox.True
} }
{ ChkExpNahoda CheckBox { ChkExpNahoda CheckBox
Move(14,406,98,21) Move(16,392,98,21)
Text = ("NAHODNE") Text = ("NAHODNE")
} }
{ ChkExpNeopakovat CheckBox { ChkExpNeopakovat CheckBox
Move(14,378,119,21) Move(16,368,128,24)
Text = ("NEOPAKOVAT") Text = ("NEOPAKOVAT")
} }
{ BtnOpenDor Button { BtnOpenDor Button
@ -540,7 +540,7 @@
} }
{ Label32 Label { Label32 Label
Move(728,49,140,42) Move(728,49,140,42)
Text = ("Manu\xC3\xA1ln\xC3\xAD ovl\xC3\xA1d\xC3\xA1n\xC3\xAD\naparatury") Text = ("Manuální ovládání\naparatury")
Alignment = Align.Center Alignment = Align.Center
} }
{ Separator4 Separator { Separator4 Separator
@ -601,7 +601,7 @@
} }
{ Label34 Label { Label34 Label
Move(896,49,175,21) Move(896,49,175,21)
Text = ("N\xC3\xA1zev konfigurace:") Text = ("Název konfigurace:")
Alignment = Align.Center Alignment = Align.Center
} }
{ BtnNahrajKonfiguraci Button { BtnNahrajKonfiguraci Button
@ -613,15 +613,15 @@
Text = ("UPLATNI PARAMETRY") Text = ("UPLATNI PARAMETRY")
} }
{ TxtSessionID TextBox { TxtSessionID TextBox
Move(616,385,126,21) Move(736,392,126,21)
Text = ("SessionID") Text = ("SessionID")
} }
{ TxtExperimentID TextBox { TxtExperimentID TextBox
Move(392,385,112,21) Move(608,392,112,21)
Text = ("ExperimentID") Text = ("ExperimentID")
} }
{ TmrTimeout #Timer { TmrTimeout #Timer
#MoveScaled(3,3) #Move(24,24)
} }
{ ListBox1 ListBox { ListBox1 ListBox
Move(1085,49,147,259) Move(1085,49,147,259)
@ -640,7 +640,7 @@
Alignment = Align.Center Alignment = Align.Center
} }
{ TimerExperimentMils #Timer { TimerExperimentMils #Timer
#MoveScaled(4,4) #Move(32,32)
Delay = 10 Delay = 10
} }
{ PictureLogo1 PictureBox { PictureLogo1 PictureBox
@ -649,30 +649,30 @@
} }
{ Label38 Label { Label38 Label
Move(910,238,161,42) Move(910,238,161,42)
Text = ("Tom\xC3\xA1\xC5\xA1 Suchan 2011\ntomsuch@tomsuch.net") Text = ("Tomáš Suchan 2011\ntomsuch@tomsuch.net")
Alignment = Align.Center Alignment = Align.Center
} }
{ Label39 Label { Label39 Label
Move(518,385,91,21) Move(752,368,91,21)
Text = ("SESSION ID:") Text = ("SESSION:")
Alignment = Align.Center Alignment = Align.Center
} }
{ Label40 Label { Label40 Label
Move(259,385,126,21) Move(600,368,126,21)
Text = ("EXPERIMENT ID:") Text = ("EXPERIMENT:")
Alignment = Align.Center Alignment = Align.Center
} }
{ Label37 Label { Label37 Label
Move(749,385,91,21) Move(888,368,91,21)
Text = ("OBJECT ID:") Text = ("OBJECT:")
Alignment = Align.Center Alignment = Align.Center
} }
{ TxtOjectID TextBox { TxtOjectID TextBox
Move(847,385,126,21) Move(872,392,126,21)
Text = ("ObjectID") Text = ("ObjectID")
} }
{ TimerMilis #Timer { TimerMilis #Timer
#MoveScaled(5,5) #Move(40,40)
Delay = 10 Delay = 10
} }
{ Label41 Label { Label41 Label
@ -749,4 +749,11 @@
Move(770,448,28,28) Move(770,448,28,28)
Text = ("--->") Text = ("--->")
} }
{ TxtSkriptNazev TextBox
Move(216,368,175,21)
}
{ BtnNahrajSkript Button
Move(216,392,175,21)
Text = ("NAHRAJ SKRIPT")
}
} }