22
33
44/// Defines
5- #define TIMEOUT_FAIL 5 //121 // in seconds
5+ #define time_left_FAIL 101 // in seconds
66#define NB_KEYS 13
77
88/// Static variables
@@ -24,7 +24,7 @@ int launch_prod_screen_buttons(int argc, char *argv[]){
2424 int stop_menu_loop = 0 ;
2525 int res = 2 ; // 2=FAIL
2626 int render = 0 ;
27- int timeout = TIMEOUT_FAIL ;
27+ int time_left = time_left_FAIL ;
2828 int prev_ms = 0 ;
2929 int i ;
3030 char str_title_buttons [50 ];
@@ -48,13 +48,13 @@ int launch_prod_screen_buttons(int argc, char *argv[]){
4848 }
4949
5050 /* Main loop */
51- while (!stop_menu_loop && timeout )
51+ while (!stop_menu_loop && time_left )
5252 {
5353 if (SDL_GetTicks () - prev_ms > 1000 ){
5454
5555 /* Update time*/
5656 prev_ms = SDL_GetTicks ();
57- timeout -- ;
57+ time_left -- ;
5858
5959 /* Fill screen white */
6060 SDL_FillRect (hw_surface , NULL , SDL_MapRGB (hw_surface -> format , bg_color .r , bg_color .g , bg_color .b ));
@@ -70,7 +70,7 @@ int launch_prod_screen_buttons(int argc, char *argv[]){
7070 SDL_FreeSurface (text_surface );
7171
7272 /* Write "Screen ok ? */
73- sprintf (str_title_buttons , "Press all buttons...%ds" , timeout );
73+ sprintf (str_title_buttons , "Press all buttons...%ds" , time_left );
7474 text_surface = TTF_RenderText_Shaded (font_info , str_title_buttons , text_color , bg_color );
7575 text_pos .x = SCREEN_HORIZONTAL_SIZE /2 - text_surface -> w /2 ;
7676 text_pos .y = 2 * Y_PADDING + text_surface -> h /2 ;
@@ -169,7 +169,7 @@ int launch_prod_screen_buttons(int argc, char *argv[]){
169169 keys_pushed [i ] = 1 ;
170170 }
171171
172- /* All keys pushe = exit with success */
172+ /* All keys pushed = exit with success */
173173 if (nb_keys_pushed == NB_KEYS ){
174174 stop_menu_loop = 1 ;
175175 res = 0 ;
@@ -193,13 +193,17 @@ int launch_prod_screen_buttons(int argc, char *argv[]){
193193 SDL_Delay (SLEEP_PERIOD_MS );
194194 }
195195
196- /* Print not touched buttons if timeout */
197- printf (" Missing Keys: " );
198- for (i = 0 ; i < NB_KEYS ; i ++ ){
199- if (keys_pushed [i ]) continue ;
200- printf ("%s," , keys_str [i ]);
196+ /* Print not touched buttons if time_left */
197+ if (!time_left ){
198+ res = 2 ;
199+
200+ printf (" Missing Keys: " );
201+ for (i = 0 ; i < NB_KEYS ; i ++ ){
202+ if (keys_pushed [i ]) continue ;
203+ printf ("%s," , keys_str [i ]);
204+ }
205+ printf ("\n" );
201206 }
202- printf ("\n" );
203207
204208 /*Free surfaces */
205209 SDL_FreeSurface (img_console_layout );
0 commit comments