From 6e93dd4002f185dedbf243928ec795cb0572f619 Mon Sep 17 00:00:00 2001 From: schneider Date: Thu, 22 Dec 2011 03:18:16 +0100 Subject: [PATCH] moved config screen to l0dable, saving 592 bytes --- firmware/applications/final/config.c | 111 ++------------------------- firmware/l0dable/EXPORTS | 3 + firmware/l0dable/Makefile | 5 +- 3 files changed, 14 insertions(+), 105 deletions(-) diff --git a/firmware/applications/final/config.c b/firmware/applications/final/config.c index be2a784..5aecf3b 100644 --- a/firmware/applications/final/config.c +++ b/firmware/applications/final/config.c @@ -12,113 +12,16 @@ #include /**************************************************************************/ - //# MENU config void changer(void){ - uint8_t numentries = 0; - signed char menuselection = 0; - uint8_t visible_lines = 0; - uint8_t current_offset = 0; - - for (int i=0;the_config[i].name!=NULL;i++){ - if(!the_config[i].disabled) - numentries++; - }; - - visible_lines = ((RESY/getFontHeight())-1)/2; - - while (1) { - // Display current menu page + if(execute_file("config.int")){ lcdClear(); - lcdPrint("Config"); - - lcdSetCrsrX(60); - lcdPrint("["); - lcdPrint(IntToStr((current_offset/visible_lines)+1,1,0)); - lcdPrint("/"); - lcdPrint(IntToStr(((numentries-1)/visible_lines)+1,1,0)); - lcdPrint("]"); - lcdNl(); - - lcdNl(); - - uint8_t j=0; - for (uint8_t i=0;i"); - }; + lcdPrintln("config"); + lcdPrintln("l0dable"); + lcdPrintln("not found"); lcdRefresh(); - } - - switch (getInputWaitRepeat()) { - case BTN_UP: - menuselection--; - if (menuselection < current_offset) { - if (menuselection < 0) { - menuselection = numentries-1; - current_offset = ((numentries-1)/visible_lines) * visible_lines; - } else { - current_offset -= visible_lines; - } - } - break; - case BTN_DOWN: - menuselection++; - if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) { - if (menuselection >= numentries) { - menuselection = 0; - current_offset = 0; - } else { - current_offset += visible_lines; - } - } - break; - case BTN_LEFT: - if(the_config[t].value > - the_config[t].min) - the_config[t].value--; - if(the_config[t].value > the_config[t].max) - the_config[t].value= - the_config[t].max; - applyConfig(); - break; - case BTN_RIGHT: - if(the_config[t].value < - the_config[t].max) - the_config[t].value++; - if(the_config[t].value < the_config[t].min) - the_config[t].value= - the_config[t].min; - applyConfig(); - break; - case BTN_ENTER: - if(menuselection==0) - saveConfig(); - return; - } + getInputWait(); + getInputWaitRelease(); } - /* NOTREACHED */ } + diff --git a/firmware/l0dable/EXPORTS b/firmware/l0dable/EXPORTS index 8b65dc9..2b0fd3f 100644 --- a/firmware/l0dable/EXPORTS +++ b/firmware/l0dable/EXPORTS @@ -127,3 +127,6 @@ timer32Callback0 lcdRead lcdInit lcdSetCrsr +lcdSetCrsrX +getInputWaitRepeat +applyConfig diff --git a/firmware/l0dable/Makefile b/firmware/l0dable/Makefile index dfffde4..6c9d56b 100644 --- a/firmware/l0dable/Makefile +++ b/firmware/l0dable/Makefile @@ -31,7 +31,7 @@ CRYPTFLAGS=-p skey=`cd .. && ./getkey.pl l0dable_sign` ekey=`cd .. && ./getkey.pl l0dable_crypt` -all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int debug.int +all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int debug.int config.int $(LDFILE): -@echo "MEMORY" > $(LDFILE) @@ -68,6 +68,9 @@ endif debug.int: debug.c0d .PHONY mv $< $@ +config.int: config.c0d .PHONY + mv $< $@ + clean: rm -f *.o *.elf *.bin usetable.h