コード例 #1
0
ファイル: BatteryMenu.c プロジェクト: jerpeter/NS8100
///----------------------------------------------------------------------------
///	Function Break
///----------------------------------------------------------------------------
void BatteryMnProc(INPUT_MSG_STRUCT msg, WND_LAYOUT_STRUCT *wnd_layout_ptr, MN_LAYOUT_STRUCT *mn_layout_ptr)
{
	INPUT_MSG_STRUCT mn_msg;
	uint32 input;

	switch (msg.cmd)
	{
		case (ACTIVATE_MENU_CMD):
			wnd_layout_ptr->start_col = BATTERY_WND_STARTING_COL;
			wnd_layout_ptr->end_col = BATTERY_WND_END_COL;
			wnd_layout_ptr->start_row = BATTERY_WND_STARTING_ROW;
			wnd_layout_ptr->end_row = BATTERY_WND_END_ROW;

			mn_layout_ptr->curr_ln = 1;
			mn_layout_ptr->top_ln = 1;
			mn_layout_ptr->sub_ln = 0;
			break;

		case (KEYPRESS_MENU_CMD):

			input = msg.data[0];
			switch (input)
			{
				case (ENTER_KEY):
					SETUP_USER_MENU_MSG(&configMenu, DEFAULT_ITEM_1);
					JUMP_TO_ACTIVE_MENU();
					break;
				case (DOWN_ARROW_KEY):
						break;
				case (UP_ARROW_KEY):
						break;
				case (MINUS_KEY): AdjustLcdContrast(DARKER); break;
				case (PLUS_KEY): AdjustLcdContrast(LIGHTER); break;
				case (ESC_KEY):
					SETUP_USER_MENU_MSG(&configMenu, BATTERY);
					JUMP_TO_ACTIVE_MENU();
					break;
				default:
						break;
			}
			break;

		default:
			break;
	}
}
コード例 #2
0
///----------------------------------------------------------------------------
///	Function Break
///----------------------------------------------------------------------------
void SummaryMenuProc(INPUT_MSG_STRUCT msg, WND_LAYOUT_STRUCT *wnd_layout_ptr)
{
	INPUT_MSG_STRUCT mn_msg;
	uint16 tempSummaryIndex = 0;

	if (msg.cmd == ACTIVATE_MENU_CMD)
	{
		wnd_layout_ptr->start_col = SUMMARY_WND_STARTING_COL; /* 6 */
		wnd_layout_ptr->end_col = SUMMARY_WND_END_COL; /* 127 leaving one pixel space at the end */
		wnd_layout_ptr->start_row = SUMMARY_WND_STARTING_ROW; /* 8 */
		wnd_layout_ptr->end_row = SUMMARY_WND_END_ROW; /* 6 */

		DumpSummaryListFileToEventBuffer();

		g_summaryListMenuActive = YES;
		
		s_totalRamSummaries = g_summaryList.validEntries;

		if (msg.data[0] == START_FROM_TOP)
		{
			// Find the first valid summary index and set the top and current index to match
			s_topMenuSummaryIndex = s_currentSummaryIndex = GetFirstValidRamSummaryIndex();
			debug("First valid ram summary index: %d\r\n", s_topMenuSummaryIndex);
			
			g_summaryListArrowChar = DOWN_ARROW_CHAR;
		}
	}
	else if (msg.cmd == KEYPRESS_MENU_CMD)
	{
		switch (msg.data[0])
		{
			case (ENTER_KEY):
				// Check if the top menu summary index represents a valid index
				if (s_topMenuSummaryIndex < g_summaryList.validEntries)
				{
					// Grab the event info, assuming it's cached
					cacheSummaryListEntry(s_currentSummaryIndex);

					g_summaryEventNumber = g_summaryList.cachedEntry.eventNumber;
					g_updateResultsEventRecord = YES;

					debug("Summary menu: Calling Results Menu for Event #%d\r\n", g_summaryEventNumber);

					switch (g_summaryList.cachedEntry.mode)
					{
						case WAVEFORM_MODE:
						case MANUAL_CAL_MODE:
						case BARGRAPH_MODE: 
						case COMBO_MODE:
							SETUP_MENU_MSG(RESULTS_MENU);
							JUMP_TO_ACTIVE_MENU();
							break;

						case MANUAL_TRIGGER_MODE:
							break;

						default:
							break;
					} 
				}
				break;
				
			case (DOWN_ARROW_KEY):
				// Check if the top menu summary index represents a valid index
				if (s_topMenuSummaryIndex < s_totalRamSummaries)
				{
					SummaryMenuScroll(DOWN);
				}
				break;
			case (UP_ARROW_KEY):
				// Check if the top menu summary index represents a valid index
				if (s_topMenuSummaryIndex < s_totalRamSummaries)
				{
					SummaryMenuScroll(UP);
				}
				break;
				
			case (ESC_KEY):
				tempSummaryIndex = GetFirstValidRamSummaryIndex();
				
				// Check if the top menu summary index represents a valid index and if the current index isn't the first
				if ((s_topMenuSummaryIndex < s_totalRamSummaries) && (tempSummaryIndex != s_currentSummaryIndex))
				{
					s_topMenuSummaryIndex = s_currentSummaryIndex = tempSummaryIndex;

					g_summaryListArrowChar = DOWN_ARROW_CHAR;

					debug("Summary List: Setting Current Index to first valid Summary index\r\n");
				}
				else // We're done here
				{
					g_summaryListMenuActive = NO;
					
					SETUP_USER_MENU_MSG(&configMenu, EVENT_SUMMARIES);
					JUMP_TO_ACTIVE_MENU();
				}
				break;
			default:
				break;
		}
	}
}
コード例 #3
0
ファイル: TimerModeTimeMenu.c プロジェクト: jerpeter/NS8100
///----------------------------------------------------------------------------
///	Function Break
///----------------------------------------------------------------------------
void TimerModeTimeMenuProc(INPUT_MSG_STRUCT msg, REC_MN_STRUCT *rec_ptr, WND_LAYOUT_STRUCT *wnd_layout_ptr, MN_LAYOUT_STRUCT *mn_layout_ptr)
{
	INPUT_MSG_STRUCT mn_msg;
	DATE_TIME_STRUCT time;
	uint32 input;

	switch (msg.cmd)
	{
		case (ACTIVATE_MENU_CMD):
			wnd_layout_ptr->start_col = TIMER_MODE_TIME_WND_STARTING_COL;
			wnd_layout_ptr->end_col = TIMER_MODE_TIME_WND_END_COL;
			wnd_layout_ptr->start_row = TIMER_MODE_TIME_WND_STARTING_ROW;
			wnd_layout_ptr->end_row = TIMER_MODE_TIME_WND_END_ROW;

			mn_layout_ptr->curr_ln = 0;
			mn_layout_ptr->top_ln = 0;
			mn_layout_ptr->sub_ln = 0;

			time = GetCurrentTime();
			LoadTimerModeTimeMnDefRec(rec_ptr,&time);
			rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
			break;

		case (ACTIVATE_MENU_WITH_DATA_CMD):
			wnd_layout_ptr->start_col = TIMER_MODE_TIME_WND_STARTING_COL;
			wnd_layout_ptr->end_col = TIMER_MODE_TIME_WND_END_COL;
			wnd_layout_ptr->start_row = TIMER_MODE_TIME_WND_STARTING_ROW;
			wnd_layout_ptr->end_row = TIMER_MODE_TIME_WND_END_ROW;

			mn_layout_ptr->curr_ln = 0;
			mn_layout_ptr->top_ln = 0;
			mn_layout_ptr->sub_ln = 0;

			rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
			break;

		case (KEYPRESS_MENU_CMD):

			input = msg.data[0];
			switch (input)
			{

				case (ENTER_KEY):
						rec_ptr[s_dataRecordCurrentItem].enterflag = FALSE;
						TimerModeKeepTime(rec_ptr);

						SETUP_MENU_MSG(TIMER_MODE_DATE_MENU);
						JUMP_TO_ACTIVE_MENU();
						break;
				case (DOWN_ARROW_KEY):
						if (rec_ptr[mn_layout_ptr->curr_ln].enterflag == TRUE)
						{
						TimerModeTimeMenuDvScroll(DOWN,&rec_ptr[mn_layout_ptr->curr_ln]);
						}
						break;
				case (UP_ARROW_KEY):
						if (rec_ptr[mn_layout_ptr->curr_ln].enterflag == TRUE)
						{
						TimerModeTimeMenuDvScroll(UP,&rec_ptr[mn_layout_ptr->curr_ln]);
						}
						break;
				case (PLUS_KEY):
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = FALSE;
						TimerModeTimeMenuScroll(DOWN, mn_layout_ptr);
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
						break;
				case (MINUS_KEY):
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = FALSE;
						TimerModeTimeMenuScroll(UP, mn_layout_ptr);
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
						break;
				case (ESC_KEY):
					SETUP_USER_MENU_MSG(&timerModeFreqMenu, g_unitConfig.timerModeFrequency);
						JUMP_TO_ACTIVE_MENU();
						break;
				default:
						break;
			}
			break;

		default:
			break;
	}
}
コード例 #4
0
///----------------------------------------------------------------------------
///	Function Break
///----------------------------------------------------------------------------
void TimerModeDateMenuProc(INPUT_MSG_STRUCT msg, REC_MN_STRUCT *rec_ptr, WND_LAYOUT_STRUCT *wnd_layout_ptr, MN_LAYOUT_STRUCT *mn_layout_ptr)
{
	INPUT_MSG_STRUCT mn_msg;
	DATE_TIME_STRUCT time;
	uint32 input;
	//uint8 dayOfWeek = 0;

	switch (msg.cmd)
	{
		case (ACTIVATE_MENU_CMD):
			wnd_layout_ptr->start_col = TIMER_MODE_DATE_WND_STARTING_COL;
			wnd_layout_ptr->end_col = TIMER_MODE_DATE_WND_END_COL;
			wnd_layout_ptr->start_row = TIMER_MODE_DATE_WND_STARTING_ROW;
			wnd_layout_ptr->end_row = TIMER_MODE_DATE_WND_END_ROW;

			mn_layout_ptr->curr_ln = 0;
			mn_layout_ptr->top_ln = 0;
			mn_layout_ptr->sub_ln = 0;

			time = GetCurrentTime();
			LoadTimerModeDateMnDefRec(rec_ptr, &time);
			rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
			break;

		case (KEYPRESS_MENU_CMD):

			input = msg.data[0];
			switch (input)
			{
				case (ENTER_KEY):
					g_unitConfig.timerStartDate.day = (char)rec_ptr[TMD_START_DAY].numrec.tindex;
					g_unitConfig.timerStartDate.month = (char)rec_ptr[TMD_START_MONTH].numrec.tindex;
					g_unitConfig.timerStartDate.year = (char)rec_ptr[TMD_START_YEAR].numrec.tindex;
					g_unitConfig.timerStopDate.day = (char)rec_ptr[TMD_STOP_DAY].numrec.tindex;
					g_unitConfig.timerStopDate.month = (char)rec_ptr[TMD_STOP_MONTH].numrec.tindex;
					g_unitConfig.timerStopDate.year = (char)rec_ptr[TMD_STOP_YEAR].numrec.tindex;

					ProcessTimerModeSettings(PROMPT);

					SETUP_USER_MENU_MSG(&configMenu, DEFAULT_ITEM_1);
					JUMP_TO_ACTIVE_MENU();
					break;
				case (DOWN_ARROW_KEY):
						if (rec_ptr[mn_layout_ptr->curr_ln].enterflag == TRUE)
						{
						TimerModeDateMenuDvScroll(DOWN, &rec_ptr[mn_layout_ptr->curr_ln]);
						}
						break;
				case (UP_ARROW_KEY):
						if (rec_ptr[mn_layout_ptr->curr_ln].enterflag == TRUE)
						{
						TimerModeDateMenuDvScroll(UP, &rec_ptr[mn_layout_ptr->curr_ln]);
						}
						break;
				case (PLUS_KEY):
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = FALSE;
						TimerModeDateMenuScroll(DOWN, mn_layout_ptr);
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
						break;
				case (MINUS_KEY):
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = FALSE;
						TimerModeDateMenuScroll(UP, mn_layout_ptr);
						rec_ptr[mn_layout_ptr->curr_ln].enterflag = TRUE;
						break;
				case (ESC_KEY):
						SETUP_MENU_MSG(TIMER_MODE_TIME_MENU);
						JUMP_TO_ACTIVE_MENU();
						break;
				default:
						break;
			}
			break;

		default:
			break;
	}
}
コード例 #5
0
ファイル: LoadRecord.c プロジェクト: jerpeter/NS8100
///----------------------------------------------------------------------------
///	Function Break
///----------------------------------------------------------------------------
void LoadRecordMenuProc(INPUT_MSG_STRUCT msg, WND_LAYOUT_STRUCT *wnd_layout_ptr, MN_LAYOUT_STRUCT *mn_layout_ptr)
{
    uint8 buff[20];
    REC_EVENT_MN_STRUCT temp_rec;
    INPUT_MSG_STRUCT mn_msg;
    uint32 input;
    uint8 i;

    switch (msg.cmd)
    {
    case (ACTIVATE_MENU_CMD):
        wnd_layout_ptr->start_col = LOAD_REC_WND_STARTING_COL;
        wnd_layout_ptr->end_col = LOAD_REC_WND_END_COL;
        wnd_layout_ptr->start_row = LOAD_REC_WND_STARTING_ROW;
        wnd_layout_ptr->end_row = LOAD_REC_WND_END_ROW;

        mn_layout_ptr->curr_ln = 1;
        mn_layout_ptr->top_ln = 1;

        LoadTempMenuTable(s_loadRecordMenuTable);

        for (i = 1; i <= MAX_NUM_OF_SAVED_SETUPS; i++)
        {
            GetRecordData(&temp_rec, i, REC_TRIGGER_USER_MENU_TYPE);

            if (temp_rec.validRecord == YES)
            {
                switch (temp_rec.opMode)
                {
                case (WAVEFORM_MODE):
                    sprintf((char*)buff, "%s (%s)", (char*)temp_rec.name, getLangText(SELF_TRG_TEXT));
                    break;
                case (BARGRAPH_MODE):
                    sprintf((char*)buff, "%s (%s)", (char*)temp_rec.name, getLangText(BAR_TEXT));
                    break;
                case (COMBO_MODE):
                    sprintf((char*)buff, "%s (%s)", (char*)temp_rec.name, getLangText(COMBO_TEXT));
                    break;
                default:
                    sprintf((char*)buff, "%s (UNK)", (char*)temp_rec.name);
                    break;
                }

            }
            else
            {
                sprintf((char*)buff, "<%s>", getLangText(EMPTY_TEXT));
            }

            // Add 3 to i to offset past the default settings
            strcpy((char*)&(g_menuPtr[i + 3].data[0]), (char*)buff);
        }

        // Add in the "<END>" text to signal the end of the list
        sprintf((char*)buff, "<%s>", getLangText(END_TEXT));
        strcpy((char*)&(g_menuPtr[i + 3].data[0]), (char*)buff);
        i++;

        // Add the end string to allow other routines to match on the end of the menu
        strcpy((char*)&(g_menuPtr[i + 3].data[0]), ".end.");
        break;

    case (KEYPRESS_MENU_CMD):
        input = msg.data[0];
        switch (input)
        {
        case (ENTER_KEY):
            switch (mn_layout_ptr->curr_ln)
            {
            case (1):
                LoadTrigRecordDefaults(&g_triggerRecord, WAVEFORM_MODE);
                break;
            case (2):
                LoadTrigRecordDefaults(&g_triggerRecord, BARGRAPH_MODE);
                break;
            case (3):
                LoadTrigRecordDefaults(&g_triggerRecord, COMBO_MODE);
                break;
            default:
                // Check if the first char matches a "<" for either "<EMPTY>" or "<END>"
                if (strncmp((char*)&g_menuPtr[mn_layout_ptr->curr_ln].data[0], "<", 1) == 0)
                {
                    // Record slot is empty, do nothing
                    return;
                }
                else
                {
                    GetRecordData(&g_triggerRecord, (uint32)(mn_layout_ptr->curr_ln - 3), REC_TRIGGER_USER_MENU_TYPE);
                }
                break;
            }

            UpdateModeMenuTitle(g_triggerRecord.opMode);
            SETUP_USER_MENU_MSG(&modeMenu, MONITOR);
            JUMP_TO_ACTIVE_MENU();
            break;

        case (DELETE_KEY):
            // Check if the current line is beyond the default entries
            if (mn_layout_ptr->curr_ln > 3)
            {
                GetRecordData(&temp_rec, (uint32)(mn_layout_ptr->curr_ln - 3), REC_TRIGGER_USER_MENU_TYPE);

                if (temp_rec.validRecord == YES)
                {
                    sprintf((char*)g_spareBuffer, "%s (%s)", getLangText(DELETE_SAVED_SETUP_Q_TEXT), temp_rec.name);

                    if (MessageBox(getLangText(WARNING_TEXT), (char*)g_spareBuffer, MB_YESNO) == MB_FIRST_CHOICE)
                    {
                        memset(&temp_rec.name, 0, sizeof(temp_rec.name));
                        temp_rec.validRecord = NO;

                        SaveRecordData(&temp_rec, (uint32)(mn_layout_ptr->curr_ln - 3), REC_TRIGGER_USER_MENU_TYPE);

                        sprintf((char*)&(g_menuPtr[mn_layout_ptr->curr_ln].data[0]), "<%s>", getLangText(EMPTY_TEXT));
                    }
                }
            }
            break;

        case (DOWN_ARROW_KEY):
            MenuScroll(DOWN, SELECT_MN_WND_LNS, mn_layout_ptr);

            // Prevent the cursor from selecting the "<END>" text
            if (mn_layout_ptr->curr_ln == 18)
            {
                mn_layout_ptr->curr_ln = 17;
            }
            break;
        case (UP_ARROW_KEY):
            MenuScroll(UP, SELECT_MN_WND_LNS, mn_layout_ptr);
            break;
        case (ESC_KEY):
            SETUP_MENU_MSG(MAIN_MENU);
            mn_msg.data[0] = ESC_KEY;
            JUMP_TO_ACTIVE_MENU();
            break;
        case (HELP_KEY):
            SETUP_USER_MENU_MSG(&helpMenu, CONFIG);
            JUMP_TO_ACTIVE_MENU();
            break;
        default:
            break;
        }
        break;

    default:
        break;
    }
}