#constant MSG_START_ACT 157\r
#constant MSG_COLOR 158\r
#constant MSG_INIT 160\r
-#constant MSG_STATUS_REQ 161\r
+#constant MSG_STATUS_REQ 183\r
#constant MSG_RESTART 162\r
+#constant MSG_SWITCH_TO_CONTROL_DONE 186\r
\r
#constant COLOR_RED 1\r
#constant COLOR_GREEN 0\r
\r
var msg_buff[MSG_BUFF_LEN];\r
+var msg_rcvd[MSG_BUFF_LEN];\r
var bt_y[20];\r
var bt_x[20];\r
-var out_buff[3];\r
+var out_buff[4];\r
var msg_len;\r
var current_color;\r
var button_color;\r
serout(out_buff[idx]);\r
idx++;\r
until(idx==msg_len)\r
-\r
endfunc\r
\r
func act_lift_calib()\r
out_buff[0]:=MSG_START;\r
out_buff[1]:=MSG_COLOR;\r
out_buff[2]:=current_color;\r
- out_buff[3]:=MSG_TERM_LF;\r
+ out_buff[3]:=10;\r
msg_len:=4;\r
send_msg();\r
endfunc\r
endif\r
endfunc\r
\r
+func load_status()\r
+ file_Run("STATUS.4XE",0);\r
+endfunc\r
+\r
+func process_msg()\r
+ if(msg_rcvd[0]==200)\r
+ load_status();\r
+ endif\r
+endfunc\r
+\r
func get_msg()\r
+ var in, idx, bad, msg_len;\r
+\r
+ idx:=0;\r
+ bad:=0; \r
+ in:=serin();\r
+ \r
+ repeat\r
+ in:=serin();\r
+ if(in!=-1)\r
+ msg_rcvd[idx] := in;\r
+ idx++;\r
+ else\r
+ break;\r
+ endif\r
+ forever\r
+\r
+ msg_len := idx;\r
+ com_Init(msg_buff, MSG_BUFF_LEN, ':');\r
\r
+ process_msg();\r
+ return 0; \r
endfunc\r
func main()\r
- setbaud(6); // 9600 baud\r
+ var idx;\r
+ setbaud(4); // 9600 baud\r
com_Init(msg_buff, MSG_BUFF_LEN, ':');\r
\r
+ out_buff[0]:=MSG_START;\r
+ out_buff[1]:=MSG_SWITCH_TO_CONTROL_DONE;\r
+ out_buff[2]:=MSG_TERM_LF;\r
+ idx:=0;\r
+ repeat\r
+ serout(out_buff[idx]);\r
+ idx++;\r
+ until(idx==3) \r
+\r
touch_Set(TOUCH_ENABLE); // enable TS\r
touch_Set(TOUCH_REGIONDEFAULT); // reset touch area to fullscreen\r
\r
endfunc\r
\r
\r
+\r
+\r
+\r
+\r
+\r
#constant MSG_START 150\r
#constant MSG_TERM_LF 10\r
\r
+#constant MSG_SWITCH_TO_STATUS_DONE 185\r
+\r
#constant MSG_STATUS 'S'\r
// Indices to the voltage_status array
#constant HW_STATUS_WARN 2\r
\r
#constant MSG_CONTROL_REQ 184\r
-#constant MSG_CONTROL_REP 186\r
+#constant MSG_SWITCH_REP 200\r
\r
#constant HW1 1\r
#constant HW2 2\r
draw_hw5(hw_status[5]);\r
draw_hw6(hw_status[6]);\r
draw_hw6a(hw_status[7]);\r
+endfunc\r
+\r
+func load_control()\r
+ clear_screen();\r
+ file_Run("CTRL.4XE",0);\r
endfunc
/*Process the message received on serial line*/
update_lift();\r
update_pucks();\r
update_hw();\r
+ \r
+ \r
endif\r
- if(msg_rcvd[0]==MSG_CONTROL_REP)\r
+ if(msg_rcvd[0]==200)\r
+ load_control();\r
endif\r
endfunc
\r
endfunc\r
-func main()
- setbaud(6); // 9600 baud
- com_Init(msg_buff, MSG_BUFF_LEN, ':');
+func main()\r
+ var idx;
+ setbaud(4); // 9600 baud
+ com_Init(msg_buff, MSG_BUFF_LEN, ':');\r
+ \r
+ out_buff[0]:=MSG_START;\r
+ out_buff[1]:=MSG_SWITCH_TO_STATUS_DONE;\r
+ out_buff[2]:=MSG_TERM_LF;\r
+ idx:=0;\r
+ repeat\r
+ serout(out_buff[idx]);\r
+ idx++;\r
+ until(idx==3) \r
+
touch_Set(TOUCH_ENABLE); // enable TS
touch_Set(TOUCH_REGIONDEFAULT); // reset touch area to fullscreen\r
\r
\r
\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r