Author: jaguarondi
Date: 2008-08-28 16:35:37 +0200 (Thu, 28 Aug 2008)
New Revision: 1627

Modified:
   firmware/rf/trunk/init.c
   firmware/rf/trunk/prot.c
   firmware/rf/trunk/rf_ctrl.c
   firmware/rf/trunk/varis.c
   firmware/rf/trunk/varis.h
Log:
* The USART counter was not reset correctly when a disconnection occured so it
  couldn't reconnect.


Modified: firmware/rf/trunk/init.c
===================================================================
--- firmware/rf/trunk/init.c    2008-08-28 14:11:34 UTC (rev 1626)
+++ firmware/rf/trunk/init.c    2008-08-28 14:35:37 UTC (rev 1627)
@@ -97,8 +97,8 @@
  * 8 - 11  -> SOF (Start Of Frame)
  * 12      -> LEN
  * 13     -> Command
- * 14 - 30 -> Payload
- * 31      -> Checksum
+ * 14 - 71 -> Payload
+ * 72      -> Checksum
  */
     /* Preamble */
     rf_buffer_tx[0] = rf_buffer_tx[1] = rf_buffer_tx[2] = 0x55 ^ SCRAMBLE_BYTE;

Modified: firmware/rf/trunk/prot.c
===================================================================
--- firmware/rf/trunk/prot.c    2008-08-28 14:11:34 UTC (rev 1626)
+++ firmware/rf/trunk/prot.c    2008-08-28 14:35:37 UTC (rev 1627)
@@ -74,6 +74,7 @@
     for (k=0; k<AFH_RANGE; k++)
     {
         AFH_freq[k] = k;
+        AFH_collision[k] = k;
     }
 
 /* SLAVE or M/S */

Modified: firmware/rf/trunk/rf_ctrl.c
===================================================================
--- firmware/rf/trunk/rf_ctrl.c 2008-08-28 14:11:34 UTC (rev 1626)
+++ firmware/rf/trunk/rf_ctrl.c 2008-08-28 14:35:37 UTC (rev 1627)
@@ -153,7 +153,6 @@
          * SOF to be recognized. */
         update_channel();
         sof_ary[0] = channel;
-        rf_rx_counter = 0x00;
         rf_rx_state = 0x00;
         checksum = 0x00;
         init_atr2406(channel,RXEN);//configure ATR2406 to desired channel
@@ -191,8 +190,7 @@
 #elif defined(AFH)
     AFH_index = (AFH_index+1) % AFH_RANGE;
     channel = AFH_freq[AFH_index];
-#endif
-#ifdef CYCHOPP
+#elif defined(CYCHOPP)
     channel ++;
     if(channel > channel_width)
     {
@@ -453,6 +451,7 @@
 ISR(SIG_USART_RECV)
 {
     uint8_t data, state;
+    static uint8_t rf_rx_counter;
 
     /* Temporary variable to "devolatilize" it. */
     state = rf_rx_state;
@@ -481,11 +480,14 @@
     else
         /* Check SOF */
     {
+        /* Initialize the counter here */
+        rf_rx_counter = 0x00;
+
         if(data == sof_ary[state])
         {
             if(++state==0x04)
             {
-#ifdef _SLAVE
+#if defined(_SLAVE)
                 ts = TCNT1;
                 OCR1A = ts + T_SYNC - T_LATENCY;
 #endif

Modified: firmware/rf/trunk/varis.c
===================================================================
--- firmware/rf/trunk/varis.c   2008-08-28 14:11:34 UTC (rev 1626)
+++ firmware/rf/trunk/varis.c   2008-08-28 14:35:37 UTC (rev 1627)
@@ -101,8 +101,6 @@
 
 
 volatile uint8_t rf_tx_counter;
-//counting the TX'ed bytes
-volatile uint8_t rf_rx_counter;
 //counting the RX'ed bytes
 volatile uint8_t rf_rx_state;
 //State of the RX interrupt

Modified: firmware/rf/trunk/varis.h
===================================================================
--- firmware/rf/trunk/varis.h   2008-08-28 14:11:34 UTC (rev 1626)
+++ firmware/rf/trunk/varis.h   2008-08-28 14:35:37 UTC (rev 1627)
@@ -69,7 +69,6 @@
 extern volatile uint8_t tx_pac_len;
 extern volatile uint8_t protocol_flags;
 extern volatile uint8_t rf_tx_counter;
-extern volatile uint8_t rf_rx_counter;
 extern volatile uint8_t rf_rx_state;
 extern volatile uint8_t checksum;
 extern volatile bool good_frame_received;


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to