diff --git a/driver/ports.c b/driver/ports.c index cb2ae6c..e25e6fc 100644 --- a/driver/ports.c +++ b/driver/ports.c @@ -229,6 +229,7 @@ __interrupt void PORT2_ISR(void) if( !sys.flag.lock_buttons) { + #ifdef CONFIG_STOP_WATCH // Faster reaction for stopwatch split button press if (is_stopwatch_run()) { @@ -236,6 +237,7 @@ __interrupt void PORT2_ISR(void) button.flag.num = 0; } + #endif } } } @@ -266,6 +268,7 @@ __interrupt void PORT2_ISR(void) if( !sys.flag.lock_buttons) { + #ifdef CONFIG_STOP_WATCH // Faster reaction for stopwatch stop button press if (is_stopwatch_run()) { @@ -278,6 +281,7 @@ __interrupt void PORT2_ISR(void) start_stopwatch(); button.flag.down = 0; } + #endif } } } diff --git a/driver/timer.c b/driver/timer.c index efff92b..b68cd4d 100644 --- a/driver/timer.c +++ b/driver/timer.c @@ -279,8 +279,10 @@ void Timer0_A4_Delay(u16 ticks) // Service watchdog WDTCTL = WDTPW + WDTIS__512K + WDTSSEL__ACLK + WDTCNTCL; #endif +#ifdef CONFIG_STOP_WATCH // Redraw stopwatch display if (is_stopwatch_run()) display_stopwatch(LINE2, DISPLAY_LINE_UPDATE_PARTIAL); +#endif // Check stop condition if (sys.flag.delay_over) break; @@ -634,14 +636,18 @@ __interrupt void TIMER0_A1_5_ISR(void) // Reset IRQ flag TA0CCTL2 &= ~CCIFG; // Load CCR register with next capture point +#ifdef CONFIG_STOP_WATCH update_stopwatch_timer(); +#endif #ifdef CONFIG_EGGTIMER update_eggtimer_timer(); #endif // Enable timer interrupt TA0CCTL2 |= CCIE; // Increase stopwatch counter +#ifdef CONFIG_STOP_WATCH stopwatch_tick(); +#endif #ifdef CONFIG_EGGTIMER eggtimer_tick(); #endif diff --git a/ezchronos.c b/ezchronos.c index 7481775..8c0272e 100644 --- a/ezchronos.c +++ b/ezchronos.c @@ -379,8 +379,10 @@ void init_global_variables(void) // Set buzzer to default value reset_buzzer(); +#ifdef CONFIG_STOP_WATCH // Reset stopwatch reset_stopwatch(); +#endif // Reset altitude measurement #ifdef CONFIG_ALTITUDE diff --git a/logic/menu.c b/logic/menu.c index 1cf2ff1..0dcf5c0 100644 --- a/logic/menu.c +++ b/logic/menu.c @@ -118,10 +118,12 @@ u8 update_time(void) { return (display.flag.update_time); } +#ifdef CONFIG_STOP_WATCH u8 update_stopwatch(void) { return (display.flag.update_stopwatch); } +#endif u8 update_date(void) { return (display.flag.update_date); @@ -279,6 +281,7 @@ const struct menu menu_L2_Vario = #endif // Line2 - Stopwatch +#ifdef CONFIG_STOP_WATCH const struct menu menu_L2_Stopwatch = { FUNCTION(sx_stopwatch), // direct function @@ -287,6 +290,7 @@ const struct menu menu_L2_Stopwatch = FUNCTION(display_stopwatch),// display function FUNCTION(update_stopwatch), // new display data }; +#endif #ifdef CONFIG_EGGTIMER // Line2 - Eggtimer (Counts down from set time) const struct menu menu_L2_Eggtimer = @@ -454,7 +458,9 @@ const struct menu *menu_L2[]={ #ifdef CONFIG_VARIO &menu_L2_Vario, #endif + #ifdef CONFIG_STOP_WATCH &menu_L2_Stopwatch, + #endif #ifdef CONFIG_EGGTIMER &menu_L2_Eggtimer, #endif diff --git a/logic/stopwatch.c b/logic/stopwatch.c index bb8b9b4..d655895 100644 --- a/logic/stopwatch.c +++ b/logic/stopwatch.c @@ -41,6 +41,7 @@ // system #include "project.h" +#ifdef CONFIG_STOP_WATCH #include // driver @@ -526,3 +527,4 @@ void display_stopwatch(u8 line, u8 update) // Clean up symbols when leaving function } } +#endif /* CONFIG_STOP_WATCH */ diff --git a/logic/user.c b/logic/user.c index f639fe2..d0eb029 100644 --- a/logic/user.c +++ b/logic/user.c @@ -109,7 +109,9 @@ void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u stepValue=1; } u8 doRound = 0; + #ifdef CONFIG_STOP_WATCH u8 stopwatch_state; + #endif u32 val; s32 orig_val=*value; @@ -122,9 +124,11 @@ void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u // For safety only - buzzer on/off and button_repeat share same IRQ stop_buzzer(); + #ifdef CONFIG_STOP_WATCH // Disable stopwatch display update while function is active stopwatch_state = sStopwatch.state; sStopwatch.state = STOPWATCH_HIDE; + #endif // Init step size and repeat counter sButton.repeats = 0; @@ -312,7 +316,9 @@ void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u // Turn off button repeat function button_repeat_off(); + #ifdef CONFIG_STOP_WATCH // Enable stopwatch display updates again sStopwatch.state = stopwatch_state; + #endif }