//#inherit "4DGL-System.fnc"
\r
#constant MSG_TERM '~'\r
-#constant MSG_BUFF_LEN 103\r
+#constant MSG_BUFF_LEN 123\r
#constant MSG_POWER 'V'\r
#constant MSG_POSITION 'P'\r
#constant MSG_FSM_STATE 'F'\r
/*Voltage branch OK indication*/
#constant VOLTAGE_OK 1\r
\r
+#constant HW_STATUS_FAILED 0\r
#constant HW_STATUS_OK 1\r
#constant HW_STATUS_WARN 2\r
\r
var voltage_status[4]; // status of individual voltage branches
-var position[8];
+var position[12];
var game_color;
-var fsm_state[20];
-var fsm_state_len;\r
+var act_fsm_state[20];
var move_fsm_state[20];\r
-var move_fsm_state_len;\r
+var main_fsm_state[20];\r
\r
var lift_pos[4];\r
var pucks_nr;\r
lift_pos[3]:='0';\r
pucks_nr:='0';\r
game_conf:='1';\r
+ hw_status[0]:=HW_STATUS_FAILED;\r
+ hw_status[1]:=HW_STATUS_FAILED;\r
+ hw_status[2]:=HW_STATUS_FAILED;\r
+ hw_status[3]:=HW_STATUS_FAILED;\r
+ hw_status[4]:=HW_STATUS_FAILED;\r
+ hw_status[5]:=HW_STATUS_FAILED;\r
+ hw_status[6]:=HW_STATUS_FAILED;\r
+ hw_status[7]:=HW_STATUS_FAILED;\r
endfunc\r
\r
txt_Set(FONT_SIZE, FONT4);
txt_Set(TEXT_COLOUR, WHITE);
txt_MoveCursor(17,0);
- putstr("X,Y: ");
+// putstr("X,Y: ");
putch(position[0]);
putch(position[1]);
putch(position[2]);
putch(position[5]);
putch(position[6]);
putch(position[7]);
+ putch(' ');\r
+ putch(position[8]);\r
+ putch(position[9]);\r
+ putch(position[10]);\r
+\r
putstr(" [m]");
return 0;
endfunc\r
return 0;
endfunc
-func update_fsm_state()
+func update_act_fsm_state()
var idx;
- gfx_Rectangle(0, 70, 239, 99, BLACK);
+ gfx_Rectangle(0, 99, 239, 112, BLACK);
txt_Set(FONT_SIZE, FONT4);
- txt_MoveCursor(5, 0); // move the cursor to line 4, column 5
+ txt_MoveCursor(6, 0); // move the cursor to line 4, column 5
txt_Set(TEXT_COLOUR, WHITE);
idx:=0;
repeat
- putch(fsm_state[idx]);
+ putch(act_fsm_state[idx]);
idx++;
until(idx==20)
return 0;
func update_move_fsm_state()\r
var idx;\r
- gfx_Rectangle(0, 99, 239, 112, BLACK);\r
+ gfx_Rectangle(0, 113, 239, 128, BLACK);\r
txt_Set(FONT_SIZE, FONT4);\r
- txt_MoveCursor(6, 0); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(7, 0); // move the cursor to line 4, column 5\r
txt_Set(TEXT_COLOUR, WHITE);\r
idx:=0;\r
repeat\r
return 0;\r
endfunc\r
\r
+func update_main_fsm_state()\r
+ var idx;\r
+ gfx_Rectangle(0, 70, 239, 99, BLACK);\r
+ txt_Set(FONT_SIZE, FONT4);\r
+ txt_MoveCursor(5, 0); // move the cursor to line 4, column 5\r
+ txt_Set(TEXT_COLOUR, WHITE);\r
+ idx:=0;\r
+ repeat\r
+ putch(main_fsm_state[idx]);\r
+ idx++;\r
+ until(idx==20)\r
+ return 0;\r
+endfunc\r
+\r
func draw_hw1(var status)\r
txt_Set(FONT_SIZE, FONT3);\r
txt_Set(TEXT_COLOUR, WHITE);\r
\r
func draw_hw()\r
txt_Set(FONT_SIZE, FONT3);\r
- txt_MoveCursor(15, 10); // move the cursor to line 4, column 5\r
- txt_Set(TEXT_COLOUR, GRAY);\r
- \r
- putstr("HW STATUS");\r
- \r
+\r
txt_Set(TEXT_COLOUR, WHITE);\r
\r
- draw_hw1(HW_STATUS_OK);\r
- draw_hw2(HW_STATUS_OK);\r
- draw_hw3(HW_STATUS_OK);\r
- draw_hw3a(HW_STATUS_OK);\r
- draw_hw4(HW_STATUS_OK);\r
- draw_hw5(HW_STATUS_OK);\r
- draw_hw6(HW_STATUS_OK);\r
- draw_hw6a(HW_STATUS_OK);\r
+ draw_hw1(hw_status[0]);\r
+ draw_hw2(hw_status[1]);\r
+ draw_hw3(hw_status[2]);\r
+ draw_hw3a(hw_status[3]);\r
+ draw_hw4(hw_status[4]);\r
+ draw_hw5(hw_status[5]);\r
+ draw_hw6(hw_status[6]);\r
+ draw_hw6a(hw_status[7]);\r
return 0;\r
endfunc\r
\r
func update_pucks()\r
- gfx_Rectangle(0, 142, 50, 170, BLACK);\r
+ gfx_Rectangle(0, 170, 50, 190, BLACK);\r
txt_Set(FONT_SIZE, FONT4);\r
- txt_MoveCursor(9, 3); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(11, 3); \r
txt_Set(TEXT_COLOUR, LEMONCHIFFON);\r
putch(pucks_nr);\r
endfunc\r
\r
func draw_pucks()\r
txt_Set(FONT_SIZE, FONT3);\r
- txt_MoveCursor(10, 1); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(13, 1); \r
txt_Set(TEXT_COLOUR, GRAY);\r
\r
putstr("PUCKS nr.");\r
endfunc\r
\r
func update_lift()\r
- gfx_Rectangle(170, 142, 239, 170, BLACK);\r
+ gfx_Rectangle(170, 170, 239, 190, BLACK);\r
txt_Set(FONT_SIZE, FONT4);\r
- txt_MoveCursor(9, 15); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(11, 15); \r
txt_Set(TEXT_COLOUR, LEMONCHIFFON);\r
putch(lift_pos[0]);\r
putch(lift_pos[1]);\r
\r
func draw_lift()\r
txt_Set(FONT_SIZE, FONT3);\r
- txt_MoveCursor(10, 20); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(13, 20); \r
txt_Set(TEXT_COLOUR, GRAY);\r
\r
putstr("LIFT pos.");\r
endfunc\r
\r
func update_conf()\r
- gfx_Rectangle(70, 142, 140, 170, BLACK);\r
+ gfx_Rectangle(70, 170, 140, 190, BLACK);\r
txt_Set(FONT_SIZE, FONT4);\r
- txt_MoveCursor(9, 9); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(11, 9); // move the cursor to line 4, column 5\r
txt_Set(TEXT_COLOUR, LEMONCHIFFON);\r
putch(game_conf);\r
endfunc\r
\r
func draw_conf()\r
txt_Set(FONT_SIZE, FONT3);\r
- txt_MoveCursor(10, 10); // move the cursor to line 4, column 5\r
+ txt_MoveCursor(13, 10); // move the cursor to line 4, column 5\r
txt_Set(TEXT_COLOUR, GRAY);\r
\r
putstr("GAME conf.");\r
mem_Copy(msg_rcvd+10, voltage80, 8);\r
mem_Copy(msg_rcvd+14, voltageBAT, 10);\r
\r
- mem_Copy(msg_rcvd+21, position, 16);\r
+ mem_Copy(msg_rcvd+21, position, 24);\r
\r
- mem_Copy(msg_rcvd+35, fsm_state, 40);\r
+ mem_Copy(msg_rcvd+35, act_fsm_state, 40);\r
mem_Copy(msg_rcvd+57, move_fsm_state, 40);\r
\r
if(msg_rcvd[79]==0)\r
mem_Copy(msg_rcvd+91, hw_status, 16);\r
//mem_Copy(msg_rcvd+101, game_conf, 2);\r
game_conf:=msg_rcvd[101];\r
+\r
+ mem_Copy(msg_rcvd+105, main_fsm_state, 40);\r
\r
draw_voltage33();\r
draw_voltage50();\r
draw_voltage80();\r
draw_voltageBAT();\r
draw_position();\r
- update_fsm_state();\r
+ update_main_fsm_state();\r
+ update_act_fsm_state();\r
update_move_fsm_state();\r
update_lift();\r
update_pucks();\r
\r
\r
\r
+\r
+\r
+\r
+\r
+\r
\r
\r
\r