Author: remi
Date: 2008-06-24 11:27:28 +0200 (Tue, 24 Jun 2008)
New Revision: 1252

Modified:
   software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c
   software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h
   software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h
Log:
* Added a command to reset the RF
* Changed to RF reset instead of dongle reset when too many read errors occur.
* Changed read errors threshold from 50 to 3.
* Removed one status reading of two, by cycle.
* Changed cycle length from 50msec to 100msec.
* Changed a threshold in the remote key release detection. (3 -> 2)

Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c
===================================================================
--- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c  2008-06-23 
15:22:51 UTC (rev 1251)
+++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c  2008-06-24 
09:27:28 UTC (rev 1252)
@@ -44,6 +44,7 @@
 static int read_error_counter = 0;
 static char frame_status_request[5] = {1, 1, 0, 0, 0};
 static char frame_reset_dongle[5] = {1, 1, 0, 0, 0xFE};
+static char frame_reset_rf[5] = {1, 1, 0, 0, 0xFD};
 
 #ifdef USE_MUTEX
 static mutex_t __connected_mutex;
@@ -285,7 +286,7 @@
 #ifdef USE_MUTEX
             mutex_unlock(__read_write_mutex);
 #endif
-            log_error("Failed to write on USB device (RF disconnected)");
+            log_warning("Failed to write on USB device (RF disconnected)");
             return TuxUSBWriteError;
         }
     }
@@ -327,10 +328,11 @@
     if ((packet_count == 0) && (rf_state == 1))
     {
         read_error_counter++;
+        log_warning("Read errors count : %d\n", read_error_counter);
         if (read_error_counter >= TUX_USB_ERROR_LIMIT)
         {
-            /* Reset of the dongle */
-            tux_usb_reset();
+            /* Reset of the RF */
+            tux_usb_rf_reset();
         }
     }
     else
@@ -384,7 +386,7 @@
     
     if (!tux_usb_connected())
     {
-        log_error("Fux USB device not connected");
+        log_warning("Fux USB device not connected");
         return TuxUSBNotConnected;
     }
     
@@ -413,6 +415,7 @@
     if (!ret)
     {
         set_connected(false);
+        tux_usb_reset();
         tux_usb_release();
         log_error("Fux is disconnected");
         return TuxUSBDisconnected;
@@ -481,7 +484,6 @@
         }
         
         tux_usb_read(data);
-        tux_usb_read(data);
         
         if (loop_cycle_complete_function)
         {
@@ -560,6 +562,15 @@
 }
 
 /**
+ *
+ */
+LIBLOCAL void
+tux_usb_rf_reset(void)
+{
+    tux_hid_write(TUX_SEND_LENGTH, (char *)frame_reset_rf);
+}
+
+/**
  *  Send a raw command 
  *  @param data 5 bytes array
  */

Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h
===================================================================
--- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h  2008-06-23 
15:22:51 UTC (rev 1251)
+++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h  2008-06-24 
09:27:28 UTC (rev 1252)
@@ -35,8 +35,8 @@
 #define TUX_READ_EP                 0x84
 #define TUX_WRITE_TIMEOUT           1000
 #define TUX_READ_TIMEOUT            1000
-#define TUX_READ_LOOP_INTERVAL      0.05
-#define TUX_USB_ERROR_LIMIT         50
+#define TUX_READ_LOOP_INTERVAL      0.1
+#define TUX_USB_ERROR_LIMIT         3
 #define MIN_FIRMWARE_VERSION        0x030
 
 #ifdef WIN32
@@ -172,6 +172,11 @@
  */
 extern void tux_usb_reset(void);
 
+/**
+ *  Reset the RF
+ */
+extern void tux_usb_rf_reset(void);
+
 /** 
  *  Send a command to Tuxdroid.
  *  @param data 4 bytes array

Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h
===================================================================
--- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h  
2008-06-23 15:22:51 UTC (rev 1251)
+++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h  
2008-06-24 09:27:28 UTC (rev 1252)
@@ -23,7 +23,7 @@
 
 #include <stdbool.h>
 
-#define RC5_TIMEOUT         3
+#define RC5_TIMEOUT         2
 
 #define K_0                 0x00
 #define K_1                 0x01


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to