diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index b9e2a1f8d..b7dbae136 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -163,7 +163,9 @@ const prog_char APM STR_TMR1LATMAXUS[] = TR_TMR1LATMAXUS; const prog_char APM STR_TMR1LATMINUS[] = TR_TMR1LATMINUS; const prog_char APM STR_TMR1JITTERUS[] = TR_TMR1JITTERUS; const prog_char APM STR_TMAINMAXMS[] = TR_TMAINMAXMS; +#ifdef DEBUG const prog_char APM STR_T10MSUS[] = TR_T10MSUS; +#endif const prog_char APM STR_FREESTACKMINB[] = TR_FREESTACKMINB; const prog_char APM STR_MENUTORESET[] = TR_MENUTORESET; const prog_char APM STR_PPM[] = TR_PPM; diff --git a/src/open9x.cpp b/src/open9x.cpp index 2b2d51982..be460dc97 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -47,7 +47,9 @@ ModelData g_model; uint8_t g_tmr1Latency_max; uint8_t g_tmr1Latency_min; uint16_t g_timeMain; +#ifdef DEBUG uint16_t g_time_per10; +#endif #if defined (PCBSTD) && defined (BEEPSPKR) uint8_t toneFreq = BEEP_DEFAULT_FREQ; @@ -1796,7 +1798,9 @@ uint16_t getTmr16KHz() } } +#ifdef DEBUG extern uint16_t g_time_per10; // instantiated in menus.cpp +#endif #if defined (PCBV3) ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) //10ms timer @@ -1846,10 +1850,12 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer #endif +#ifdef DEBUG // Record start time from TCNT1 to record excution time cli(); uint16_t dt=TCNT1;// TCNT1 (used for PPM out pulse generation) is running at 2MHz sei(); +#endif //cnt >/=0 //beepon/off @@ -1925,12 +1931,14 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer #endif heartbeat |= HEART_TIMER10ms; - + +#ifdef DEBUG // Record per10ms ISR execution time, in us(x2) for STAT2 page cli(); uint16_t dt2 = TCNT1; // capture end time sei(); g_time_per10 = dt2 - dt; // NOTE: These spike to nearly 65535 just now and then. Why? :/ +#endif #if defined (PCBSTD) && defined (BEEPSPKR) } // end 10ms event diff --git a/src/open9x.h b/src/open9x.h index 2379e542f..3fc790269 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -503,7 +503,9 @@ void resetTimer(uint8_t idx); extern uint8_t g_tmr1Latency_max; extern uint8_t g_tmr1Latency_min; extern uint16_t g_timeMain; +#ifdef DEBUG extern uint16_t g_time_per10; +#endif #define MAXTRACE 120 extern uint8_t s_traceBuf[MAXTRACE]; diff --git a/src/statistics_views.cpp b/src/statistics_views.cpp index 05e4ca9fc..d6c32cad2 100644 --- a/src/statistics_views.cpp +++ b/src/statistics_views.cpp @@ -77,7 +77,6 @@ void menuProcDebug(uint8_t event) g_tmr1Latency_min = 0xff; g_tmr1Latency_max = 0; g_timeMain = 0; -// g_time_per10 = 0; beepKey(); break; case EVT_KEY_FIRST(KEY_DOWN): @@ -96,8 +95,10 @@ void menuProcDebug(uint8_t event) lcd_outdez8(15*FW , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); lcd_puts_P( 0*FW, 4*FH, STR_TMAINMAXMS); lcd_outdezAtt(15*FW, 4*FH, (g_timeMain*100)/16, PREC2); +#ifdef DEBUG lcd_puts_P( 0*FW, 5*FH, STR_T10MSUS); lcd_outdez8(15*FW , 5*FH, g_time_per10/2 ); +#endif #ifndef SIMU lcd_puts_P( 0*FW, 6*FH, STR_FREESTACKMINB); lcd_outdezAtt(18*FW-1, 6*FH, stack_free(), UNSIGN) ;