Changeset 419
- Timestamp:
- 02/17/07 18:56:23 (2 years ago)
- Files:
-
- trunk/projects/cmucam2/cmucam2.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/cmucam2/cmucam2.c
r418 r419 80 80 int32_t command; 81 81 int32_t val, n; 82 uint32_t arg_list[MAX_ARGS] ;83 bool error, poll_mode, line_mode,auto_led ;82 uint32_t arg_list[MAX_ARGS],start_time; 83 bool error, poll_mode, line_mode,auto_led,demo_mode,auto_servo_mode; 84 84 cc3_track_pkt_t t_pkt; 85 85 cc3_color_info_pkt_t s_pkt; … … 88 88 set_cmucam2_commands (); 89 89 90 91 cc3_system_setup (); 92 93 cc3_filesystem_init(); 94 95 cc3_uart_init (0, 96 SERIAL_BAUD_RATE, 97 CC3_UART_MODE_8N1, CC3_UART_BINMODE_BINARY); 98 val = setvbuf (stdout, NULL, _IONBF, 0); 99 100 if (!cc3_camera_init ()) { 101 cc3_set_led(0); 102 exit(1); 103 } 104 105 demo_mode=false; 106 auto_servo_mode=false; 107 start_time = cc3_get_current_ms (); 108 do 109 { 110 if(cc3_read_button()==1) 111 { 112 // Demo Mode flag 113 demo_mode=true; 114 auto_servo_mode=true; 115 // Debounce Switch 116 cc3_clr_led(0); 117 cc3_wait_ms(500); 118 break; 119 } 120 121 }while(cc3_get_current_ms()<(start_time+2000)); 122 123 90 124 cmucam2_start: 91 125 auto_led= true; … … 101 135 t_pkt.lower_bound.channel[2] = 16; 102 136 t_pkt.upper_bound.channel[2] = 240; 103 cc3_system_setup (); 104 105 cc3_filesystem_init(); 106 107 cc3_uart_init (0, 108 SERIAL_BAUD_RATE, 109 CC3_UART_MODE_8N1, CC3_UART_BINMODE_BINARY); 110 val = setvbuf (stdout, NULL, _IONBF, 0); 111 112 if (!cc3_camera_init ()) { 113 cc3_set_led(0); 114 exit(1); 115 } 137 138 116 139 cc3_set_resolution(CC3_RES_LOW); 117 140 … … 123 146 cc3_pixbuf_set_subsample (CC3_SUBSAMPLE_NEAREST, 2, 1); 124 147 148 if(demo_mode) { 149 // Wait for second button press as target lock 150 while(1) 151 { 152 cc3_set_led(0); 153 cc3_wait_ms(100); 154 cc3_clr_led(0); 155 cc3_wait_ms(100); 156 if(cc3_read_button()==1) break; 157 } 158 159 } 125 160 while (true) { 126 161 cc3_channel_t old_coi; … … 128 163 printf (":"); 129 164 error = false; 130 n = cmucam2_get_command (&command, arg_list); 165 if(demo_mode==true) 166 { 167 n=0; 168 command=TRACK_WINDOW; 169 } 170 else 171 n = cmucam2_get_command (&command, arg_list); 131 172 if (n != -1) { 132 173 switch (command) { … … 386 427 cmucam2_track_color (&t_pkt, poll_mode, line_mode,auto_led,0); 387 428 } 429 demo_mode=false; 388 430 break; 389 431 … … 519 561 free(row); 520 562 } 563 564 521 565 522 566 void cmucam2_get_histogram(cc3_histogram_pkt_t *h_pkt, bool poll_mode, bool quite)
