示例#1
0
文件: ui.c 项目: idaohang/thattaway
//asks the user what slot they wish to save the destination to
//  const loc_state_t* loc - the location data to be read
void ui_save_screen(const loc_state_t* loc){
  uint16_t slot;
  uint8_t save_currloc = 0;
  //char button;
  char success;

  lcd_clrscr();
  lcd_puts_P("Save which?\n4)DEST 6)CURRLOC");
  save_currloc = ui_choice();

  lcd_clrscr();
  lcd_puts_P("Save to where?");
  slot = prompt_uint16(1); //ROW 1

  lcd_clrscr();
  if( slot < (NUM_SLOTS-1) ){
    if( save_currloc ){
      success = store_loc(slot, loc);
    } else {
      success = store_dest(slot, loc);
    }

    if( !success ){
      lcd_puts_P("SAVE FAILED!");
    } else {
      lcd_puts_P("SAVED");
    }
  } else {
    lcd_puts_P("INVALID SLOT!");
  }

  _delay_ms(MSG_WAIT);
}
示例#2
0
 void
 node::store (std::ostream &os, node_ptr const &root, bool text)
 {
   compress_hash ();
   NodeList list;
   list.set_root (root->index () + 1);
   foreach (node *n, nodes)
     {
       Node &sn = *list.add_node ();
       sn.set_index (n->index () + 1);
       store_loc (*sn.mutable_loc (), n->loc);
       if (generic_node *p = n->is<generic_node> ())
         {
           GenericNode &list = *sn.mutable_node ();
           list.set_type (p->type);
           foreach (node_ptr const &c, p->list)
             if (c)
               list.add_child (c->index () + 1);
             else
               list.add_child (0);
         }