FIrst mesh slowdown patch

This commit is contained in:
Stefan `Sec` Zehl 2011-08-05 02:19:22 +02:00
parent fb85b2a137
commit c505028b41
7 changed files with 23 additions and 2 deletions

View File

@ -11,6 +11,7 @@
char meshgen=0; // Generation char meshgen=0; // Generation
char meshincctr=0; char meshincctr=0;
char meshmsg=0; char meshmsg=0;
char meshnice=0;
MPKT meshbuffer[MESHBUFSIZE]; MPKT meshbuffer[MESHBUFSIZE];
uint32_t const meshkey[4] = { uint32_t const meshkey[4] = {
@ -89,11 +90,19 @@ void mesh_sendloop(void){
else else
uint32touint8p(0,MO_BODY(meshbuffer[0].pkt)); uint32touint8p(0,MO_BODY(meshbuffer[0].pkt));
MO_BODY(meshbuffer[0].pkt)[4]=meshnice;
for (int i=0;i<MESHBUFSIZE;i++){ for (int i=0;i<MESHBUFSIZE;i++){
if(!meshbuffer[i].flags&MF_USED) if(!meshbuffer[i].flags&MF_USED)
continue; continue;
if(meshbuffer[i].flags&MF_LOCK) if(meshbuffer[i].flags&MF_LOCK)
continue; continue;
if(meshnice&0xf){
if(getSeconds()%0xf < (meshnice&0x0f)){
meshincctr++;
continue;
};
};
ctr++; ctr++;
memcpy(buf,meshbuffer[i].pkt,MESHPKTSIZE); memcpy(buf,meshbuffer[i].pkt,MESHPKTSIZE);
status=nrf_snd_pkt_crc_encr(MESHPKTSIZE,buf,meshkey); status=nrf_snd_pkt_crc_encr(MESHPKTSIZE,buf,meshkey);
@ -141,6 +150,7 @@ uint8_t mesh_recvqloop_work(void){
_timet = toff; _timet = toff;
meshincctr++; meshincctr++;
}; };
meshnice=MO_BODY(meshbuffer[0].pkt)[4];
return 1; return 1;
}; };

View File

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

View File

@ -5,6 +5,8 @@
#define DEFAULT_SPEED R_RF_SETUP_DR_2M #define DEFAULT_SPEED R_RF_SETUP_DR_2M
uint8_t _nrfresets=0;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Transmit a byte via SPI */ /* Transmit a byte via SPI */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
@ -406,7 +408,6 @@ void nrf_off() {
void nrf_check_reset(void){ void nrf_check_reset(void){
static uint8_t _nrfresets=0;
if(nrf_cmd_status(C_NOP) & R_STATUS_MAX_RT){ if(nrf_cmd_status(C_NOP) & R_STATUS_MAX_RT){
_nrfresets++; _nrfresets++;
nrf_init(); 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. // more utility.
void nrf_rcv_pkt_end(void); void nrf_rcv_pkt_end(void);
void nrf_check_reset(void); void nrf_check_reset(void);
extern uint8_t _nrfresets;
/* END */ /* END */

View File

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

View File

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

View File

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