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