added more functionality when connected to the base station

This commit is contained in:
Dorian Zedler 2018-09-23 19:31:10 +02:00
parent b93b598c80
commit 0235cfe8f5

View file

@ -135,8 +135,6 @@ Window {
else if(type === "raw"){
return(time)
}
}
}
@ -147,17 +145,28 @@ Window {
interval: 1
onTriggered: {
if(root.state === "RUNNING"){
var baseReactTime = parseInt(baseConn.sendCommand("GET_REACTTIME"))
if(baseReactTime !== 0){
root.last_run.react_time = baseReactTime
}
time.text = baseConn.getTime("readable") + " sec"
if(baseConn.sendCommand("GET_TIMER_STATE") === "STOPPED"){
root.stop("manual")
}
}
if(root.state === "STARTING"){
if(baseConn.sendCommand("GET_TIMER_STATE") === "RUNNING"){
var baseReactTime = parseInt(baseConn.sendCommand("GET_REACTTIME"))
if(baseReactTime !== 0){
root.last_run.react_time = baseReactTime
}
var baseState = baseConn.sendCommand("GET_TIMER_STATE")
if(baseState === "RUNNING"){
root.state = "RUNNING";
}
else if(baseState === "STOPPED"){
root.state = "STOPPED"
}
}
start()
}
}
@ -777,6 +786,7 @@ Window {
root.stoppedTime = baseConn.getTime("raw")
time.text = (root.stoppedTime / 1000).toFixed(3) + " sec"
baseConn.sendCommand("CMD_STOP_TIMER")
root.state = "STOPPED"
return
}
@ -787,6 +797,7 @@ Window {
break
case "false":
//the cancel button was pressed
root.last_run.reaction_time = parseInt(baseConn.sendCommand("GET_REACTTIME"))
root.stoppedTime = 0
time.text = "false start"
root.state = "STOPPED"