From: Martin Zidek Date: Sun, 26 Apr 2009 14:30:50 +0000 (+0200) Subject: disp: final version of 4DG source of status screen X-Git-Tag: start2011~294^2~11^2~11 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/eurobot/public.git/commitdiff_plain/afaaea1e59465a94f204dcf72ca6de7195478739 disp: final version of 4DG source of status screen --- diff --git a/src/disp-4dgl/status_screen.4dg b/src/disp-4dgl/status_screen.4dg index 8902ff4a..f64eaf1d 100644 --- a/src/disp-4dgl/status_screen.4dg +++ b/src/disp-4dgl/status_screen.4dg @@ -4,7 +4,7 @@ //#inherit "4DGL-System.fnc" #constant MSG_TERM '~' -#constant MSG_BUFF_LEN 103 +#constant MSG_BUFF_LEN 123 #constant MSG_POWER 'V' #constant MSG_POSITION 'P' #constant MSG_FSM_STATE 'F' @@ -26,6 +26,7 @@ /*Voltage branch OK indication*/ #constant VOLTAGE_OK 1 +#constant HW_STATUS_FAILED 0 #constant HW_STATUS_OK 1 #constant HW_STATUS_WARN 2 @@ -50,13 +51,12 @@ var voltageBAT[5]; 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; +var act_fsm_state[20]; var move_fsm_state[20]; -var move_fsm_state_len; +var main_fsm_state[20]; var lift_pos[4]; var pucks_nr; @@ -101,6 +101,14 @@ func init() lift_pos[3]:='0'; pucks_nr:='0'; game_conf:='1'; + hw_status[0]:=HW_STATUS_FAILED; + hw_status[1]:=HW_STATUS_FAILED; + hw_status[2]:=HW_STATUS_FAILED; + hw_status[3]:=HW_STATUS_FAILED; + hw_status[4]:=HW_STATUS_FAILED; + hw_status[5]:=HW_STATUS_FAILED; + hw_status[6]:=HW_STATUS_FAILED; + hw_status[7]:=HW_STATUS_FAILED; endfunc @@ -228,7 +236,7 @@ func draw_position() 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]); @@ -238,6 +246,11 @@ func draw_position() putch(position[5]); putch(position[6]); putch(position[7]); + putch(' '); + putch(position[8]); + putch(position[9]); + putch(position[10]); + putstr(" [m]"); return 0; endfunc @@ -252,15 +265,15 @@ func draw_fsm_state() 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; @@ -268,9 +281,9 @@ endfunc func update_move_fsm_state() var idx; - gfx_Rectangle(0, 99, 239, 112, BLACK); + gfx_Rectangle(0, 113, 239, 128, BLACK); txt_Set(FONT_SIZE, FONT4); - txt_MoveCursor(6, 0); // move the cursor to line 4, column 5 + txt_MoveCursor(7, 0); // move the cursor to line 4, column 5 txt_Set(TEXT_COLOUR, WHITE); idx:=0; repeat @@ -280,6 +293,20 @@ func update_move_fsm_state() return 0; endfunc +func update_main_fsm_state() + var idx; + gfx_Rectangle(0, 70, 239, 99, BLACK); + txt_Set(FONT_SIZE, FONT4); + txt_MoveCursor(5, 0); // move the cursor to line 4, column 5 + txt_Set(TEXT_COLOUR, WHITE); + idx:=0; + repeat + putch(main_fsm_state[idx]); + idx++; + until(idx==20) + return 0; +endfunc + func draw_hw1(var status) txt_Set(FONT_SIZE, FONT3); txt_Set(TEXT_COLOUR, WHITE); @@ -425,35 +452,31 @@ endfunc func draw_hw() txt_Set(FONT_SIZE, FONT3); - txt_MoveCursor(15, 10); // move the cursor to line 4, column 5 - txt_Set(TEXT_COLOUR, GRAY); - - putstr("HW STATUS"); - + txt_Set(TEXT_COLOUR, WHITE); - draw_hw1(HW_STATUS_OK); - draw_hw2(HW_STATUS_OK); - draw_hw3(HW_STATUS_OK); - draw_hw3a(HW_STATUS_OK); - draw_hw4(HW_STATUS_OK); - draw_hw5(HW_STATUS_OK); - draw_hw6(HW_STATUS_OK); - draw_hw6a(HW_STATUS_OK); + draw_hw1(hw_status[0]); + draw_hw2(hw_status[1]); + draw_hw3(hw_status[2]); + draw_hw3a(hw_status[3]); + draw_hw4(hw_status[4]); + draw_hw5(hw_status[5]); + draw_hw6(hw_status[6]); + draw_hw6a(hw_status[7]); return 0; endfunc func update_pucks() - gfx_Rectangle(0, 142, 50, 170, BLACK); + gfx_Rectangle(0, 170, 50, 190, BLACK); txt_Set(FONT_SIZE, FONT4); - txt_MoveCursor(9, 3); // move the cursor to line 4, column 5 + txt_MoveCursor(11, 3); txt_Set(TEXT_COLOUR, LEMONCHIFFON); putch(pucks_nr); endfunc func draw_pucks() txt_Set(FONT_SIZE, FONT3); - txt_MoveCursor(10, 1); // move the cursor to line 4, column 5 + txt_MoveCursor(13, 1); txt_Set(TEXT_COLOUR, GRAY); putstr("PUCKS nr."); @@ -461,9 +484,9 @@ func draw_pucks() endfunc func update_lift() - gfx_Rectangle(170, 142, 239, 170, BLACK); + gfx_Rectangle(170, 170, 239, 190, BLACK); txt_Set(FONT_SIZE, FONT4); - txt_MoveCursor(9, 15); // move the cursor to line 4, column 5 + txt_MoveCursor(11, 15); txt_Set(TEXT_COLOUR, LEMONCHIFFON); putch(lift_pos[0]); putch(lift_pos[1]); @@ -473,7 +496,7 @@ endfunc func draw_lift() txt_Set(FONT_SIZE, FONT3); - txt_MoveCursor(10, 20); // move the cursor to line 4, column 5 + txt_MoveCursor(13, 20); txt_Set(TEXT_COLOUR, GRAY); putstr("LIFT pos."); @@ -481,16 +504,16 @@ func draw_lift() endfunc func update_conf() - gfx_Rectangle(70, 142, 140, 170, BLACK); + gfx_Rectangle(70, 170, 140, 190, BLACK); txt_Set(FONT_SIZE, FONT4); - txt_MoveCursor(9, 9); // move the cursor to line 4, column 5 + txt_MoveCursor(11, 9); // move the cursor to line 4, column 5 txt_Set(TEXT_COLOUR, LEMONCHIFFON); putch(game_conf); endfunc func draw_conf() txt_Set(FONT_SIZE, FONT3); - txt_MoveCursor(10, 10); // move the cursor to line 4, column 5 + txt_MoveCursor(13, 10); // move the cursor to line 4, column 5 txt_Set(TEXT_COLOUR, GRAY); putstr("GAME conf."); @@ -538,9 +561,9 @@ func process_msg() mem_Copy(msg_rcvd+10, voltage80, 8); mem_Copy(msg_rcvd+14, voltageBAT, 10); - mem_Copy(msg_rcvd+21, position, 16); + mem_Copy(msg_rcvd+21, position, 24); - mem_Copy(msg_rcvd+35, fsm_state, 40); + mem_Copy(msg_rcvd+35, act_fsm_state, 40); mem_Copy(msg_rcvd+57, move_fsm_state, 40); if(msg_rcvd[79]==0) @@ -555,13 +578,16 @@ func process_msg() mem_Copy(msg_rcvd+91, hw_status, 16); //mem_Copy(msg_rcvd+101, game_conf, 2); game_conf:=msg_rcvd[101]; + + mem_Copy(msg_rcvd+105, main_fsm_state, 40); draw_voltage33(); draw_voltage50(); draw_voltage80(); draw_voltageBAT(); draw_position(); - update_fsm_state(); + update_main_fsm_state(); + update_act_fsm_state(); update_move_fsm_state(); update_lift(); update_pucks(); @@ -685,6 +711,11 @@ endfunc + + + + +