📄 display.c
字号:
ephemeris[ch].cus, ephemeris[ch].sqrtA, ephemeris[ch].toe); uart2_send_string( string); } else { sprintf( string, "%2d:\033[K\n\r", ch); uart2_send_string( string); } } } else if( ephemeris_mode == 4) { uart2_send_string( header4); for( ch = 0; ch < N_CHANNELS; ch++) { if( ephemeris[ch].valid) { sprintf( string, "%2d: % 15e % 15e % 15e % 15e\033[K\n\r", ch, ephemeris[ch].cic, ephemeris[ch].w0, ephemeris[ch].cis, ephemeris[ch].inc0); uart2_send_string( string); } else { sprintf( string, "%2d:\033[K\n\r", ch); uart2_send_string( string); } } } else if( ephemeris_mode == 5) { uart2_send_string( header5); for( ch = 0; ch < N_CHANNELS; ch++) { if( ephemeris[ch].valid) { sprintf( string, "%2d: % 15e % 15e % 15e % 15e\033[K\n\r", ch, ephemeris[ch].crc, ephemeris[ch].w, ephemeris[ch].omegadot, ephemeris[ch].idot); uart2_send_string( string); } else { sprintf( string, "%2d:\033[K\n\r", ch); uart2_send_string( string); } } } else ephemeris_mode = 0;#endif // EPHEMERIS_DISPLAY}/****************************************************************************** * Display tracking_thread info ******************************************************************************/static voiddisplay_tracking( void){#ifdef ENABLE_TRACKING_DISPLAY char header[] = "\033[HCh: PN Mis Frq DelCarFreq Iprmt Qprmt RSSIQ State Avg\n\r"; char string[80]; unsigned short ch; unsigned short channel_state; unsigned short channel_bitsync; unsigned short channel_framesync; // display header line uart2_send_string( header); // Send out data on all 12 channels if there's no error for( ch = 0; ch < N_CHANNELS; ch++) { switch( CH[ch].state) { case CHANNEL_ACQUISITION: channel_state = 'A'; break; case CHANNEL_CONFIRM: channel_state = 'C'; break; case CHANNEL_PULL_IN: channel_state = 'P'; break; case CHANNEL_LOCK: channel_state = 'L'; break; default: channel_state = '-'; break; } // Is the channel bit sync'ed? if( CH[ch].bit_sync == 1) channel_bitsync = 'B'; else channel_bitsync = '-'; // Is the channel frame sync'ed? if( messages[ch].frame_sync == 1) channel_framesync = 'F'; else channel_framesync = '-'; sprintf( string, "%2d: %2d %3d %3d %10ld %5d %5d %5ld %c(%c%c) %5ld\n\r", ch, CH[ch].prn, CH[ch].missed, CH[ch].n_freq, CH[ch].carrier_freq - CARRIER_REF, CH[ch].i_prompt, CH[ch].q_prompt, CH[ch].prompt_mag, channel_state, channel_bitsync, channel_framesync, CH[ch].avg); uart2_send_string( string); }#endif // TRACKING_DISPLAY}/****************************************************************************** * Display debug info ******************************************************************************/static voiddisplay_debug( void){#ifdef ENABLE_DEBUG_DISPLAY char string[80]; sprintf(string, "\033[HAccumulator int. = %4d\033[K\n\r\n\r", cyg_thread_measure_stack_usage( accum_int_handle)); uart2_send_string( string); sprintf(string, "Allocate thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( allocate_thread_handle)); uart2_send_string( string); sprintf(string, "Display thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( display_thread_handle)); uart2_send_string( string); sprintf(string, "Ephemeris thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( ephemeris_thread_handle)); uart2_send_string( string); sprintf(string, "Measure thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( measure_thread_handle)); uart2_send_string( string); sprintf(string, "Message thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( message_thread_handle)); uart2_send_string( string); sprintf(string, "Position thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( position_thread_handle)); uart2_send_string( string); sprintf(string, "Pseudorange thread = %4d\033[K\n\r", cyg_thread_measure_stack_usage( pseudorange_thread_handle)); uart2_send_string( string);#endif // DEBUG_DISPLAY}/****************************************************************************** * Display message_thread info ******************************************************************************/static voiddisplay_messages( void){#ifdef ENABLE_MESSAGE_DISPLAY char header[] = "\033[H\Ch: PN Mi TOW SF SF1V SF2V SF3V SF4V SF5V State Avg\n\r"; char string[80]; unsigned short ch; unsigned short channel_state; unsigned short channel_bitsync; unsigned short channel_framesync; unsigned short TOW; uart2_send_string( header); // Send out data on all 12 channels for( ch = 0; ch < N_CHANNELS; ch++) { switch( CH[ch].state) { case CHANNEL_ACQUISITION: channel_state = 'A'; break; case CHANNEL_CONFIRM: channel_state = 'C'; break; case CHANNEL_PULL_IN: channel_state = 'P'; break; case CHANNEL_LOCK: channel_state = 'L'; break; default: channel_state = '-'; break; } // Is the channel bit sync'ed? if( CH[ch].bit_sync == 1) channel_bitsync = 'B'; else channel_bitsync = '-'; // Is the channel frame sync'ed? if( messages[ch].frame_sync == 1) channel_framesync = 'F'; else channel_framesync = '-'; // Find the TOW for subframe 1 if valid if( messages[ch].sf[0].valid) TOW = messages[ch].sf[0].TOW; else TOW = 0; sprintf( string, "\%2d: %2d %2d %5d %2d %4lx %4lx %4lx %4lx %4lx %c(%c%c) %5ld\n\r", ch, CH[ch].prn, CH[ch].missed_message_bit, TOW, messages[ch].subframe + 1, messages[ch].sf[0].valid, messages[ch].sf[1].valid, messages[ch].sf[2].valid, messages[ch].sf[3].valid, messages[ch].sf[4].valid, channel_state, channel_bitsync, channel_framesync, CH[ch].avg); uart2_send_string( string); }#endif // MESSAGE_DISPLAY}/****************************************************************************** * Display pages of GPL-GPS info on /dev/ser2. ******************************************************************************/voiddisplay_thread( CYG_ADDRWORD data) // input 'data' not used{ unsigned short current_display = DISPLAY_NOT_USED; // force clear screen cyg_bool got_byte; char c; uart2_initialize(); while (1) { // Delay for 1 second cyg_thread_delay( 100); // setbits32( GPS4020_GPIO_WRITE, LED5); // DEBUG // First, check for an input command got_byte = uart2_get_char( &c); if (got_byte) { if (c == 't') display_command = DISPLAY_TRACKING; else if (c == 'm') display_command = DISPLAY_MESSAGES; else if (c == 's') display_command = DISPLAY_STOP; else if (c == 'e') if (display_command == DISPLAY_EPHEMERIS) ephemeris_mode++; else display_command = DISPLAY_EPHEMERIS; else if (c == 'r') display_command = DISPLAY_PSEUDORANGE; else if (c == 'p') display_command = DISPLAY_POSITION; else if (c == 'd') display_command = DISPLAY_DEBUG; else if (c == 'l') display_command = DISPLAY_LOG; } // Second, output to the screen UNLESS we've stopped the display or // we're logging (in which case position.c will call display_log() // directly if( (display_command != DISPLAY_STOP) && (display_command != DISPLAY_LOG)) { // Clear the screen if we switched displays if( current_display != display_command) { current_display = display_command; clear_screen(); } // Choose the page to display based on user input from the // input_thread if( display_command == DISPLAY_TRACKING) display_tracking(); else if( display_command == DISPLAY_MESSAGES) display_messages(); else if( display_command == DISPLAY_EPHEMERIS) display_ephemeris(); else if( display_command == DISPLAY_PSEUDORANGE) display_pseudorange(); else if( display_command == DISPLAY_POSITION) display_position(); else if( display_command == DISPLAY_DEBUG) display_debug(); else diag_printf("INPUT ERROR: bad display_command.\n\r"); } // clearbits32( GPS4020_GPIO_WRITE, LED5); // DEBUG }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -