Ejemplo n.º 1
0
void ther_buzzer_playing_music(void)
{
	struct ther_buzzer *b = &buzzer;
	unsigned char tone;

	if (b->cur_step == 0) {
		print(LOG_DBG, MODULE "why cur step is %d ??\n", b->cur_step);
	}

	b->cur_step++;

	if (b->cur_step == STEP_END) {
		print(LOG_DBG, MODULE "end music %d\n", b->music);
		stop_buzzer();
		b->cur_step = 0;
		return;
	}

	if (b->cur_step % 2) {
		tone = musics[b->music][TONE_OFFSET];
		start_buzzer(tone);

	} else {
		stop_buzzer();
	}

	osal_start_timerEx(b->task_id, TH_BUZZER_EVT, musics[b->music][b->cur_step]);
}
Ejemplo n.º 2
0
int main(int argc, char **argv) {
	int freq, length;
	char *binary;
	char c;
	binary = *argv;
	if (argc < 2) {printf("Usage: %s <tone 0-21| freq 2000-250 | pause -millisec> [...]\n", binary); return 0;}
	if (!init_buzzer()) {printf("Run as Root\n"); return 0;}
	argv++;
	c = *(argv)[0];
	if (((c < 48) || (c > 58)) && (c != '-')) {printf("Usage: %s <tone 0-21| freq 2000-250| p -millisec> [...]\n", binary); return 0;}
	int x;
	for (x = 1; x < argc; x++) {
	c = *(argv)[0];
	if (((c < 48) || (c > 58)) && (c != '-')) {printf("Usage: %s <tone 0-21| freq 2000-250| p -millisec> [...]\n", binary); return 0;}
	if ((*argv[0] == '-') && (*(*argv+1) != 0)) {
		sscanf(*argv+1,"%d",&freq);
		wait(freq);
	}
	else {
		if (!( (*argv[0] < 48) || (*argv[0] > 58) )) sscanf(*argv,"%d",&freq);
		if (freq < 250) if (freq < NOTES) freq = progression[freq];
		else freq = 1550;
		buzz(freq);
	}
	argv++;
}

stop_buzzer();
return 1;
}
Ejemplo n.º 3
0
// *************************************************************************************************
// @fn          stop_alarm
// @brief       Stop active alarm
// @param       none
// @return      none
// *************************************************************************************************
void stop_alarm(void) 
{
	// Indicate that alarm is enabled, but not active
	sAlarm.state = ALARM_ENABLED;
	
	// Stop buzzer
	stop_buzzer();
}	
Ejemplo n.º 4
0
// *************************************************************************************************
// @fn          countdown_buzzer
// @brief       Decrement active buzzer time. Turn off buzzer if cycle end reached.
// @param       none
// @return      none
// *************************************************************************************************
void countdown_buzzer(void)
{
	// Stop buzzer when reaching 0 cycles
	if (--sBuzzer.time == 0)
	{
		stop_buzzer();
	}
}
Ejemplo n.º 5
0
// Plays current winner tone and decrements it for a higher note next
void next_winner_tone() {
	uint8_t tone = winner_tone;
	if (tone > 70) {
		start_buzzer(tone * (F_CPU / 1000000), 6, &next_winner_tone);
		winner_tone = tone - 1;
	} else {
		stop_buzzer();
	}
}
Ejemplo n.º 6
0
int beep(int fd)
{
	int freq = 1000 ;
 	int mdelay;	

	set_buzzer_freq(fd,freq);
	for(mdelay =1000000;mdelay>0;mdelay--);
	stop_buzzer(fd);

	return 0;
}
Ejemplo n.º 7
0
// *************************************************************************************************
// @fn          stop_eggtimer_alarm
// @brief       Puts eggtimer in STOP mode, halts alarm mode and buzzing if active, updates eggtimer
//			symbol. Safe to call, even if eggtimer menu not active.
// @param       none
// @return      none
// *************************************************************************************************
void stop_eggtimer_alarm(void)
{
	sEggtimer.state = EGGTIMER_STOP;
	sEggtimer.duration = EGGTIMER_ALARM_DURATION;
	if (eggtimer_visible()) {
		display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF);
	}
	else {
		display_symbol(LCD_ICON_RECORD, SEG_OFF_BLINK_OFF);
	}
	stop_buzzer(); // FIXME: needs to play friendly with other buzzer-using modules (e.g. alarm)
}
Ejemplo n.º 8
0
// *************************************************************************************************
// @fn          stop_alarm
// @brief       Stop active alarm
// @param       none
// @return      none
// *************************************************************************************************
void stop_alarm(void) 
{
	// Indicate that alarm is enabled, but not active
        if (sa_needrestart)
          {
          sa_needrestart=0;  
          sAlarm.state = ALARM_SOFT;
          }
        else
	  sAlarm.state = ALARM_ENABLED;
	
	// Stop buzzer
	stop_buzzer();
}	
Ejemplo n.º 9
0
// *************************************************************************************************
// @fn          stop_eggtimer_alarm
// @brief       Puts eggtimer in STOP mode, halts alarm mode and buzzing if active, updates eggtimer
//			symbol. Safe to call, even if eggtimer menu not active.
// @param       none
// @return      none
// *************************************************************************************************
void stop_eggtimer_alarm(void)
{
	// We dont need the timer active anymore
	Timer0_A1_Unregister(eggtimer_tick);

	sEggtimer.state = EGGTIMER_STOP;
	sEggtimer.duration = EGGTIMER_ALARM_DURATION;
	if (eggtimer_visible()) {
		display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF);
	}
	else {
		display_symbol(LCD_ICON_RECORD, SEG_OFF_BLINK_OFF);
	}
	stop_buzzer(); // FIXME: needs to play friendly with other buzzer-using modules (e.g. alarm)
}
Ejemplo n.º 10
0
void ther_buzzer_stop_music(void)
{
	struct ther_buzzer *b = &buzzer;

	if (b->cur_step == 0)
		return;

	print(LOG_DBG, MODULE "stop music %d\n", b->music);

	osal_stop_timerEx(b->task_id, TH_BUZZER_EVT);

	if (b->cur_step % 2)
		stop_buzzer();

	b->cur_step = 0;
}
Ejemplo n.º 11
0
int main(int argc, char **argv)
{
    int fd, freq = 1000 ;
    char key = 0xff;

    fd = open("/dev/pwm", 0);
    if (fd < 0) {
        perror("open pwm_buzzer device");
        exit(1);
    }

    printf( "\nBUZZER TEST ( PWM Control )\n" );
    printf( "Press 'ESC+ENTER' key to Exit this program\n\n" );
    set_buzzer_freq(fd, freq);
    printf( "\tFreq = %d\n", freq );

    while( 1 )
    {
        key = getchar();
        printf("key:%d\n",key);

        switch(key) {

        case ESC_KEY:
            stop_buzzer(fd);
            exit(0);
        case '+':
            freq += 100;
            printf( "\tFreq = %d\n", freq );
            set_buzzer_freq(fd, freq);

            break;
        case '-':
            freq -= 100;
            printf( "\tFreq = %d\n", freq );
            set_buzzer_freq(fd, freq);

            break;
        default:
            printf("key:%d invalid\n",key);
            break;
        }
    }
}
Ejemplo n.º 12
0
void ther_buzzer_exit(void)
{
	struct ther_buzzer *b = &buzzer;

	print(LOG_INFO, MODULE "buzzer exit\n");

	/*
	 * logic ok?
	 */
	osal_stop_timerEx(b->task_id, TH_BUZZER_EVT);
//	osal_clear_event(b->task_id, TH_BUZZER_EVT);

	if (b->cur_step >= STEP_START && b->cur_step <= STEP_END) {
		if (b->cur_step % 2)
			stop_buzzer();
	}

	P1_BUZZER_PIN = 1;
}
Ejemplo n.º 13
0
void beep_once(uint16_t d_ms)
{
	start_buzzer();
	_delay_ms(d_ms);
	stop_buzzer();
}
Ejemplo n.º 14
0
// *************************************************************************************************
// @fn          set_value
// @brief       Generic value setting routine
// @param       s32 * value						Pointer to value to set
//				u8digits						Number of digits
//				u8 blanks						Number of whitespaces before first valid digit
//				s32 limitLow					Lower limit of value
//				s32 limitHigh					Upper limit of value
//				u16 mode		
//				u8 segments					Segments where value should be drawn
//				fptr_setValue_display_function1		Value-specific display routine
// @return      none
// *************************************************************************************************
void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode, u8 segments, void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks))
{
	u8 update;
	s16 stepValue = 1;
	u8 doRound = 0;
	u32 val;
	
	// Clear button flags
	button.all_flags = 0;
	
	// Clear blink memory
	clear_blink_mem();
	
	// For safety only - buzzer on/off and button_repeat share same IRQ
	stop_buzzer();
	
	// Init step size and repeat counter
	sButton.repeats = 0;
	
	// Initial display update
	update = 1;
	
	// Turn on 200ms button repeat function 
	button_repeat_on(200);
	
	// Start blinking with with 2Hz
	set_blink_rate(BIT6 + BIT5);
	
	// Value set loop
	while(1) 
	{
		// Idle timeout: exit function
		if (sys.flag.idle_timeout) break;

		// STAR (short) button: exit function
		if (button.flag.star) break;

		// NUM button: exit function and goto to next value (if available)
		if (button.flag.num)
		{
			if ((mode & SETVALUE_NEXT_VALUE) == SETVALUE_NEXT_VALUE) break;
		}

		// UP button: increase value
		if(button.flag.up)
		{
			// Increase value
			* value = * value + stepValue;
			
			// Check value limits
			if (* value > limitHigh) 
			{
				// Check if value can roll over, else stick to limit
				if ((mode & SETVALUE_ROLLOVER_VALUE) == SETVALUE_ROLLOVER_VALUE) 	* value = limitLow;
				else 																* value = limitHigh;				
					
				// Reset step size to default
				stepValue = 1;	
			}

			// Trigger display update
			update = 1;
			
			// Clear button flag
			button.flag.up = 0;
		}
		
		// DOWN button: decrease value
		if(button.flag.down)
		{
			// Decrease value
			* value = * value - stepValue;
			
			// Check value limits
			if (* value < limitLow) 
			{
				// Check if value can roll over, else stick to limit
				if ((mode & SETVALUE_ROLLOVER_VALUE) == SETVALUE_ROLLOVER_VALUE)	* value = limitHigh;
				else																* value = limitLow;
					
				// Reset step size to default
				stepValue = 1;	
			}

			// Trigger display update
			update = 1;

			// Clear button flag	
			button.flag.down = 0;
		}

		
		// When fast mode is enabled, increase step size if Sx button is continuously
		if ((mode & SETVALUE_FAST_MODE) == SETVALUE_FAST_MODE)
		{
			switch (sButton.repeats)
			{
				case 0:			stepValue = 1;		doRound = 0; 	break;
				case 10:		
				case -10:		stepValue = 10;		doRound = 1; 	break;
				case 20:			
				case -20:		stepValue = 100;	doRound = 1; 	break;
				case 30:			
				case -30:		stepValue = 1000;	doRound = 1; 	break;
			}
			
			// Round value to avoid odd numbers on display
			if (stepValue != 1 && doRound == 1)	
			{
				* value -= * value % stepValue;
				doRound = 0;
			}
		}

		// Update display when there is new data
		if (update)
		{
			// Display up or down arrow according to sign of value
			if ((mode & SETVALUE_DISPLAY_ARROWS) == SETVALUE_DISPLAY_ARROWS)
			{
				if (* value >= 0)
				{
					display_symbol(LCD_SYMB_ARROW_UP, SEG_ON);
					display_symbol(LCD_SYMB_ARROW_DOWN, SEG_OFF);
					val = *value;
				}
				else 
				{
					display_symbol(LCD_SYMB_ARROW_UP, SEG_OFF);
					display_symbol(LCD_SYMB_ARROW_DOWN, SEG_ON);
					val = *value * (-1);
				}
			}
			else
			{
				val = *value;
			}

			// Display function can either display value directly, modify value before displaying 
			// or display a string referenced by the value
			fptr_setValue_display_function1(segments, val, digits, blanks);

			// Clear update flag
			update = 0;
		}
		
		// Call idle loop to serve background tasks
		idle_loop();
		
	}
	
	// Clear up and down arrows
	display_symbol(LCD_SYMB_ARROW_UP, SEG_OFF);
	display_symbol(LCD_SYMB_ARROW_DOWN, SEG_OFF);
	
	// Set blinking rate to 1Hz and stop
	set_blink_rate(BIT7 + BIT6 + BIT5);
	clear_blink_mem();
	
	// Turn off button repeat function
	button_repeat_off();
}
Ejemplo n.º 15
0
// *************************************************************************************************
// @fn          set_value
// @brief       Generic value setting routine
// @param       int32_t  * value						Pointer to value to set
//				uint8_tdigits						Number of digits
//				uint8_t blanks						Number of whitespaces before first valid digit
//				int32_t  limitLow					Lower limit of value
//				int32_t  limitHigh					Upper limit of value
//				uint16_t mode
//				uint8_t segments					Segments where value should be drawn
//				fptr_setValue_display_function1		Value-specific display routine
// @return      none
// *************************************************************************************************
void set_value(int32_t  * value, uint8_t digits, uint8_t blanks, int32_t  limitLow, int32_t  limitHigh, uint16_t mode, uint8_t segments, void (*fptr_setValue_display_function1)(uint8_t segments, uint32_t  value, uint8_t digits, uint8_t blanks, uint8_t disp_mode))
{
	uint8_t update;
	int16_t  stepValue;
	if((mode & SETVALUE_STEP_FIFE ) == SETVALUE_STEP_FIFE)
	{
		stepValue=5;
	}
	else
	{
		stepValue=1;
	}
	uint8_t doRound = 0;
	#ifdef CONFIG_STOP_WATCH
	uint8_t stopwatch_state;
	#endif
	uint32_t  val;
	int32_t  orig_val=*value;
	
	// Clear button flags
	button.all_flags = 0;
	
	// Clear blink memory
	clear_blink_mem();
	
	// 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;
	
	// Initial display update
	update = 1;
	
	// Turn on 200ms button repeat function 
	button_repeat_on(200);
	
	// Start blinking with with 2Hz
	set_blink_rate(BIT6 + BIT5);
	
	// Value set loop
	while(1) 
	{
		// Idle timeout: exit function
		if (sys.flag.idle_timeout) break;

		// Button STAR (short) button: exit function
		if (button.flag.star) break;

		// NUM button: exit function and goto to next value (if available)
		if (button.flag.num)
		{
			if ((mode & SETVALUE_NEXT_VALUE) == SETVALUE_NEXT_VALUE) break;
		}

		// UP button: increase value
		if(button.flag.up)
		{
			// Increase value
			* value = * value + stepValue;
			
			// Check value limits
			if (* value > limitHigh) 
			{
				// Check if value can roll over, else stick to limit
				if ((mode & SETVALUE_ROLLOVER_VALUE) == SETVALUE_ROLLOVER_VALUE) 	* value = limitLow;
				else 																* value = limitHigh;				
					
				// Reset step size to default
				if((mode & SETVALUE_STEP_FIFE ) == SETVALUE_STEP_FIFE)
				{
					stepValue=5;
				}
				else
				{
					stepValue=1;
				}
			}

			// Trigger display update
			update = 1;
			
			// Clear button flag
			button.flag.up = 0;
		}
		
		// DOWN button: decrease value
		if(button.flag.down)
		{
			// Decrease value
			* value = * value - stepValue;
			
			// Check value limits
			if (* value < limitLow) 
			{
				// Check if value can roll over, else stick to limit
				if ((mode & SETVALUE_ROLLOVER_VALUE) == SETVALUE_ROLLOVER_VALUE)	* value = limitHigh;
				else																* value = limitLow;
					
				// Reset step size to default
				if((mode & SETVALUE_STEP_FIFE ) == SETVALUE_STEP_FIFE)
				{
					stepValue=5;
				}
				else
				{
					stepValue=1;
				}
			}

			// Trigger display update
			update = 1;

			// Clear button flag	
			button.flag.down = 0;
		}

		
		// When fast mode is enabled, increase step size if Sx button is continuously
		if ((mode & SETVALUE_FAST_MODE) == SETVALUE_FAST_MODE)
		{
			switch (sButton.repeats)
			{
				case 0:			if((mode & SETVALUE_STEP_FIFE ) == SETVALUE_STEP_FIFE){	stepValue=5;	doRound = 1; }	else {	stepValue=1;	doRound = 0; }	break;
				case 10:		
				case -10:		stepValue = 10;		doRound = 1; 	break;
				case 20:			
				case -20:		stepValue = 100;	doRound = 1; 	break;
				case 30:			
				case -30:		stepValue = 1000;	doRound = 1; 	break;
			}
			
			// Round value to avoid odd numbers on display
			if (stepValue != 1 && doRound == 1)	
			{
				* value -= * value % stepValue;
				doRound = 0;
			}
		}

		// Update display when there is new data
		if (update)
		{
			// Display up or down arrow according to sign of value
			if ((mode & SETVALUE_DISPLAY_ARROWS) == SETVALUE_DISPLAY_ARROWS)
			{
				if (* value >= 0)
				{
					display_symbol(LCD_SYMB_ARROW_UP, SEG_ON);
					display_symbol(LCD_SYMB_ARROW_DOWN, SEG_OFF);
					val = *value;
				}
				else 
				{
					display_symbol(LCD_SYMB_ARROW_UP, SEG_OFF);
					display_symbol(LCD_SYMB_ARROW_DOWN, SEG_ON);
					val = *value * (-1);
				}
			}
			else
			{
				val = *value;
			}
			
			if((mode & SETVALUE_DISPLAY_SYMBOL) == SETVALUE_DISPLAY_SYMBOL)
			{	
				display_symbol(segments,SEG_ON_BLINK_ON);
				// return when value is changed
				if( orig_val != *value ) break;
			}
			else if( (mode & SETVALUE_SWITCH_ARROWS) == SETVALUE_SWITCH_ARROWS )
			{
				//show up arrow if value is odd
				if( val & 0x1 )
				{
					display_symbol(LCD_SYMB_ARROW_UP,SEG_ON_BLINK_ON);
					display_symbol(LCD_SYMB_ARROW_DOWN,SEG_OFF_BLINK_OFF);
				}
				//show down arrow if value is even
				else
				{
					display_symbol(LCD_SYMB_ARROW_DOWN,SEG_ON_BLINK_ON);
					display_symbol(LCD_SYMB_ARROW_UP,SEG_OFF_BLINK_OFF);
				}
			}
			else
			{
				// Display function can either display value directly, modify value before displaying
				// or display a string referenced by the value
				fptr_setValue_display_function1(segments, val, digits, blanks, SEG_ON_BLINK_ON);
			}

			// Clear update flag
			update = 0;
		}
		
		// Call idle loop to serve background tasks
		idle_loop();
		
	}
	
	//switch symbol
	if((mode & SETVALUE_DISPLAY_SYMBOL) == SETVALUE_DISPLAY_SYMBOL)
	{
		display_symbol(segments,SEG_OFF);
	}
	
	// Set blinking rate to 1Hz and stop
	set_blink_rate(BIT7 + BIT6 + BIT5);
	clear_blink_mem();
	
	// Turn off button repeat function
	button_repeat_off();

	#ifdef CONFIG_STOP_WATCH
	// Enable stopwatch display updates again
	sStopwatch.state = stopwatch_state;
	#endif
}
Ejemplo n.º 16
0
extern void
display_vario( u8 line, u8 update )
{
   static u8 _idone; // initialisation helper
   static u8 _vbeat; // heartbeat

   u32 pressure;

   switch( update )
     {
      case DISPLAY_LINE_CLEAR:

	stop_buzzer();
	display_symbol( LCD_ICON_BEEPER1, SEG_OFF );
	display_symbol( LCD_ICON_BEEPER2, SEG_OFF );
	display_symbol( LCD_ICON_RECORD,  SEG_OFF );
	_display_l2_clean();
	return;

      case DISPLAY_LINE_UPDATE_FULL:

	display_symbol( LCD_ICON_BEEPER1,
			( G_vario.beep_mode ) ? SEG_ON : SEG_OFF );

	display_symbol( LCD_ICON_BEEPER2,
			(  ( G_vario.beep_mode == VARIO_BEEPMODE_ASCENT_0 )
			|| ( G_vario.beep_mode == VARIO_BEEPMODE_BOTH ))
			  ? SEG_ON : SEG_OFF );
	//
	// fall through to partial update
	//
      case DISPLAY_LINE_UPDATE_PARTIAL:
	break;
     }

#if VARIO_F_TIME
   // Update flight time regardless of whether we do have an altitude.
   //
   // Be careful to only update the time when a time update is active,
   // ie, not because this refresh is due to a DOWN button press.
   //
   if ( display.flag.update_time )
     {
	G_vario.stats.f_time.ss++;
	if ( G_vario.stats.f_time.ss > 59 )
	  {
	     G_vario.stats.f_time.ss = 0;
	     G_vario.stats.f_time.mm++;
	     if ( G_vario.stats.f_time.mm > 59 )
	       {
		  G_vario.stats.f_time.mm = 0;
		  G_vario.stats.f_time.hh++;
	       }
	     // Reset flight time after 19 hours, more will not fit on lcd !
	     if ( G_vario.stats.f_time.hh > 19 )
	       G_vario.stats.f_time.hh = 0;
	  }
     }
#endif

   //
   // Partial or full update. Make sure pressure sensor is being sampled, ie,
   // that line 1 is in altimeter mode.
   //

   if ( is_altitude_measurement() )
     {
	s16 diff;

	if ( vario_p_read( &pressure ) )
	  {
	     // Happens during key presses, never mind.
	     return; // no data, wait for update
	  }

	//
	// If this is the very first time we are here, we have no previous
	// pressure, handle that situation.
	//
	if ( !_idone  )
	  {
	     diff = 0;
	     ++_idone;
	  }
	else
	  {
	     //
	     // Calculate difference in Pascal - we will need it anyway for the
	     // buzzer. Pressure decreases with altitude, ensure going lower is
	     // negative.
	     // 
	     diff = G_vario.prev_pa - pressure;

#if VARIO_VZ
	     // update stats as we may want to see these after the flight.

	     if ( diff > G_vario.stats.vzmax ) G_vario.stats.vzmax = diff;
	     if ( diff < G_vario.stats.vzmin ) G_vario.stats.vzmin = diff;
#endif

#if VARIO_ALTMAX
	     // Peek at current altitude in altimeter data.
	     if ( G_vario.stats.altmax < sAlt.altitude )
	       G_vario.stats.altmax = sAlt.altitude;
#endif
	  }

	_display_l2_clean();
	// Pulse the vario heartbeat indicator.
	++_vbeat;
	display_symbol( LCD_ICON_RECORD, ( _vbeat & 1 ) ? SEG_ON : SEG_OFF );
	
	// Now see what value to display.

	switch( G_vario.view_mode )
	  {
	   case VARIO_VIEWMODE_ALT_M:
	     //
	     // convert the difference in Pa to a vertical velocity.
	     //
	     _display_signed( _pascal_to_vz( diff ), 1 );
	     break;

#if VARIO_ALT_PA
	   case VARIO_VIEWMODE_ALT_PA:
	     //
	     // display raw difference in Pascal.
	     //
	     _display_signed( diff, 0 );
	     break;
#endif
#if VARIO_PA
	   case VARIO_VIEWMODE_PA:
	     //
	     // display pressure as hhhh.pp (hPa and Pa)
	     //
	     _display_signed( pressure, 1 );
	     break;
#endif
#if VARIO_VZ
	   case VARIO_VIEWMODE_VZMAX:
	     display_symbol( LCD_SYMB_MAX, SEG_ON);
	     _display_signed( _pascal_to_vz( G_vario.stats.vzmax ), 1  );
	     break;

	   case VARIO_VIEWMODE_VZMIN:
	     display_symbol( LCD_SYMB_MAX, SEG_ON);
	     _display_signed( _pascal_to_vz( G_vario.stats.vzmin ), 1 );
	     break;
#endif

#if VARIO_ALTMAX
	   case VARIO_VIEWMODE_ALT_MAX:
	     display_symbol( LCD_SYMB_MAX, SEG_ON);
	     _display_signed( G_vario.stats.altmax, 0 );
	     break;
#endif
#if VARIO_F_TIME
	   case VARIO_VIEWMODE_F_TIME:
	     display_chars(LCD_SEG_L2_5_0, int_to_array(G_vario.stats.f_time.hh,2,0), SEG_ON);
	     display_chars(LCD_SEG_L2_3_0, int_to_array(G_vario.stats.f_time.mm,2,0), SEG_ON);
	     display_chars(LCD_SEG_L2_1_0, int_to_array(G_vario.stats.f_time.ss,2,0), SEG_ON);
	     display_symbol(LCD_SEG_L2_COL1, SEG_ON);
	     display_symbol(LCD_SEG_L2_COL0, SEG_ON);
	     break;
#endif
	   case VARIO_VIEWMODE_MAX:
	     break;

	  } // switch view mode

	// If beeper is enabled, beep.
	switch ( G_vario.beep_mode )
	  {
	   case VARIO_BEEPMODE_ASCENT_0:
	     if ( diff >= 0 ) chirp( diff );
	     break;
	   case VARIO_BEEPMODE_ASCENT_1:
	     if ( diff > 0 ) chirp( diff );
	     break;
	   case VARIO_BEEPMODE_BOTH:
	     if ( diff ) chirp( diff );
	     break;
	   case VARIO_BEEPMODE_OFF:
	   case VARIO_BEEPMODE_MAX:
	     break;
	  }
	
	// update previous pressure measurement.

	G_vario.prev_pa = pressure;

     } // L1 is in altimeter mode
   else
     {
	_display_l2_clean();
	display_chars(LCD_SEG_L2_5_0, (u8*) " NOALT", SEG_ON);
	_idone = 0; // avoid false peaks when re-enabling the altimeter
     }
}