Пример #1
0
/**
 *   \brief This will toggle the CONTIKI and 6LOWPAN LCD menus in the main
 *   menu position, unless alternate text has been sent from the 1284p.
 *   The other menus will display normally.
*/
void
check_main_menu(void)
{
uint8_t showtop=0;

    if(menu.text == menu_text0){
        read_menu(1);
        showtop=1;
    }
    else if(menu.text == menu_text1){
        read_menu(0);
        showtop=1;
    }
    if (showtop) {
        if (top_menu_text[0]) {
            lcd_puts(top_menu_text);
            return;
        }
	}
    lcd_puts_P(menu.text);
}
Пример #2
0
uint8_t function_menu() {
  uint8_t func_number;

  display_menu();
  func_number = read_menu();
  if (func_number == 0) {
	  return 0;
  } else {
	  do_menu(func_number);
          lcd_MEM2_string(Done_str);	// "Done.\n"
	  lcd_refresh();
	  return 1;
  }
}
Пример #3
0
void state_help_menu(User *usr, char c) {
char filename[MAX_PATHLEN];

	if (usr == NULL)
		return;

	Enter(state_help_menu);

	switch(c) {
		case INIT_PROMPT:
			break;

		case INIT_STATE:
			usr->runtime_flags |= RTF_BUSY;

			buffer_text(usr);

			Put(usr, "<magenta>\n"
				"<hotkey>Introduction                 Editing recipient <hotkey>lists\n"
				"e<hotkey>Xpress messages             Editing with <hotkey>colors\n"
				"<hotkey>Friends and enemies          <hotkey>Navigating the --More-- prompt\n"
			);
			Put(usr,
				"Reading and posting <hotkey>messages\n"
				"The <hotkey>room system\n"
				"Customizing your <hotkey>profile     <hotkey>Other commands\n"
			);
			read_menu(usr);
			Return;

		case ' ':
		case KEY_RETURN:
		case KEY_CTRL('C'):
		case KEY_CTRL('D'):
		case KEY_BS:
			Put(usr, "\n");
			RET(usr);
			Return;

		case KEY_CTRL('L'):
			Put(usr, "\n");
			CURRENT_STATE(usr);
			Return;

		case '`':
			CALL(usr, STATE_BOSS);
			Return;

		case 'i':
		case 'I':
			Put(usr, "Introduction\n");
			HELP_TEXT("intro");

		case 'x':
		case 'X':
			Put(usr, "eXpress Messages\n");
			HELP_TEXT("xmsg");

		case 'f':
		case 'F':
			Put(usr, "Friends and Enemies\n");
			HELP_TEXT("friends");

		case 'm':
		case 'M':
			Put(usr, "Reading and posting messages\n");
			HELP_TEXT("msgs");

		case 'r':
		case 'R':
			Put(usr, "The room system\n");
			HELP_TEXT("rooms");

		case 'p':
		case 'P':
			Put(usr, "Customizing your profile\n");
			HELP_TEXT("profile");

		case 'l':
		case 'L':
			Put(usr, "Editing recipient lists\n");
			HELP_TEXT("recipients");

		case 'c':
		case 'C':
			Put(usr, "Editing with colors\n");
			HELP_TEXT("colors");

		case 'n':
		case 'N':
			Put(usr, "Navigating the --More-- prompt\n");
			HELP_TEXT("more");

		case 'o':
		case 'O':
			Put(usr, "Other commands\n");
			HELP_TEXT("other");
	}
	Print(usr, "<yellow>\n[Help] %c <white>", (usr->runtime_flags & RTF_SYSOP) ? '#' : '>');
	Return;
}
Пример #4
0
/**
 *   \brief This is main...
*/
int
main(void)
{
    lcd_init();

    key_init();

    uart_init();

    eeprom_init();

    temp_init();

    timer_init();

    sei();

    lcd_symbol_set(LCD_SYMBOL_RAVEN);
    lcd_symbol_set(LCD_SYMBOL_IP);

    /* Start with main menu */
    read_menu(0);
    /* and draw it */
    lcd_puts_P(menu.text);

    timer_start();

    for (;;){
        /* Make sure interrupts are always on */
        sei();

        /* The one second timer has fired. */
        if(timer_flag){
            timer_flag = false;
            /* Check if main menu needs toggled. */
            check_main_menu();
            /* Update LCD with temp data. */
            if(temp_flag){
                menu_display_temp();
            }
            /* Auto send temp data to 1284p. */
            if(auto_temp){
                menu_send_temp();
            }
            /* If ping mode, send 4 ping requests and then stop. */
            if(ping_mode){
                if((PING_ATTEMPTS == count) && !timeout_flag){
                    count = 0;
                    timeout_count = 0;
                    menu_stop_ping();
                }
                else if(timeout_flag){
                    timeout_flag = false;
                    timeout_count++;
                    /* Display timeout message if all PING_ATTEMPTS were not successful. */
                    if(PING_ATTEMPTS == timeout_count){
                        lcd_puts_P(PSTR("PINGS FAILED"));
                    }
                }
                else{
                    count = menu_send_ping();
                }
            }
        }

        /* Check for button press and deal with it */
        if (is_button()){
            /* Dispatch the button pressed */
            switch (get_button()){
                case KEY_UP:
                    read_menu(menu.up);
                    lcd_puts_P(menu.text);
                    break;
                case KEY_DOWN:
                    read_menu(menu.down);
                    lcd_puts_P(menu.text);
                    break;
                case KEY_LEFT:
                    read_menu(menu.left);
                    lcd_puts_P(menu.text);
                    break;
                case KEY_RIGHT:
                    /*
                     * Check to see if we should show another menu or
                     * run a function
                     */
                    if (!menu.enter_func){
                        /* Just another menu to display */
                        read_menu(menu.right);
                        lcd_puts_P(menu.text);
                        break;
                    }
                    /* Drop through here */
                case KEY_ENTER:
                    /* Call the menu function on right or enter buttons */
                    if (menu.enter_func){
                        menu.enter_func(menu.state);
                        if (menu.state){
                            /*
                             * We just called a selection menu (not a test),
                             * so re-display the text for this menu level
                             */
                            lcd_puts_P(menu.text);
                        }
                        /* After enter key, check the right button menu and display. */
                        read_menu(menu.right);
                        lcd_puts_P(menu.text);
                    }
                    break;
                default:
                    break;
            }
            /* After button press, check for menus... */
            check_menu();
        }
        /* Process any progress frames */
        uart_serial_rcv_frame(false);
    } /* end for(). */
} /* end main(). */