Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
iggy 2011-08-05 02:36:39 +02:00
commit 6f8e019dcf
11 changed files with 61 additions and 8 deletions

View File

@ -31,6 +31,7 @@ void main_default(void) {
break;
case BTN_RIGHT:
GLOBAL(develmode)=1;
applyConfig();
break;
case BTN_DOWN:
usbMSCInit();

View File

@ -19,3 +19,9 @@ void execute_menu(void){
lcdRefresh();
};
//# MENU |devel
void execute_devel(void){
while(getInput()!=BTN_NONE);
executeSelect("INT");
lcdRefresh();
};

View File

@ -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);
};

View File

@ -1,6 +1,7 @@
#include <sysinit.h>
#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 */

View File

@ -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<MESHBUFSIZE;i++){
if(!meshbuffer[i].flags&MF_USED)
continue;
if(meshbuffer[i].flags&MF_LOCK)
continue;
if(meshnice&0xf){
if(getSeconds()%0xf < (meshnice&0x0f)){
meshincctr++;
continue;
};
};
ctr++;
memcpy(buf,meshbuffer[i].pkt,MESHPKTSIZE);
status=nrf_snd_pkt_crc_encr(MESHPKTSIZE,buf,meshkey);
@ -141,6 +150,7 @@ uint8_t mesh_recvqloop_work(void){
_timet = toff;
meshincctr++;
};
meshnice=MO_BODY(meshbuffer[0].pkt)[4];
return 1;
};

View File

@ -30,6 +30,7 @@ typedef struct {
extern char meshgen; // Generation
extern char meshincctr; // Time checker
extern char meshnice; // Time checker
extern char meshmsg; // Is there something interesting?
extern MPKT meshbuffer[MESHBUFSIZE];

View File

@ -5,6 +5,8 @@
#define DEFAULT_SPEED R_RF_SETUP_DR_2M
uint8_t _nrfresets=0;
/*-----------------------------------------------------------------------*/
/* Transmit a byte via SPI */
/*-----------------------------------------------------------------------*/
@ -406,7 +408,6 @@ void nrf_off() {
void nrf_check_reset(void){
static uint8_t _nrfresets=0;
if(nrf_cmd_status(C_NOP) & R_STATUS_MAX_RT){
_nrfresets++;
nrf_init();

View File

@ -166,6 +166,7 @@ int nrf_rcv_pkt_poll_dec(int maxsize, uint8_t * pkt, uint32_t const key[4]);
// more utility.
void nrf_rcv_pkt_end(void);
void nrf_check_reset(void);
extern uint8_t _nrfresets;
/* END */

View File

@ -86,3 +86,5 @@ input
saveConfig
lcdShowAnim
lcdLoadImage
meshnice
_nrfresets

View File

@ -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)
@ -55,6 +55,9 @@ $(LDFILE):
1boot.int: 1boot.c0d .PHONY
mv $< $@
debug.int: debug.c0d .PHONY
mv $< $@
clean:
rm -f *.o *.elf *.bin usetable.h

View File

@ -204,6 +204,9 @@ void m_time(void){
lcdPrint("Inc:");
lcdPrintInt(meshincctr);
lcdNl();
lcdPrint("Nice:");
lcdPrintInt(meshnice);
lcdNl();
lcdRefresh();
delayms_queue(50);
}while ((getInputRaw())==BTN_NONE);
@ -217,7 +220,7 @@ void ChkFunk(){
lcdPrint("cfg:");
lcdPrintln(IntToStrX(nrf_read_reg(R_CONFIG),2));
lcdPrintln("Resets:");
lcdPrintln(IntToStr(nrf_check_reset(),3,0));
lcdPrintln(IntToStr(_nrfresets,3,0));
lcdRefresh();
while(!getInputRaw())work_queue();
};