Skip to content

Commit f3723ce

Browse files
committed
add status for refereebox
1 parent 230c93b commit f3723ce

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

assets/client.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,23 @@ class Entry {
220220
}
221221

222222
Calculation() {
223+
if(this.data[0][0] == '0'){
224+
if(this.data[1] == '0'){
225+
document.getElementById("refree").innerHTML = "INIT"
226+
}
227+
if(this.data[1] == '1'){
228+
document.getElementById("refree").innerHTML = "READY"
229+
}
230+
else if(this.data[1] == '2'){
231+
document.getElementById("refree").innerHTML = "SET"
232+
}
233+
else if(this.data[1] == '3'){
234+
document.getElementById("refree").innerHTML = "PLAY"
235+
}
236+
else if(this.data[1] == '4'){
237+
document.getElementById("refree").innerHTML = "FINISH"
238+
}
239+
}
223240
if(this.data[0][0] == '1'){
224241

225242
if(this.statusActive == "on"){

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ <h2 >Robot 5</h2>
452452
return socket;
453453
}
454454
setInterval(function() {
455+
ws.send(JSON.stringify({ Num: 0 })); // get callback for refereebox
455456
ws.send(JSON.stringify({ Num: 1 }));
456457
ws.send(JSON.stringify({ Num: 2 }));
457458
ws.send(JSON.stringify({ Num: 3 }));

source/manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ func WSResponse(conn *websocket.Conn) {
168168

169169
t := time.Now()
170170

171-
if m.Num == 1 {
171+
if m.Num == 0 {
172+
dataResponse = "00," //for referee
173+
dataResponse = dataResponse + strconv.Itoa(*ref)
174+
175+
} else if m.Num == 1 {
172176
var status string
173177

174178
if times.timeR1+timeout > t.Unix() {

0 commit comments

Comments
 (0)