예제 #1
0
//-----------------------------------------------------
void ServiceEditAlarm(unsigned char number_alarm){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_EDIT_ALARM_FILE);
 switch(number_alarm){
  case 0 : PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_1_FILE); break;
  case 1 : PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_2_FILE); break;
  case 2 : PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_3_FILE); break;
  case 3 : PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_4_FILE); break;
  case 4 : PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_5_FILE); break;
 }
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_EDIT_SELECT_ALARM_FILE);
  time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
  // set time
  if(KEY == PLAY){
   CLEAR_KEYPAD();
   ServiceSetTimeAlarm(number_alarm);
  }
  // set track
  if(KEY == NEXT){
   CLEAR_KEYPAD();
   ServiceSetTrackAlarm(number_alarm);
  }
  // on/off alarm
  if(KEY == PREV){
   CLEAR_KEYPAD();
   ServiceOnOffAlarm(number_alarm);
  }
 }
 return;
}
예제 #2
0
//-----------------------------------------------------
void ServiceSetHappy(void){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_HAPPY_FILE);
 PlayServiceFile(PLAY_SERVICE,SERVICE_CUR_HAPPY_FILE);
 PlayTimeHappy();
 PlayDateHappy();
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SELECT_TIME_DATE);
  time_out = WaitKey(PREV,NEXT,-1,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
  // Set DATE HAPPY
  if(KEY == PREV){
   CLEAR_KEYPAD();
   ServiceSetDateHappy();
  }
  // Set TIME HAPPY
  if(KEY == NEXT){
   CLEAR_KEYPAD();
   ServiceSetTimeHappy();
  }
 }
 return;
}
예제 #3
0
//-----------------------------------------------------
void ServiceSetAlarm(void){
 unsigned char time_out;
 unsigned char alarm;
 alarm = 0x00;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_ALARM_FILE);
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SELECT_ALARM);
  time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
  // edit select alarm
  if(KEY == PLAY){ // dont move
   CLEAR_KEYPAD();
   ServiceEditAlarm(alarm);
   continue;
  }
  if(KEY == PREV){
   CLEAR_KEYPAD();
   alarm++;
   if(alarm >= MAX_ALARM){
    alarm = 0x00;
   }
  }
  if(KEY == NEXT){
   CLEAR_KEYPAD();
   if(alarm == 0){
    alarm = MAX_ALARM - 1;
   }else{
     alarm--;
    }
  }
  ServicePlayAlarm(alarm);
 }
 return;

}
예제 #4
0
파일: service_rtc.c 프로젝트: AlexEvil/Bear
//-----------------------------------------------------
void ServiceSetRtc(void){
 register unsigned char data;
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_CALENDAR_SET);
 ReadDsRtcTime(); // Read date/time RTC from DS3231
 data = bcd2bin(DS_CALENDAR.Hour);    DS_CALENDAR.Hour    = data;
 data = bcd2bin(DS_CALENDAR.Minutes); DS_CALENDAR.Minutes = data;  
 data = bcd2bin(DS_CALENDAR.Date);    DS_CALENDAR.Date    = data;
 data = bcd2bin(DS_CALENDAR.Month);   DS_CALENDAR.Month   = data;
 if(DS_CALENDAR.Year < 9) DS_CALENDAR.Year = 9;
 data = bcd2bin(DS_CALENDAR.Year);    DS_CALENDAR.Year    = data; 
 PlayDateRTC();
 PlayTimeRTC();
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SET_DATE_TIME_FILE);
  time_out = WaitKey(PREV,NEXT,-1,EXIT);
  if(time_out == false) break;
   PlayBeep();
   // exit and Save date/time RTC to DS3231
   if(KEY == EXIT){
    CLEAR_KEYPAD();
    data = bin2bcd(DS_CALENDAR.Hour);    DS_CALENDAR.Hour    = data;
    data = bin2bcd(DS_CALENDAR.Minutes); DS_CALENDAR.Minutes = data;  
    data = bin2bcd(DS_CALENDAR.Date);    DS_CALENDAR.Date    = data;
    data = bin2bcd(DS_CALENDAR.Month);   DS_CALENDAR.Month   = data;
    data = bin2bcd(DS_CALENDAR.Year);    DS_CALENDAR.Year    = data;  
    WriteDsRtcTime();
    break;
   }
   // Set DATE RTC
   if(KEY == PREV){ CLEAR_KEYPAD(); ServiceSetDateRTC(); }
   // Set TIME RTC
   if(KEY == NEXT){ CLEAR_KEYPAD(); ServiceSetTimeRTC(); }
  }
 return;
}
예제 #5
0
//-----------------------------------------------------
void ServiceOnOffAlarm(unsigned char number_alarm){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_ON_OFF_FILE);
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_ON_OFF);
  time_out = WaitKey(PREV,NEXT,-1,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
  // on alarm
  if(KEY == PREV){
   CLEAR_KEYPAD();
   Alarm[number_alarm].enable = true;
   PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_ON_FILE);
  }
  // off alarm
  if(KEY == NEXT){
   CLEAR_KEYPAD();
   Alarm[number_alarm].enable = false;
   PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_OFF_FILE);
  }
 }
 return;
}
예제 #6
0
파일: sHome.c 프로젝트: eloiz07/DPC_Touch
void DisplayHomePage(const TOUCH_INFO* TS)
{
	if( gHomePageInit == DISABLE )
	{
		DrawImage(PT_ZERO, PT_ZERO, NM_BG_HOME);
		if(gxLogined == DISABLE)
		{
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR_N);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING_N);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGIN);
		}
		else
		{
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGOUT);
		}
		gHomePageInit = ENABLE;
	}
	
	if( TS->Touched != FALSE )
	{
		gHomeMenu = AnalyzeHomeTouchArea(TS);
		{				// Touching...image process
			if(gxLogined == ENABLE)
			{
				// Job Manager
				if(gHomeMenu == HOM_JOB_MGR)
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR_S);
				else
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR);
					
				// Settings
				if(gHomeMenu == HOM_SETTING)
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING_S);
				else
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING);
			}
							
			// Operation
			if(gHomeMenu == HOM_OPERATION)
				DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_OPERATION_Y, NM_BT_OPERATION_S);
			else
				DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_OPERATION_Y, NM_BT_OPERATION);
				
			// Login
			if(gHomeMenu == HOM_LOGIN)
			{
				if(gxLogined == ENABLE)
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGOUT_S);
				else
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGIN_S);
			}
			else
			{
				if(gxLogined == ENABLE)
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGOUT);
				else
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGIN);
			}
		}	
	}
	else
	{
		if(gHomeMenu != HOM_NONE)
		{
			// Beep sound play
			PlayBeep();
			
			{			// Touched...image process
				if(gxLogined == ENABLE)
				{
					if(gHomeMenu == HOM_JOB_MGR)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR);
					if(gHomeMenu == HOM_SETTING)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING);
					if(gHomeMenu == HOM_LOGIN)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGOUT);
				}
				else
				{
					if(gHomeMenu == HOM_JOB_MGR)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR_N);
					if(gHomeMenu == HOM_SETTING)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING_N);
					if(gHomeMenu == HOM_LOGIN)
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGIN);
				}
				if(gHomeMenu == HOM_OPERATION)
					DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_OPERATION_Y, NM_BT_OPERATION);
			}
				
			{			// Touched...working process
				if(gHomeMenu == HOM_OPERATION)
				{
					// Manul-Ext 초기화
					if(gxSetting.IsExtTrigger == ENABLE)
					{
						gxOperState.IsManualJobOpen = FALSE;
						gxOperState.IsExtStart = TRUE;
					}
						
					gHomePageInit = DISABLE;
					gxPreDisplay = gxCurDisplay;
					gxCurDisplay = PAGE_OPERATION;
				}
				else if(gHomeMenu == HOM_LOGIN)
				{
					if(gxLogined == ENABLE)
					{
						gLogined = DISABLE;
						gxLogined = DISABLE;
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR_N);
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING_N);
						DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGIN);
					}
					else
					{
						gLogined = DISABLE;
						gxPreDisplay = gxCurDisplay;
						gxCurDisplay = PAGE_LOGIN;	
					}
				}
				else
				{
					if(gxLogined == ENABLE)
					{
						gHomePageInit = DISABLE;
						gxPreDisplay = gxCurDisplay;
						gxCurDisplay = gHomeMenu == HOM_JOB_MGR ? PAGE_JOB_MGR : PAGE_SETTING;
					}
				}
			}
			gHomeMenu = HOM_NONE;
		}
		
		if(gxLogined == ENABLE && gLogined == DISABLE)
		{
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_JOB_MGR_Y, NM_BT_JOB_MGR);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_SETTINGS_Y, NM_BT_SETTING);
			DrawImage(PT_BT_HOME_BUTTONS_X, PT_BT_LOGIN_Y, NM_BT_LOGOUT);
			gLogined = ENABLE;
		}
	}
}
예제 #7
0
파일: sJobMgr.c 프로젝트: eloiz07/DPC_Touch
/*---------------------------------------------------------------------------/
/ Touch
/---------------------------------------------------------------------------*/
void DisplayJobMgrPage(const TOUCH_INFO* TS)
{
    // 초기화
    if(gJobMgrPageInit == DISABLE)
    {
        // 플래그 초기화
        gJobMgrMenu = JM_NONE;
        gEditableJob = DISABLE;
        gJobMgrPageInit = ENABLE;
        gIsJobNotPlaySound = TRUE;

        // 화면 갱신
        DrawImage(PT_ZERO, PT_ZERO, NM_BG_JOB_MGR);
        DisplayFuncButtons();

        // JobList 갱신
        RefreashJobList(gJobPageNo);

        // Joblist Display
        DisplayJobList();

        // Job Select
        if(gPreJobMgrMenu == JM_NONE)
            gJobMgrMenu = gxFileCount > 0 ? JM_SEL1 : JM_NONE;
        else
            gJobMgrMenu = gPreJobMgrMenu;
        gPreJobMgrMenu = JM_NONE;
    }

    if(TS->Touched != FALSE)
    {
        gIsJobNotPlaySound = FALSE;
        gJobMgrMenu = AnalyzeJobMgrTouchArea(TS);

        DrawImage(PT_BT_HOME_X, PT_BT_HOME_Y, gJobMgrMenu != JM_HOME ? NM_BT_HOME : NM_BT_HOME_S);
        DrawImage(PT_UP, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_UP ? NM_BT_LIST_UP : NM_BT_LIST_UP_S);
        DrawImage(PT_DOWN, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_DOWN ? NM_BT_LIST_DOWN : NM_BT_LIST_DOWN_S);
        DrawImage(PT_LOAD, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_LOAD ? NM_BT_LOAD : NM_BT_LOAD_S);

        if(gxLogined == ENABLE)
        {
            DrawImage(PT_NEW, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_NEW ? NM_BT_NEW : NM_BT_NEW_S);
            DrawImage(PT_COPY, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_COPY ? NM_BT_COPY : NM_BT_COPY_S);
            DrawImage(PT_EDIT, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_EDIT ? NM_BT_EDIT : NM_BT_EDIT_S);
            DrawImage(PT_DELETE, PT_CON_BUTTONS_Y, gJobMgrMenu != JM_DEL ? NM_BT_DELETE : NM_BT_DELETE_S);
        }
    }
    else
    {
        if(gJobMgrMenu != JM_NONE)
        {
            // Touch Beep play
            if(gIsJobNotPlaySound != TRUE)	PlayBeep();

            switch(gJobMgrMenu)
            {
            case JM_HOME:
                DrawImage(PT_BT_HOME_X, PT_BT_HOME_Y, NM_BT_HOME);

                InitJobList(&gJobList);

                gJobPageNo = 1;
                gPreJobMgrMenu = gJobMgrMenu = JM_NONE;
                gJobMgrPageInit = DISABLE;
                gxCurDisplay = PAGE_HOME;
                break;
            case JM_UP:
                DrawImage(PT_UP, PT_CON_BUTTONS_Y, NM_BT_LIST_UP);
                if(ChangeJobPosition(JM_UP))
                    return;
                break;
            case JM_DOWN:
                DrawImage(PT_DOWN, PT_CON_BUTTONS_Y, NM_BT_LIST_DOWN);
                if(ChangeJobPosition(JM_DOWN))
                    return;
                break;
            case JM_NEW:
                if(gxLogined != DISABLE)
                {
                    DrawImage(PT_NEW, PT_CON_BUTTONS_Y, NM_BT_NEW);

                    if(CreateNewJob() == TRUE)
                    {
                        // Editable Step set
                        SetEditableStepMgr( (gPreJobMgrMenu - (u16)JM_SEL1) + ((gJobPageNo - 1) * PAGE_JOB_COUNT) );

                        // ¸®½ºÆ® ÃʱâÈ­
                        InitJobList(&gJobList);

                        // Step Manager ·Î À̵¿
                        gEditableJob = DISABLE;
                        gJobMgrPageInit = DISABLE;
                        gxPreDisplay = gxCurDisplay;
                        gxCurDisplay = PAGE_STEP_MGR;
                    }
                }
                break;
            case JM_COPY:
                if(gxLogined != DISABLE)
                {
                    DrawImage(PT_COPY, PT_CON_BUTTONS_Y, NM_BT_COPY);

                    if(CopySelectJob(gPreJobMgrMenu) == TRUE)
                        return;
                }
                break;
            case JM_LOAD:
                DrawImage(PT_LOAD, PT_CON_BUTTONS_Y, NM_BT_LOAD);

                if(gPreJobMgrMenu >= (u16)JM_SEL1 && gPreJobMgrMenu <= (u16)JM_SEL12)
                {
                    u16 stepCount = (SearchJobNode(&gJobList, gPreJobMgrMenu - (u16)JM_SEL1))->JobInfo.Steps;

                    if(stepCount > 0)
                    {
                        // Init JobManager Job List
                        InitJobList(&gJobList);

                        // Load Job
                        //LoadJob((gJobPageNo - 1) * PAGE_JOB_COUNT + (gPreJobMgrMenu - (u16)JM_SEL1) + 1);
                        // Input State 를 체크 하여 자동으로 해당 Job 을 읽는 기능을 해제. TRUE = 해제 / FALSE = 활성
                        gxOperState.IsManualJobOpen = TRUE;
                        gxOperState.IsAutoJobLoad = TRUE;
                        gxOperState.LastedJob = (gJobPageNo - 1) * PAGE_JOB_COUNT + (gPreJobMgrMenu - (u16)JM_SEL1) + 1;

                        gEditableJob = DISABLE;
                        gJobMgrPageInit = DISABLE;
                        gxPreDisplay = PAGE_HOME;
                        gxCurDisplay = PAGE_OPERATION;
                    }
                }
                break;
            case JM_EDIT:
                if(gPreJobMgrMenu >= (u16)JM_SEL1 && gPreJobMgrMenu <= (u16)JM_SEL12 && gxLogined != DISABLE)
                {
                    DrawImage(PT_EDIT, PT_CON_BUTTONS_Y, NM_BT_EDIT);

                    // Editable Step set
                    SetEditableStepMgr((gPreJobMgrMenu - (u16)JM_SEL1) + ((gJobPageNo - 1) *  PAGE_JOB_COUNT) );

                    // ¸®½ºÆ® ÃʱâÈ­
                    InitJobList(&gJobList);

                    // Step Manager ·Î À̵¿
                    gEditableJob = DISABLE;
                    gJobMgrPageInit = DISABLE;
                    gxPreDisplay = gxCurDisplay;
                    gxCurDisplay = PAGE_STEP_MGR;
                }
                break;
            case JM_DEL:
                if(gPreJobMgrMenu >= (u16)JM_SEL1 && gPreJobMgrMenu <= (u16)JM_SEL12 && gxLogined != DISABLE)
                {
                    DrawImage(PT_DELETE, PT_CON_BUTTONS_Y, NM_BT_DELETE);

                    SetRequestMessage("");
                    gxPrePreDisplay = gxPreDisplay;
                    gxPreDisplay = gxCurDisplay;
                    gxCurDisplay = PAGE_DIALOG;
                }
                break;
            default:
                DisplaySelection(gJobMgrMenu);
                break;
            }
            gJobMgrMenu = JM_NONE;
        }

        {   // Dialog box
            if(gxIsRequest == ENABLE)
            {
                // Is Delete job
                if(gxIsResult == ENABLE)
                    DeleteSelectJob(gPreJobMgrMenu);

                gxIsRequest = DISABLE;
                gxIsResult = DISABLE;
                gxPreDisplay = gxPrePreDisplay;
            }
        }
    }
}
예제 #8
0
void DisplayDelayPage(const TOUCH_INFO *TS)
{
    if(gDelayPageInit == DISABLE)
    {
        DrawImage(PT_ZERO, PT_ZERO, NM_BG_DELAY);

        if(gxIsDEditableStep != ENABLE)
        {
            // Delay Step 초기화
            gxDelayInfo.StepType = STEP_DELAY;
            memset(gxDelayInfo.StepName, 0x00, 20);
            strncpy(gxDelayInfo.StepName, "New Delay Step", strlen("New Delay Step"));
            gxDelayInfo.DelayTime = 1000;
        }

        {   // value display
            SetCharFont(&Font8x16);
            SetCharColor(BLACK, WHITE);
            u16 textWidth = 8 * strlen(gxDelayInfo.StepName) / 2;
            u16 textHeight = 16 / 2;
            DisplayString(
                CalcTextOrigin(PT_STEP_JOB_NAME_X, SZ_STEP_NAME_W) - textWidth,
                CalcTextOrigin(PT_STEP_JOB_NAME_Y, SZ_STEP_NAME_H) - textHeight,
                (u8*)gxDelayInfo.StepName);

            // DelayTime
            char strTemp[8] = {0, };
            sprintf(strTemp, "%.d", gxDelayInfo.DelayTime);
            textWidth = 8 * CalcOutputValueStrlen(gxDelayInfo.DelayTime) / 2;
            u16 xStart = PT_DELAY_TIME_X + (SZ_DELAY_TIME_W / 2);
            u16 yStart = PT_DELAY_TIME_Y + (SZ_DELAY_TIME_H / 2);
            DrawImage(PT_DELAY_TIME_X, PT_DELAY_TIME_Y, NM_BG_DELAY_TIME);
            DisplayString(xStart - textWidth, yStart - (16 / 2), (u8*)strTemp);

            gDelayPageInit = ENABLE;
        }
    }

    if(TS->Touched != FALSE)
    {
        gDelayMenu = AnalyzeDelayTouchArea(TS);

        // SAVE
        if(gDelayMenu == DLY_SAVE)
            DrawImage(PT_SAVE_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_SAVE_S);
        else
            DrawImage(PT_SAVE_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_SAVE);
        // CANCE
        if(gDelayMenu == DLY_CANCEL)
            DrawImage(PT_CANCEL_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_CANCEL_S);
        else
            DrawImage(PT_CANCEL_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_CANCEL);
    }
    else
    {
        if(gDelayMenu != DLY_NONE)
        {
            // Beep sound play
            PlayBeep();

            {   // Image
                if(gDelayMenu == DLY_SAVE)
                    DrawImage(PT_SAVE_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_SAVE);
                else if(gDelayMenu == DLY_CANCEL)
                    DrawImage(PT_CANCEL_X, PT_TITLE_BUTTONS_Y, NM_BT_STEP_CANCEL);
            }

            {   // Touched...page change process and control process
                if(gDelayMenu == DLY_STEP_NAME)
                {
                    SetKeyboardValue(gxDelayInfo.StepName, strlen(gxDelayInfo.StepName));
                    gxIsModify = TRUE;
                    gxPrePreDisplay = gxPreDisplay;
                    gxPreDisplay = gxCurDisplay;
                    gxCurDisplay = PAGE_KEYBOARD;
                }
                else if(gDelayMenu == DLY_SAVE || gDelayMenu == DLY_CANCEL)
                {
                    if(gDelayMenu == DLY_CANCEL && gxIsModify != TRUE)
                    {
                        gDelayPageInit = DISABLE;
                        gxIsDelayStep = ENABLE;
                        gxIsDSaveStep = DISABLE;
                        gxCurDisplay = PAGE_STEP_MGR;
                    }
                    else
                    {
                        // Save or Cancel
                        SetRequestMessage("");
                        /*
                        SetRequestMessage(
                        	gDelayMenu == DLY_SAVE ? "Do you want to save this step?" :
                        							  "Do you want to cancel this step?"
                        	);
                        */
                        gPreDelayMenu = gDelayMenu;
                        gxPrePreDisplay = gxPreDisplay;
                        gxPreDisplay = gxCurDisplay;
                        gxCurDisplay = PAGE_DIALOG;
                    }
                }
                else if(gDelayMenu == DLY_TIME)
                {
                    DP_POINT pt = { PT_DELAY_TIME_X, PT_DELAY_TIME_Y };

                    s16 setValue = gxDelayInfo.DelayTime;

                    // Setting
                    SetNumPadPosition(&pt, 0, 9999, setValue);

                    // Display
                    gxIsModify = TRUE;
                    gxPrePreDisplay = gxPreDisplay;
                    gxPreDisplay = gxCurDisplay;
                    gxCurDisplay = PAGE_NUMPAD;
                }
            }
            gDelayMenu = DLY_NONE;
        }

        {   // Touched...After process
            if(gxKbStrIsFlag == ENABLE)
            {
                gxPreDisplay = gxPrePreDisplay;
                gxKbStrIsFlag = DISABLE;

                if(gxKbIsEnter != DISABLE && gxKbBufIndex != 0)
                {
                    memset(gxDelayInfo.StepName, 0x00, 20);
                    strncpy(gxDelayInfo.StepName, (char*)gxKbBuf, gxKbBufIndex > 20 ? 20 : gxKbBufIndex);

                    // 배경 출력
                    DrawImage(PT_STEP_JOB_NAME_X, PT_STEP_JOB_NAME_Y, NM_BG_STEP_NAME);

                    // 값 출력
                    SetCharFont(&Font8x16);
                    SetCharColor(BLACK, WHITE);
                    u16 textWidth = 8 * strlen(gxDelayInfo.StepName) / 2;
                    u16 textHeight = 16 / 2;
                    DisplayString(
                        CalcTextOrigin(PT_STEP_JOB_NAME_X, SZ_STEP_NAME_W) - textWidth,
                        CalcTextOrigin(PT_STEP_JOB_NAME_Y, SZ_STEP_NAME_H) - textHeight,
                        (u8*)gxDelayInfo.StepName);

                    gxKbIsEnter = DISABLE;
                }
            }
            else if(gxNpKbStrIsFlag == ENABLE)
            {
                if(gxNpKbBufIndex != 0)
                {
                    // 값 변경
                    gxDelayInfo.DelayTime = atoi((char*)gxNpKbBuf);

                    // FONT 변경
                    SetCharFont(&Font8x16);
                    SetCharColor(BLACK, WHITE);

                    // 위치 구하고 디스플레이
                    u16 textWidth = 8 * gxNpKbBufIndex / 2;
                    u16 xStart = PT_DELAY_TIME_X + (SZ_DELAY_TIME_W / 2);
                    u16 yStart = PT_DELAY_TIME_Y + (SZ_DELAY_TIME_H / 2);
                    DrawImage(PT_DELAY_TIME_X, PT_DELAY_TIME_Y, NM_BG_DELAY_TIME);
                    DisplayString(xStart - textWidth, yStart - (16 / 2), (u8*)gxNpKbBuf);
                }
                gxPreDisplay = gxPrePreDisplay;
                gxNpKbStrIsFlag = DISABLE;
            }
        }

        {   // Reset or Delete position & SAVE, CANCEL
            if(gxIsRequest == ENABLE)
            {
                if(gxIsResult == ENABLE)
                {
                    if(gPreDelayMenu == DLY_SAVE || gPreDelayMenu == DLY_CANCEL)
                    {
                        gDelayPageInit = DISABLE;
                        gxIsDelayStep = ENABLE;
                        gxIsDSaveStep = gPreDelayMenu == DLY_SAVE ? ENABLE : DISABLE;
                        gxCurDisplay = PAGE_STEP_MGR;
                    }
                }
            }
        }
    }
}
예제 #9
0
//-----------------------------------------------------
void ServiceSetDateHappy(void){
 unsigned char time_out;
 ReadDsRtcTime(); // for month ans date happy
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_DATE_FILE);
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SELECT_DATE);
  time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
  if(KEY == PREV){ // set month
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_MONTH);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ SystemReload(); }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD();break; }
    if(KEY == PREV){ // month++
     CLEAR_KEYPAD();
     if(++AlarmHappy.month == 13){
      AlarmHappy.month = 1;
     }
    }
    if(KEY == NEXT){ // month--
     CLEAR_KEYPAD();
     if(--AlarmHappy.month == 0){
      AlarmHappy.month = 12;
     }
    }
    // PLAY CURRENT MONTH
    PlayServiceFile(PLAY_MONTH,(AlarmHappy.month-1));
   }
  }
  if(KEY == NEXT){ // set date
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_DAY);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ SystemReload(); }
    PlayBeep();
    if(KEY == EXIT){CLEAR_KEYPAD();break;}
    if(KEY == PREV){ // date++
     CLEAR_KEYPAD();
     if(++AlarmHappy.date == 29){
      if((AlarmHappy.month == 2) && (not_leap())){
       AlarmHappy.date = 1;
      }
     }
     if(AlarmHappy.date == 31){
      if((AlarmHappy.month==4)||(AlarmHappy.month==6)||(AlarmHappy.month==9)||(AlarmHappy.month==11)){
       AlarmHappy.date = 1;
      }
     }
     if(AlarmHappy.date == 32){
      AlarmHappy.date = 1;
     }
    }
    if(KEY == NEXT){ // date--
     CLEAR_KEYPAD();
     if(--AlarmHappy.date==0){
      if((AlarmHappy.month==4)||(AlarmHappy.month==6)||(AlarmHappy.month==9)||(AlarmHappy.month==11)){
       AlarmHappy.date=30;
      }else{
        AlarmHappy.date=31;
       }
      if(AlarmHappy.month == 2){
       AlarmHappy.date=29;
      }
      if((AlarmHappy.month == 2) && (not_leap())){
       AlarmHappy.date=28;
      }
     }
    }
    // PLAY CURRENT DATE
    PlayServiceFile(PLAY_DATE,(AlarmHappy.date-1));
   }
  }
 }
 return;
}
예제 #10
0
//-----------------------------------------------------
void ServiceSetTimeHappy(void){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_TIME_FILE);
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SELECT_TIME);
  time_out = WaitKey(PREV,NEXT,-1,EXIT);
  if(time_out == false){ SystemReload(); }
  PlayBeep();
  if(KEY == EXIT){CLEAR_KEYPAD();break;}
  if(KEY == PREV){ // set minute
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_MINUTE);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ SystemReload(); }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
    if(KEY == PREV){ // minute++
     CLEAR_KEYPAD();
     if(++AlarmHappy.minute == 60){
      AlarmHappy.minute = 0;
     }
    }
    if(KEY == NEXT){ // minute--
     CLEAR_KEYPAD();//clear KEY value
     if(AlarmHappy.minute == 0){
      AlarmHappy.minute = 59;
     }else{
       AlarmHappy.minute--;
      }
    }
    // PLAY CURRENT MINUTE
    PlayServiceFile(PLAY_MINUTE,AlarmHappy.minute);
   }
  }
  if(KEY == NEXT){ // set hour
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_HOUR);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ SystemReload(); }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
    if(KEY == PREV){ // hour++
     CLEAR_KEYPAD();
     if(++AlarmHappy.hour == 24){
      AlarmHappy.hour = 0;
     }
    }
    if(KEY == NEXT){ // hour--
     CLEAR_KEYPAD();
     if(AlarmHappy.hour == 0){
      AlarmHappy.hour = 23;
     }else{
       AlarmHappy.hour--;
      }
    }
    // PLAY CURRENT HOUR
    PlayServiceFile(PLAY_HOUR,AlarmHappy.hour);
   }
  }
 }
 return;
}
예제 #11
0
void DisplayKeyboardPage(const TOUCH_INFO* TS)
{
	if(gKeyboardPageInit == DISABLE)
	{
		// 배경 저장
		memcpy((VOID)LCD_5depth, (VOID)LCD_DISPLAY, LCD_LENGTH);
		
		// 초기화
		//gxKbBufIndex = 0;
		//memset(gxKbBuf, 0x00, sizeof(gxKbBuf) / sizeof(gxKbBuf[0]));
		//memset(gKbStr, 0x00, sizeof(gKbStr) / sizeof(gKbStr[0]));
		
		// 키보드 출력
		if(gxPreDisplay == PAGE_LOGIN)
			DisplayKeyboard(KEY_NUM);
		else
			DisplayKeyboard(KEY_UPPER);

		DisplayString(PT_STR_X, PT_STR_Y, gKbStr);
			
		gKeyboardPageInit = ENABLE;
	}
	
	if( TS->Touched != FALSE )
	{
		gKeyboardMenu = AnalyzeKeyboardTouchArea(TS);
	}
	else
	{
		if(gKeyboardMenu != 0)
		{
			// Beep sound play
			PlayBeep();
			
			switch (gKeyboardMenu)
			{
				case 11:
				 	// backspace
				 	if(gxKbBufIndex > 0)
						gxKbBuf[(gxKbBufIndex -= 1)] = 0x00;
					break;
				case 21: case 36:
					// enter
					memcpy((VOID)LCD_DISPLAY, (VOID)LCD_5depth, LCD_LENGTH);
					
					/*
					if(gKeyboardMenu == 21)
						if(gxPreDisplay == PAGE_LOGIN || gxPreDisplay == PAGE_SETTING)
							if(gxKbBufIndex == 0)
							{
                                gxKbBufIndex = 1;
								memset(gxKbBuf, 0x00, 128);
								memset(gxKbBuf, 0x30, 1);
							}
					*/
					gxKbStrIsFlag = ENABLE;
					gxKbIsEnter = gKeyboardMenu == 21 ? ENABLE : DISABLE;
					gKeyboardPageInit = DISABLE;
					gxCurDisplay = gxPreDisplay;
					break;
				case 22: case 32:
					// caps lock
					DisplayKeyboard(gKeyboardType == KEY_UPPER ? KEY_LOWER : KEY_UPPER);
					break;
				case 33: case 35:
					// key change
					DisplayKeyboard(gKeyboardType == KEY_NUM ? KEY_UPPER : KEY_NUM);
					break;
				case 34:
					// space
					gxKbBuf[gxKbBufIndex++] = 0x20;
					break;
				default:
					// character
					gxKbBuf[gxKbBufIndex++] =
						gKeyboardType == KEY_NUM ? KMAP_NUM[gKeyboardMenu - 1] :
						gKeyboardType == KEY_UPPER ? KMAP_UP[gKeyboardMenu - 1] :
																		 KMAP_DOWN[gKeyboardMenu - 1];
					break;
			}
			
			// 값 입력
			memset(gKbStr, 0x00, sizeof(gKbStr) / sizeof(gKbStr[0]));
			memcpy(gKbStr, gxKbBuf, gxKbBufIndex);
			
			// 출력 - 단 enter or close 가 아닌경우에만
			if(gKeyboardMenu != 21 && gKeyboardMenu != 36)
			{
				// Login 인 경우 * 변경
				if(gxPreDisplay == PAGE_LOGIN)// || gxPreDisplay == PAGE_SETTING)
					for(u16 index=0; index<(gxKbBufIndex-1); index++)
						gKbStr[index] = 0x2A;
						
				DisplayKeyboard(gKeyboardType);
				DisplayString(PT_STR_X, PT_STR_Y, gKbStr);
			}
			gKeyboardMenu = 0;
		}
	}
}
예제 #12
0
파일: service_rtc.c 프로젝트: AlexEvil/Bear
//-----------------------------------------------------
void ServiceSetDateRTC(void){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_DATE_FILE);
  while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_DATE_YEAR_CHANGE);
  time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
  if(time_out == false){ break; }
  PlayBeep();
  if(KEY == EXIT){ CLEAR_KEYPAD(); break; }

  if(KEY == PREV){ // set month
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_MONTH);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ break; }
    PlayBeep();
    if(KEY == EXIT){CLEAR_KEYPAD();break;}
    if(KEY == PREV){ // month++
     CLEAR_KEYPAD();
     if(++DS_CALENDAR.Month == 13) DS_CALENDAR.Month = 1;
    }
    if(KEY == NEXT){ // month--
     CLEAR_KEYPAD();
     if(--DS_CALENDAR.Month == 0) DS_CALENDAR.Month = 12;
    }
    // PLAY CURRENT MONTH
    PlayServiceFile(PLAY_MONTH,(DS_CALENDAR.Month-1));
   }
  }
  if(KEY == NEXT){ // set date
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_DAY);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ break; }
    PlayBeep();
    if(KEY == EXIT){CLEAR_KEYPAD();break;}
    if(KEY == PREV){ // date++
     CLEAR_KEYPAD();
     if(++DS_CALENDAR.Date == 29){ if((DS_CALENDAR.Date == 2) && (not_leap())){ DS_CALENDAR.Date = 1; } }
     if(  DS_CALENDAR.Date == 31){ if((DS_CALENDAR.Date==4)||(DS_CALENDAR.Date==6)||(DS_CALENDAR.Date==9)||(DS_CALENDAR.Date==11)){ DS_CALENDAR.Date = 1; } }
     if(  DS_CALENDAR.Date == 32){ DS_CALENDAR.Date = 1; }
    }
    if(KEY == NEXT){ // date--
     CLEAR_KEYPAD();
     if(--DS_CALENDAR.Date==0){
      if((DS_CALENDAR.Date==4)||(DS_CALENDAR.Date==6)||(DS_CALENDAR.Date==9)||(DS_CALENDAR.Date==11)){
       DS_CALENDAR.Date=30;
      }else{
        DS_CALENDAR.Date=31;
       }
      if(DS_CALENDAR.Date == 2){ DS_CALENDAR.Date=29; }
      if((DS_CALENDAR.Date == 2) && (not_leap())){
       DS_CALENDAR.Date=28;
      }
     }
    }
    // PLAY CURRENT DATE
    PlayServiceFile(PLAY_DATE,(DS_CALENDAR.Date-1));
   }
  }
  if(KEY == PLAY){ // set year
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_YEAR);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ break; }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
    if(KEY == PREV){ // year++
     CLEAR_KEYPAD();
     if(++DS_CALENDAR.Year > 20){
      DS_CALENDAR.Year = 0x09;
     }
    }
    if(KEY == NEXT){ // year--
     CLEAR_KEYPAD();
     if(--DS_CALENDAR.Year < 9){
      DS_CALENDAR.Year = 0x20;
     }
    }
    // PLAY CURRENT DATY
    PlayServiceFile(PLAY_YEAR,(DS_CALENDAR.Year-9));
   }
  }
 }
 return;
}
예제 #13
0
파일: service_rtc.c 프로젝트: AlexEvil/Bear
//-----------------------------------------------------
void ServiceSetTimeRTC(void){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SET_TIME_FILE);
 PlayTimeRTC();
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_TIME_CHANGE);
  time_out = WaitKey(PREV,NEXT,-1,EXIT);
  if(time_out == false) break;
  PlayBeep();
  if(KEY == EXIT){CLEAR_KEYPAD();break;}
  if(KEY == PREV){ // set minute
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_MINUTE);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ break; }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
    if(KEY == PREV){ // minute++
     CLEAR_KEYPAD();
     if(++DS_CALENDAR.Minutes == 60) DS_CALENDAR.Minutes = 0;
    }
    if(KEY == NEXT){ // minute--
     CLEAR_KEYPAD();//clear KEY value
     if(DS_CALENDAR.Minutes == 0){
      DS_CALENDAR.Minutes = 59;
     }else{
       DS_CALENDAR.Minutes--;
      }
    }
    // PLAY CURRENT MINUTE
    PlayServiceFile(PLAY_MINUTE,DS_CALENDAR.Minutes);
   }
  }
  if(KEY == NEXT){ // set hour
   CLEAR_KEYPAD();
   PlayServiceFile(PLAY_SERVICE,SERVICE_CHANGE_HOUR);
   while(1){
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false){ break; }
    PlayBeep();
    if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
    if(KEY == PREV){ // hour++
     CLEAR_KEYPAD();
     if(++DS_CALENDAR.Hour == 24) DS_CALENDAR.Hour = 0;
    }
    if(KEY == NEXT){ // hour--
     CLEAR_KEYPAD();//clear KEY value
     if(DS_CALENDAR.Hour == 0){
      DS_CALENDAR.Hour = 23;
     }else{
       DS_CALENDAR.Hour--;
      }
    }
    // PLAY CURRENT HOUR
    PlayServiceFile(PLAY_HOUR,DS_CALENDAR.Hour);
   }
  }
 }
 return;
}
예제 #14
0
파일: sys_bear.c 프로젝트: AlexEvil/Bear
//-----------------------------------------------------
void ServiceSystem(void){
 unsigned char time_out;
 PlayServiceFile(PLAY_SERVICE,SERVICE_SERVICE_FILE);
 while(1){
  PlayServiceFile(PLAY_SERVICE,SERVICE_SETTING_FILE);
  time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
  if(time_out == false) break;
  PlayBeep();
  if(KEY == EXIT){
   CLEAR_KEYPAD();
   break;
  }
  if(KEY == PREV){ //--SET DATE/TIME THE RTC--
   CLEAR_KEYPAD();
   ReadDsRtcTime(); // Read date/time RTC from DS3231
   while(1){
    PlayServiceFile(PLAY_SERVICE,SERVICE_DATE_TIME_FILE);
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false) break;
    PlayBeep();
    if(KEY == EXIT){
     CLEAR_KEYPAD();
     WriteDsRtcTime(); //Save date/time RTC to DS3231
     break;
    }
    if(KEY == PREV){ //Set DATE RTC
     CLEAR_KEYPAD();
     ServiceSetDateRTC();
    }
    if(KEY == NEXT){ //Set TIME RTC
     CLEAR_KEYPAD();
     ServiceSetTimeRTC();
    }
   }
  }
  if(KEY == NEXT){ //SET VOLUME
   CLEAR_KEYPAD();
   ServiceSetVolume();
  }
  if(KEY == PLAY){ //SET HAPPY and ALARM
   CLEAR_KEYPAD();
   while(1){
    PlayServiceFile(PLAY_SERVICE,SERVICE_HAPPY_ALARM_FILE);
    time_out = WaitKey(PREV,NEXT,-1,EXIT);
    if(time_out == false) break;
    PlayBeep();
    if(KEY == EXIT){
     CLEAR_KEYPAD();
     break;
    }
    if(KEY == NEXT){ // SET ALARM
     CLEAR_KEYPAD();
     ServiceSetAlarm();
    }
    if(KEY == PREV){ // SET DATE/TIME THE HAPPY
     CLEAR_KEYPAD();
     //LOAD_BIRTHDAY();//read current data/time the BIRTHDAY from eeprom
     //PlayFile(PLAY_SERVICE,SET_BIRTHDAY,0x00);
     //PlayFile(PLAY_SERVICE,CURRENT_BIRTHDAY,0x00);
     //PlayTimeBIRTHDAY();
     //PlayDateBIRTHDAY();
     while(1){
      PlayServiceFile(PLAY_SERVICE,SERVICE_SET_DATE_TIME_FILE);
      time_out = WaitKey(PREV,NEXT,-1,EXIT);
      if(time_out == false) break;
      PlayBeep();
      if(KEY == EXIT){
       CLEAR_KEYPAD();
       //SAVE_BIRTHDAY();//save current date/time the BIRTHDAY to eeprom
       break;
      }
      if(KEY == PREV){//Set DATE HAPPY
       CLEAR_KEYPAD();
       ServiceSetDateHappy();
      }
      if(KEY == PREV){ //Set TIME HAPPY
       CLEAR_KEYPAD();
       ServiceSetTimeHappy();
      }
     }
    }
   }
  }
 }
}
예제 #15
0
//-----------------------------------------------------
void ServiceSetTrackAlarm(unsigned char number_alarm){
 unsigned char time_out;
 unsigned char track;
 unsigned char ret_code;
 track = 0;
 PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_SELECT_MELODY_FILE);
 PlayServiceFile(PLAY_SERVICE,SERVICE_ALARM_SELECT_MELODY);
 while(1){
  ret_code = PlayAlarmFile(track);
  if(ret_code == 0){
   time_out = WaitKey(PREV,NEXT,PLAY,EXIT);
   if(time_out == false){ SystemReload(); }
   PlayBeep();
   if(KEY == EXIT){ CLEAR_KEYPAD(); break; }
   // save alarm melody
   if(KEY == PLAY){
    CLEAR_KEYPAD();
    Alarm[number_alarm].track = track;
   }
   // next alarm melody
   if(KEY == PREV){
    CLEAR_KEYPAD();
    track++;
    if(track >= MAX_ALARM_TRACK){
     track = 0;
    }
   }
   // prev alarm melody
   if(KEY == NEXT){
    CLEAR_KEYPAD();
    if(track == 0){
     track = (unsigned char)(MAX_ALARM_TRACK - 1);
    }else{
      track--;
     }
   }
  }else{
    // exit
    if(ret_code == 1){
     break;
    }
    switch(ret_code){
     case 2 : // save
              Alarm[number_alarm].track = track;
              break;
     case 3 : // next
              track++;
              if(track >= MAX_ALARM_TRACK){
               track = 0;
              }
              break;
     case 4 : // prev
              if(track == 0){
               track = (unsigned char)(MAX_ALARM_TRACK - 1);
              }else{
                track--;
               }
             break;
    }
   }

 }
 return;
}