+ tunecount=0;
+ def retune(self,freqmod=0x52):
+ """Tunes to another channel or preamble looking for the next packet."""
+ count=self.tunecount+1;
+ self.tunecount=count;
+
+ #Swap the SYNC value most often.
+ sync=0xAA;
+ if count&1:
+ sync=0x55;
+ self.client.RF_setsmac(sync);
+ count=(count>>1);
+
+ #Then the data rate.
+ rate=0;
+
+ #This swaps between 1Mbps and 2Mbps.
+ #TODO add support for 256kbps, if anyone uses it.
+ if count&1:
+ rate=rate|0x08;
+ #print "Setting rate to 0x%02x" % rate;
+ if(rate==0x20):
+ rate=0x08;
+ self.client.poke(0x06,rate);
+ count=(count>>2);
+
+ #Grab two packets to clear buffers.
+ #Should retune only after a few packets to reduce this delay.
+ packet=client.RF_rxpacket();
+ packet=client.RF_rxpacket();
+ return;
+