void getIR_test(struct RAWcmd_* cmd) { unsigned char x; struct ir_raw_ capture; lcd_fill(0); draw_string(0,0,"Beide Fernbedienungen\neinander gegenüber\nlegen, so dass die Infra-\nrotschnittstellen direkt\nzueinander liegen.\nAbstand 2-10cm\nAnzulernene Taste drücken.", 3, DRAW_PUT); x=captureIR(&capture); lcd_fill(0); draw_numU(90,16,x,0, 3, DRAW_PUT); debug_print_capture(&capture); clear_cmd(cmd); x = analyzeIR(&capture, cmd); //debug_print_cmd(cmd); draw_numU(90,24,x,0, 3, DRAW_PUT); if(x) draw_string(97,24,"FAIL", 3, DRAW_PUT); else draw_string(97,24,"OK", 3, DRAW_PUT); }
/* * Set up the display to start a new toggle-option command. */ static void mca_opt_toggle(void) { int no_prompt; int flag; char *dash; no_prompt = (optflag & OPT_NO_PROMPT); flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; mca = A_OPT_TOGGLE; clear_bot(); clear_cmd(); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); if (no_prompt) cmd_putstr("(P)"); switch (flag) { case OPT_UNSET: cmd_putstr("+"); break; case OPT_SET: cmd_putstr("!"); break; } set_mlist(NULL, 0); }
/* * Set up the display to start a new search command. */ static void mca_search(void) { if (search_type & SRCH_FILTER) mca = A_FILTER; else if (search_type & SRCH_FORW) mca = A_F_SEARCH; else mca = A_B_SEARCH; clear_bot(); clear_cmd(); if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) cmd_putstr("First-file "); if (search_type & SRCH_PAST_EOF) cmd_putstr("EOF-ignore "); if (search_type & SRCH_NO_MOVE) cmd_putstr("Keep-pos "); if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); if (search_type & SRCH_FILTER) cmd_putstr("&/"); else if (search_type & SRCH_FORW) cmd_putstr("/"); else cmd_putstr("?"); set_mlist(ml_search, 0); }
void sig_handler(int sig) { t_sh *shell; shell = get_sh_info(NULL); SETFLAG(shell->signal, FLAGPOS(sig)); if (sig == SIGINT) { my_putstr("\n", 1, -1); my_putstr(shell->param.str_prompt, 1, -1); if (shell->param.fallback == 1) { if (shell->param.cmd != NULL) shell->param.cmd[0] = '\0'; shell->param.pos = 0; refresh_view(&(shell->param)); view(shell->param.cmd, &(shell->param)); } } if (sig == SIGWINCH && shell->param.fallback == 1) clear_cmd(shell->param.cmd, &(shell->param)); if ((sig == SIGHUP) || (sig == SIGTERM) || (sig == SIGQUIT)) { SETFLAG(shell->beepbeepexit, FLAGPOS(EXIT_F_POS)); close(0); } init_sig(&sig_handler); }
/* * Set up the display to start a new multi-character command. */ static void start_mca(int action, const char *prompt, void *mlist, int cmdflags) { mca = action; clear_bot(); clear_cmd(); cmd_putstr((char *)prompt); set_mlist(mlist, cmdflags); }
void RAW_allkeyserase(FORM* form, CONTROL* control) { unsigned char x; x=msgbox(50,BC_YesNo | BC_DefaultButton2,"Moechten Sie wirklich\nalle Tasten loeschen?\n"); if(x == BC_Yes) { for(x=0;x<38;x++) { clear_cmd(&(((struct RAWset_*)(form->tag))->RAWcmd[x])); } } /* unsigned long y; unsigned char* z; z=(struct RAWset_*)(form->tag); for(y=0;y<sizeof(struct RAWset_);y++) z[y]=y & 0xff; ((struct RAWset_*)(form->tag))->name[0] = 0; */ form_draw(form); }
void RAW_keyerase(FORM* form, CONTROL* control) { unsigned char x; x=msgbox(50,BC_nobuttons,"\nZu loeschende Taste\ndruecken.\n"); waitKeyDown(); x=getKeynum(); if(x>3) { /* unsigned short y; unsigned char* z; z=&((struct RAWset_*)(form->tag))->RAWcmd[x-4]; for(y=0;y<sizeof(struct RAWcmd_);y++) { z[y]=x; }*/ clear_cmd(&(((struct RAWset_*)(form->tag))->RAWcmd[x-4])); } form_draw(form); }
void RAW_editset(FORM* form, CONTROL* control) { struct RAWset_ RAWset; const BUTTON button1 = {BC_Button,0,15,120,15,SMALLFONT,0,"Anlernen/Testen",RAW_learnset}; const BUTTON button2 = {BC_Button,0,35,120,15,SMALLFONT,0,"Taste loeschen",RAW_keyerase}; const BUTTON button3 = {BC_Button,0,55,120,15,SMALLFONT,0,"Alle Tasten loeschen",RAW_allkeyserase}; const LABEL label1 = {BC_Labelnotab,0,80,60,10,BOLDFONT,0,"Bezeichnung",0}; TXTBOX txtbox1 = {BC_Txtbox,0,90,120,10,SMALLFONT,20,0,(char*)RAWset.name,0}; CONTROL* controls[5] = { (CONTROL*)&button1, (CONTROL*)&button2, (CONTROL*)&button3, (CONTROL*)&label1, (CONTROL*)&txtbox1}; FORM form2 = {"RAW Set bearbeiten",0,0,0,0,controls,0,5}; unsigned long x; x = (unsigned long)BFS_LoadFileAddr(BFS_ID_RAWslot0 + ((LABEL*)control)->tag); draw_hexW(0,100,x,3,DRAW_PUT); if(x) memcpy(&RAWset,(void *)x,sizeof(struct RAWset_)); else RAWset.id[0] = 0xff; x=memcmp(&RAWset,"RC01",4); if(x) { for(x=0;x<RAWnamelen;x++) RAWset.name[x]=0xff; for(x=0;x<38;x++) { clear_cmd(&RAWset.RAWcmd[x]); } BFS_SaveFile(BFS_ID_RAWslot0 + ((LABEL*)control)->tag, sizeof(struct RAWset_), (unsigned char*) &RAWset); } if(RAWset.name[0]==0xff) memcpy(&RAWset.name[0],(char*)string_unknown,len_string_unknown); form2.tag =(unsigned long)&RAWset; form_exec(&form2); if(!memcmp(&RAWset.name[0],string_unknown,len_string_unknown)) for(x=0;x<len_string_unknown;x++) RAWset.name[x] = 0xff; if(BFS_CmpFile(BFS_ID_RAWslot0 + ((LABEL*)control)->tag, sizeof(struct RAWset_), (unsigned char*) &RAWset) == 0) { x=msgbox(50,BC_YesNo | BC_DefaultButton1,"Sollen die Aenderungen\ngespeichert werden?\n"); if(x == BC_Yes) { memcpy(&RAWset.id[0],"RC01",4); BFS_SaveFile(BFS_ID_RAWslot0 + ((LABEL*)control)->tag, sizeof(struct RAWset_), (unsigned char*) &RAWset); if(BFS_CmpFile(BFS_ID_RAWslot0 + ((LABEL*)control)->tag, sizeof(struct RAWset_), (unsigned char*) &RAWset) == 0) { msgbox(50,BC_OKOnly | BC_DefaultButton1,"Fehler\n"); } } } form_draw(form); }
void getIR(struct RAWcmd_* cmd) { unsigned char x; struct ir_raw_ capture; x=1; while(x) { while(x) { draw_string(0,20,"Beide Fernbedienungen\neinander gegenueber\nlegen, so dass die Infra-\nrotschnittstellen direkt\nzueinander liegen.\nAbstand 2-10cm\nAnzulernene Taste druecken", 3, DRAW_PUT); x=captureIR(&capture); draw_block(0,20,128,9*7,3,DRAW_ERASE); if(x) { switch(x) { case 1: draw_string(0,20,"Befehl kann nicht eingelesen\nwerden.", 3, DRAW_PUT); break; case 2: return; case 3: draw_string(0,20,"Signal zu lange.\nBitte kuerzer druecken.", 3, DRAW_PUT); break; default: draw_string(0,20,"Fehler beim eingelesen.", 3, DRAW_PUT); } draw_string(0,56,"Exit zum abbrechen, andere\nTaste zum wiederholen", 3, DRAW_PUT); waitKeyUpDown(); if(KEY_Exit) { draw_block(0,20,128,54,3,DRAW_ERASE); return; } draw_block(0,20,128,45,3,DRAW_ERASE); } } clear_cmd(cmd); x = analyzeIR(&capture, cmd); if(x) { switch(x) { case 1: draw_string(0,20,"Signal zu lange.\nBitte kuerzer druecken.", 3, DRAW_PUT); break; case 2: draw_string(0,20,"Signal zu kurz.\nBitte laenger druecken.", 3, DRAW_PUT); break; case 3: draw_string(0,20,"Fehler beim Signalvergleich", 3, DRAW_PUT); break; case 4: draw_string(0,20,"Datenformat zu lange.", 3, DRAW_PUT); break; case 5: draw_string(0,20,"Unbekanntes Datenformat.", 3, DRAW_PUT); break; default: draw_string(0,20,"Fehler beim decodieren.", 3, DRAW_PUT); } draw_string(0,56,"Exit zum abbrechen, andere\nTaste zum wiederholen", 3, DRAW_PUT); waitKeyUpDown(); if(KEY_Exit) { draw_block(0,20,128,54,3,DRAW_ERASE); return; } draw_block(0,20,128,54,3,DRAW_ERASE); } } }
/* * Display the appropriate prompt. */ static void prompt(void) { const char *p; if (ungot != NULL) { /* * No prompt necessary if commands are from * ungotten chars rather than from the user. */ return; } /* * Make sure the screen is displayed. */ make_display(); bottompos = position(BOTTOM_PLUS_ONE); /* * If we've hit EOF on the last file and the -E flag is set, quit. */ if (get_quit_at_eof() == OPT_ONPLUS && eof_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); /* * If the entire file is displayed and the -F flag is set, quit. */ if (quit_if_one_screen && entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); /* * Select the proper prompt and display it. */ /* * If the previous action was a forward movement, * don't clear the bottom line of the display; * just print the prompt since the forward movement guarantees * that we're in the right position to display the prompt. * Clearing the line could cause a problem: for example, if the last * line displayed ended at the right screen edge without a newline, * then clearing would clear the last displayed line rather than * the prompt line. */ if (!forw_prompt) clear_bot(); clear_cmd(); forw_prompt = 0; p = prompt_string(); if (is_filtering()) putstr("& "); if (p == NULL || *p == '\0') { putchr(':'); } else { at_enter(AT_STANDOUT); putstr(p); at_exit(); } clear_eol(); }