From 4836f5b8f5e2e799757be79b1f5188e84c965d1f Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 01:58:12 +0200 Subject: [PATCH 1/4] Devel-menu egg --- firmware/applications/default.c | 1 + firmware/applications/final/exe.c | 6 ++++++ firmware/basic/menu.c | 12 ++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/firmware/applications/default.c b/firmware/applications/default.c index 0584753..0104352 100644 --- a/firmware/applications/default.c +++ b/firmware/applications/default.c @@ -30,6 +30,7 @@ void main_default(void) { break; case BTN_RIGHT: GLOBAL(develmode)=1; + applyConfig(); break; case BTN_DOWN: usbMSCInit(); diff --git a/firmware/applications/final/exe.c b/firmware/applications/final/exe.c index bd7c7c1..d277caa 100644 --- a/firmware/applications/final/exe.c +++ b/firmware/applications/final/exe.c @@ -19,3 +19,9 @@ void execute_menu(void){ lcdRefresh(); }; +//# MENU |devel +void execute_devel(void){ + while(getInput()!=BTN_NONE); + executeSelect("INT"); + lcdRefresh(); +}; diff --git a/firmware/basic/menu.c b/firmware/basic/menu.c index fc1fe48..43a353f 100644 --- a/firmware/basic/menu.c +++ b/firmware/basic/menu.c @@ -1,6 +1,7 @@ #include #include "basic/basic.h" +#include "basic/config.h" #include "lcd/print.h" @@ -11,7 +12,7 @@ uint8_t menuflags=0; void handleMenu(const struct MENU *the_menu) { uint8_t back = 0; int8_t menuselection = 0; - uint8_t numentries = 0; + uint8_t numentries; uint8_t visible_lines = 0; uint8_t current_offset = 0; @@ -21,6 +22,9 @@ void handleMenu(const struct MENU *the_menu) { for (numentries = 0; the_menu->entries[numentries].text != NULL ; numentries++); + if(the_menu->entries[numentries-1].text[0]=='|' && !GLOBAL(develmode)) + numentries--; + visible_lines = lcdGetVisibleLines()-1; // subtract title line if(menuflags&MENU_BIG) @@ -81,8 +85,8 @@ void handleMenu(const struct MENU *the_menu) { break; case BTN_ENTER: lcdClear(); - lcdPrintln("Called..."); - lcdRefresh(); +// lcdPrintln("Called..."); +// lcdRefresh(); getInputWaitRelease(); if (the_menu->entries[menuselection].callback!=NULL) the_menu->entries[menuselection].callback(); @@ -91,7 +95,7 @@ void handleMenu(const struct MENU *the_menu) { if (menuflags&MENU_JUSTONCE) return; - getInputWait(); +// getInputWait(); break; case BTN_NONE: /* timeout */ From be448224ed909d0faff14ef0ddfb7aac29de341d Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 01:58:44 +0200 Subject: [PATCH 2/4] rename msc menu. Also add some random unused sample code for images --- firmware/applications/final/util.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/firmware/applications/final/util.c b/firmware/applications/final/util.c index 5dbca8f..a3c8c10 100644 --- a/firmware/applications/final/util.c +++ b/firmware/applications/final/util.c @@ -6,15 +6,19 @@ #include "lcd/render.h" #include "lcd/print.h" +#include "lcd/image.h" #include "usb/usbmsc.h" +#include "filesystem/ff.h" +#include "filesystem/select.h" + #include "core/iap/iap.h" /**************************************************************************/ -//# MENU msc +//# MENU usb_storage void msc_menu(void){ lcdClear(); lcdPrintln("MSC Enabled."); @@ -46,3 +50,20 @@ void tick_alive(void){ return; }; + +// //# MENU img img +void t_img(void){ + char fname[FILENAMELEN]; + selectFile(fname, "LCD"); + lcdLoadImage(fname); + lcdRefresh(); + getInputWait(); +}; + +// //# MENU img anim +void t_ani(void){ + char fname[FILENAMELEN]; + selectFile(fname, "LCD"); + lcdShowAnim(fname,1000); +}; + From 5a3c0579142abbcd9767ffca726146f1d6fe94d8 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 02:00:32 +0200 Subject: [PATCH 3/4] hide debug from default menu --- firmware/l0dable/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/l0dable/Makefile b/firmware/l0dable/Makefile index 3799bb0..d0364fd 100644 --- a/firmware/l0dable/Makefile +++ b/firmware/l0dable/Makefile @@ -27,7 +27,7 @@ CFLAGS+=-mlong-calls -fno-toplevel-reorder CRYPT=cp CRYPTFLAGS=-p -all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int +all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int debug.int $(LDFILE): -@echo "MEMORY" > $(LDFILE) From c505028b41717badc4999372eb10cf1d802d223b Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 02:19:22 +0200 Subject: [PATCH 4/4] FIrst mesh slowdown patch --- firmware/funk/mesh.c | 10 ++++++++++ firmware/funk/mesh.h | 1 + firmware/funk/nrf24l01p.c | 3 ++- firmware/funk/nrf24l01p.h | 1 + firmware/l0dable/EXPORTS | 2 ++ firmware/l0dable/Makefile | 3 +++ firmware/l0dable/debug.c | 5 ++++- 7 files changed, 23 insertions(+), 2 deletions(-) diff --git a/firmware/funk/mesh.c b/firmware/funk/mesh.c index 6ff2c27..21459e6 100644 --- a/firmware/funk/mesh.c +++ b/firmware/funk/mesh.c @@ -11,6 +11,7 @@ char meshgen=0; // Generation char meshincctr=0; char meshmsg=0; +char meshnice=0; MPKT meshbuffer[MESHBUFSIZE]; uint32_t const meshkey[4] = { @@ -89,11 +90,19 @@ void mesh_sendloop(void){ else uint32touint8p(0,MO_BODY(meshbuffer[0].pkt)); + MO_BODY(meshbuffer[0].pkt)[4]=meshnice; + for (int i=0;i