Exemplo n.º 1
0
void Mnu_Auto(bool ini)
{
  static char __flash Str_Auto1[] = "Auto On";
  static char __flash Str_Auto0[] = "Auto Off";
  //draw menu:
  if(ini)                        //if redraw needed
  {
    Disp_Clear();                //clear display
    Disp_SetPos(LCD_SIZE / 2 - 3);
    if(Scale & AUTO_SCALE)       //show menu text
      Disp_PutString(Str_Auto1);
        else Disp_PutString(Str_Auto0);
    Disp_Update();               //display update
    MenuTimer = ms2sys(T_AUTO);  //load menu timer
    DispMenu = Menu;             //menu displayed
  }
  //block keys:
  KeyCode = KEY_NO;              //key code processed
  //check timer:
  if(!MenuTimer)                 //timer overflow,
  {
    Sound_Beep();                //beep
    Menu = MNU_MAIN;             //go to main menu
  }
}
Exemplo n.º 2
0
void Menu_Exe(bool t)
{
  Port_Exe(t);                    //TX display copy via UART
  Keyboard_Exe(t);                //scan keyboard
#ifdef LCD1602
  Meter_Exe(t);                   //level measure
#endif

  if(t)
  {
    if(MenuTimer) MenuTimer--;    //menu timer processing
  }

  KeyCode = Keyboard_GetCode();   //read key code
  Repeat = KeyCode & REP_R;       //set/clear repeat flag
  KeyCode &= ~REP_R;              //clear repeat flag in key code
  if(KeyCode && !Repeat)
    Sound_Beep();                 //beep if not repeat

  bool MnuIni = Menu != DispMenu; //need menu draw flag
  switch(Menu)                    //execute menus
  {
  case MNU_SPLASH:  Mnu_Splash(MnuIni); break; //splash screen menu
  case MNU_MAIN:    Mnu_Main(MnuIni);   break; //main menu
  case MNU_AUTO:    Mnu_Auto(MnuIni);   break; //auto scale menu
  case MNU_SETUP:   Mnu_Setup(MnuIni);  break; //setup menu
  }

  if(!Repeat && (KeyCode != KEY_NO)) //if key not processed
    Sound_Bell();                    //error bell
}
Exemplo n.º 3
0
void Mnu_Splash(bool ini)
{
  static char __flash Mnu_Str[] = "FC-510";
  //draw menu:
  if(ini)                        //if redraw needed
  {
    Sound_Beep();                //initial beep
    Disp_SetPos(LCD_SIZE / 2 - 2);
    Disp_PutString(Mnu_Str);     //show menu text
#ifdef LCD1602
    LCD_WrCmd(LINE2 + 6); //line = 2, pos = 7
    LCD_WrData('V');
    LCD_WrData((char)VERSION + 0x30);
    LCD_WrData('.');
    LCD_WrData((char)(VERSION * 10) % 10 + 0x30);
#endif
    Disp_Update();               //display update
    MenuTimer = ms2sys(T_SPLASH); //load menu timer
    DispMenu = Menu;             //menu displayed
  }
  //check any key press:
  if(KeyCode != KEY_NO)          //any key
  {
    MenuTimer = 0;               //timer clear
    KeyCode = KEY_NO;            //key code processed
  }
  //menu timer check:
  if(!MenuTimer)                 //timer overflow,
  {
    Sound_Beep();                //beep
#ifdef LCD1602
    Meter_Clear();
#endif
    Menu = MNU_MAIN;             //go to main menu
  }
}
Exemplo n.º 4
0
void ss_sampl()
{
	while( 1 )	{
		// Sampling	Vertical		//////////////////////////////////////
		led_off(PIO_LED_ALL);
		led_on (PIO_LED_0|PIO_LED_1|PIO_LED_5|PIO_LED_4);
		if ( L_KEY == read_key() )	{
			Sound_Select();
			ss_sampl_V(); process_sampl_V();
			save_sampl_value();
		}	else Sound_Beep();
		// Sampling	Horizonal		//////////////////////////////////////
		led_off(PIO_LED_ALL);
		led_on (PIO_LED_2|PIO_LED_6|PIO_LED_3);
		if ( L_KEY == read_key() )	{
			Sound_Select();
			ss_sampl_H(); process_sampl_V();
			save_sampl_value();
		}	else Sound_Beep();

	}
	END_SEL:
}
void ss_sampl_V()
{
	led_off(PIO_LED_ALL);
	led_on (PIO_LED_0 | PIO_LED_1 | PIO_LED_5 | PIO_LED_4);

	wait_key();		torque_on();	wait_key();
	led_count_down( 5, 1000 );

	disable_adj();

	spd_ptr	 = 0;
	spd_diff = 0;
	reverse_LR();

	ss_on();	sys_delay(300);

	unsigned int ref_L;
	unsigned int ref_R;

	ref_L = ss_value[SS_L0];
	ref_R = ss_value[SS_R0];

	int i=0;

	reset_spd_ptr();
	spd_diff = 1;
	motor_start();

	while(i < SAMPL_VSTEP)
	{
		#define SAM_SPD		20 //25
		if ( spd_ptr_L >= SAM_SPD ) 	{
			spd_diff = 0;
			equal_spd_ptr();
		}

		reset_steps();
		while( steps == 0 );

		ref_L = ss_value[SS_L0];
		ref_R = ss_value[SS_R0];

		sFL0[i] = (unsigned char)ref_L;
		sFR0[i] = (unsigned char)ref_R;
		i++;
	}
	ss_off();

	spd_diff = -1;
	while (spd_ptr_L > 0);
	reset_spd_ptr();

	motor_stop();
	sys_delay(200);

	reverse_LR();

	torque_off();
}