[chronojump] forceSensor usbDisconnectedCount 1000 (before first sample arrives) or 40 (later)



commit d6db4411e702cb8b7cd778bc00688ccecf2fa57e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Nov 4 12:23:44 2021 -0300

    forceSensor usbDisconnectedCount 1000 (before first sample arrives) or 40 (later)

 src/gui/app1/forceSensor.cs | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index d37508737..3eebec1f4 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -1620,13 +1620,21 @@ LogB.Information(" fs H2 ");
 
                                /* this was 20 for some years, but some electronics are slower on start 
sending data
                                   and then Disconnected happens. So changed to 1000 it makes the 
Disconnected check
-                                  do not make fail the capture, and just if disconnected, the message 
appears later
+                                  do not make fail the capture, and just if disconnected, the message 
appears few seconds later.
+
+                                  Changed also to 1000 while we wait first point and 40 while we have data.
+                                  Then if disconnected while capture error message and thread end is fast
                                 */
-                               if(usbDisconnectedCount >= 1000)
+                               int disconnectedThreshold = 1000;
+                               if(fscPoints.NumCaptured > 0)
+                                       disconnectedThreshold = 40;
+
+                               if(usbDisconnectedCount >= disconnectedThreshold)
                                {
                                        event_execute_label_message.Text = "Disconnected!";
                                        forceProcessError = true;
-                                       LogB.Information("fs Error 4");
+                                       LogB.Information("fs Error 4." +
+                                               string.Format(" captured {0} samples", 
fscPoints.NumCaptured));
                                        return true;
                                }
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]