Revert "Schnitzel support"

This reverts commit eb9051aa7d.
This commit is contained in:
Stefan `Sec` Zehl 2011-08-05 11:31:34 +02:00
parent 117396bd88
commit e2d2ba2cbd
2 changed files with 5 additions and 75 deletions

View File

@ -120,19 +120,7 @@ char *meshmsgs(void){
return msgtypes; return msgtypes;
}; };
static inline uint32_t popcount(uint32_t *buf, uint8_t n){
int cnt=0;
do {
unsigned m = *buf++;
m = (m & 0x55555555) + ((m & 0xaaaaaaaa) >> 1);
m = (m & 0x33333333) + ((m & 0xcccccccc) >> 2);
m = (m & 0x0f0f0f0f) + ((m & 0xf0f0f0f0) >> 4);
m = (m & 0x00ff00ff) + ((m & 0xff00ff00) >> 8);
m = (m & 0x0000ffff) + ((m & 0xffff0000) >> 16);
cnt += m;
} while(--n);
return cnt;
}
extern MPKT meshbuffer[MESHBUFSIZE]; extern MPKT meshbuffer[MESHBUFSIZE];
//# MENU messages //# MENU messages
@ -164,12 +152,6 @@ void m_choose(){
case('T'): case('T'):
strcpy(p,"Time"); strcpy(p,"Time");
break; break;
case('Z'):
strcpy(p,"Schnitzel");
break;
case('z'):
strcpy(p,"S-Score");
break;
case('i'): case('i'):
strcpy(p,"Invaders"); strcpy(p,"Invaders");
break; break;
@ -206,12 +188,6 @@ void m_choose(){
case('T'): case('T'):
lcdPrintln("Time"); lcdPrintln("Time");
break; break;
case('Z'):
strcpy(p,"Schnitzel");
break;
case('z'):
strcpy(p,"S-Score");
break;
case('i'): case('i'):
lcdPrintln("Invaders"); lcdPrintln("Invaders");
break; break;
@ -227,19 +203,7 @@ void m_choose(){
lcdPrint(IntToStr(tm->tm_sec,2,F_LONG|F_ZEROS)); lcdPrint(IntToStr(tm->tm_sec,2,F_LONG|F_ZEROS));
lcdNl(); lcdNl();
if(tmm[i]=='Z'){ if(tmm[i]=='T'){
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+ 6),8));
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+10),8));
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+14),8));
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+18),8));
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+22),8));
lcdPrintln(IntToStrX(uint8ptouint32(meshbuffer[j].pkt+26),8));
lcdPrint(IntToStr(popcount(meshbuffer[j].pkt+6,6),3,0));
lcdPrintln(" pts.");
lcdRefresh();
getInputWaitRelease();
continue;
}else if(tmm[i]=='T'){
lcdPrint(IntToStr(tm->tm_mday,2,F_LONG)); lcdPrint(IntToStr(tm->tm_mday,2,F_LONG));
lcdPrint("."); lcdPrint(".");
lcdPrint(IntToStr(tm->tm_mon+1,2,0)); lcdPrint(IntToStr(tm->tm_mon+1,2,0));

View File

@ -55,8 +55,6 @@ MPKT * meshGetMessage(uint8_t type){
void mesh_cleanup(void){ void mesh_cleanup(void){
time_t now=getSeconds(); time_t now=getSeconds();
for(int i=1;i<MESHBUFSIZE;i++){ for(int i=1;i<MESHBUFSIZE;i++){
if(meshbuffer[i].flags&MF_LOCK)
continue;
if(meshbuffer[i].flags&MF_USED){ if(meshbuffer[i].flags&MF_USED){
if (MO_GEN(meshbuffer[i].pkt)<meshgen) if (MO_GEN(meshbuffer[i].pkt)<meshgen)
meshbuffer[i].flags=MF_FREE; meshbuffer[i].flags=MF_FREE;
@ -128,20 +126,6 @@ void mesh_recvqloop_setup(void){
nrf_rcv_pkt_start(); nrf_rcv_pkt_start();
}; };
static inline uint32_t popcount(uint32_t *buf, uint8_t n){
int cnt=0;
do {
unsigned m = *buf++;
m = (m & 0x55555555) + ((m & 0xaaaaaaaa) >> 1);
m = (m & 0x33333333) + ((m & 0xcccccccc) >> 2);
m = (m & 0x0f0f0f0f) + ((m & 0xf0f0f0f0) >> 4);
m = (m & 0x00ff00ff) + ((m & 0xff00ff00) >> 8);
m = (m & 0x0000ffff) + ((m & 0xffff0000) >> 16);
cnt += m;
} while(--n);
return cnt;
}
uint8_t mesh_recvqloop_work(void){ uint8_t mesh_recvqloop_work(void){
__attribute__ ((aligned (4))) uint8_t buf[32]; __attribute__ ((aligned (4))) uint8_t buf[32];
int len; int len;
@ -180,26 +164,9 @@ uint8_t mesh_recvqloop_work(void){
// Store packet in a same/free slot // Store packet in a same/free slot
MPKT* mpkt=meshGetMessage(MO_TYPE(buf)); MPKT* mpkt=meshGetMessage(MO_TYPE(buf));
// Schnitzel // Skip locked packet
if(MO_TYPE(buf)=='Z'){ if(mpkt->flags&MF_LOCK)
mpkt->flags=MF_USED|MF_LOCK; return 2;
MO_TIME_set(mpkt->pkt,getSeconds());
MO_GEN_set(mpkt->pkt,0x70);
for(int i=6;i<MESHPKTSIZE;i++)
mpkt->pkt[i]|=buf[i];
int score=popcount(MO_BODY(mpkt->pkt),6);
MPKT* reply=meshGetMessage('z');
if(MO_TIME(reply->pkt)>=score)
return 1;
MO_TIME_set(reply->pkt,score);
strcpy((char*)MO_BODY(reply->pkt),GLOBAL(nickname));
return 1;
};
// only accept newer/better packets // only accept newer/better packets
if(mpkt->flags==MF_USED) if(mpkt->flags==MF_USED)
@ -212,7 +179,6 @@ uint8_t mesh_recvqloop_work(void){
memcpy(mpkt->pkt,buf,MESHPKTSIZE); memcpy(mpkt->pkt,buf,MESHPKTSIZE);
mpkt->flags=MF_USED; mpkt->flags=MF_USED;
return 1; return 1;
}; };