1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

g_time_per10 only needed in DEBUG mode

This commit is contained in:
bsongis 2012-01-25 20:56:21 +00:00
parent df063a7298
commit 31524e4eb4
4 changed files with 15 additions and 2 deletions

View file

@ -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_TMR1LATMINUS[] = TR_TMR1LATMINUS;
const prog_char APM STR_TMR1JITTERUS[] = TR_TMR1JITTERUS; const prog_char APM STR_TMR1JITTERUS[] = TR_TMR1JITTERUS;
const prog_char APM STR_TMAINMAXMS[] = TR_TMAINMAXMS; const prog_char APM STR_TMAINMAXMS[] = TR_TMAINMAXMS;
#ifdef DEBUG
const prog_char APM STR_T10MSUS[] = TR_T10MSUS; const prog_char APM STR_T10MSUS[] = TR_T10MSUS;
#endif
const prog_char APM STR_FREESTACKMINB[] = TR_FREESTACKMINB; const prog_char APM STR_FREESTACKMINB[] = TR_FREESTACKMINB;
const prog_char APM STR_MENUTORESET[] = TR_MENUTORESET; const prog_char APM STR_MENUTORESET[] = TR_MENUTORESET;
const prog_char APM STR_PPM[] = TR_PPM; const prog_char APM STR_PPM[] = TR_PPM;

View file

@ -47,7 +47,9 @@ ModelData g_model;
uint8_t g_tmr1Latency_max; uint8_t g_tmr1Latency_max;
uint8_t g_tmr1Latency_min; uint8_t g_tmr1Latency_min;
uint16_t g_timeMain; uint16_t g_timeMain;
#ifdef DEBUG
uint16_t g_time_per10; uint16_t g_time_per10;
#endif
#if defined (PCBSTD) && defined (BEEPSPKR) #if defined (PCBSTD) && defined (BEEPSPKR)
uint8_t toneFreq = BEEP_DEFAULT_FREQ; 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 extern uint16_t g_time_per10; // instantiated in menus.cpp
#endif
#if defined (PCBV3) #if defined (PCBV3)
ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) //10ms timer ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) //10ms timer
@ -1846,10 +1850,12 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
#endif #endif
#ifdef DEBUG
// Record start time from TCNT1 to record excution time // Record start time from TCNT1 to record excution time
cli(); cli();
uint16_t dt=TCNT1;// TCNT1 (used for PPM out pulse generation) is running at 2MHz uint16_t dt=TCNT1;// TCNT1 (used for PPM out pulse generation) is running at 2MHz
sei(); sei();
#endif
//cnt >/=0 //cnt >/=0
//beepon/off //beepon/off
@ -1925,12 +1931,14 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
#endif #endif
heartbeat |= HEART_TIMER10ms; heartbeat |= HEART_TIMER10ms;
#ifdef DEBUG
// Record per10ms ISR execution time, in us(x2) for STAT2 page // Record per10ms ISR execution time, in us(x2) for STAT2 page
cli(); cli();
uint16_t dt2 = TCNT1; // capture end time uint16_t dt2 = TCNT1; // capture end time
sei(); sei();
g_time_per10 = dt2 - dt; // NOTE: These spike to nearly 65535 just now and then. Why? :/ g_time_per10 = dt2 - dt; // NOTE: These spike to nearly 65535 just now and then. Why? :/
#endif
#if defined (PCBSTD) && defined (BEEPSPKR) #if defined (PCBSTD) && defined (BEEPSPKR)
} // end 10ms event } // end 10ms event

View file

@ -503,7 +503,9 @@ void resetTimer(uint8_t idx);
extern uint8_t g_tmr1Latency_max; extern uint8_t g_tmr1Latency_max;
extern uint8_t g_tmr1Latency_min; extern uint8_t g_tmr1Latency_min;
extern uint16_t g_timeMain; extern uint16_t g_timeMain;
#ifdef DEBUG
extern uint16_t g_time_per10; extern uint16_t g_time_per10;
#endif
#define MAXTRACE 120 #define MAXTRACE 120
extern uint8_t s_traceBuf[MAXTRACE]; extern uint8_t s_traceBuf[MAXTRACE];

View file

@ -77,7 +77,6 @@ void menuProcDebug(uint8_t event)
g_tmr1Latency_min = 0xff; g_tmr1Latency_min = 0xff;
g_tmr1Latency_max = 0; g_tmr1Latency_max = 0;
g_timeMain = 0; g_timeMain = 0;
// g_time_per10 = 0;
beepKey(); beepKey();
break; break;
case EVT_KEY_FIRST(KEY_DOWN): 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_outdez8(15*FW , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
lcd_puts_P( 0*FW, 4*FH, STR_TMAINMAXMS); lcd_puts_P( 0*FW, 4*FH, STR_TMAINMAXMS);
lcd_outdezAtt(15*FW, 4*FH, (g_timeMain*100)/16, PREC2); lcd_outdezAtt(15*FW, 4*FH, (g_timeMain*100)/16, PREC2);
#ifdef DEBUG
lcd_puts_P( 0*FW, 5*FH, STR_T10MSUS); lcd_puts_P( 0*FW, 5*FH, STR_T10MSUS);
lcd_outdez8(15*FW , 5*FH, g_time_per10/2 ); lcd_outdez8(15*FW , 5*FH, g_time_per10/2 );
#endif
#ifndef SIMU #ifndef SIMU
lcd_puts_P( 0*FW, 6*FH, STR_FREESTACKMINB); lcd_puts_P( 0*FW, 6*FH, STR_FREESTACKMINB);
lcd_outdezAtt(18*FW-1, 6*FH, stack_free(), UNSIGN) ; lcd_outdezAtt(18*FW-1, 6*FH, stack_free(), UNSIGN) ;