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 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

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