[chronojump] ForcePlatform waits start message from Sensor



commit 2fd325a4dba81a16aec80ce5f5c56932890d2ec9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 4 13:26:47 2018 +0200

    ForcePlatform waits start message from Sensor

 src/forcePlatform.cs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/forcePlatform.cs b/src/forcePlatform.cs
index d42ad417..fc99e5ac 100644
--- a/src/forcePlatform.cs
+++ b/src/forcePlatform.cs
@@ -79,8 +79,19 @@ public class ForcePlatform
                System.Threading.Thread.Sleep(3000); //sleep to let arduino start reading serial event
                sp.WriteLine("start_capture:");
                LogB.Information("'start_capture:' sent");
-               System.Threading.Thread.Sleep(100); //sleep to let arduino start reading
 
+               string str = "";
+               do {
+                       System.Threading.Thread.Sleep(100); //sleep to let arduino start reading
+                       try {
+                               str = sp.ReadLine();
+                       } catch {
+                               LogB.Warning("Catched at capture");
+                               return;
+                       }
+                       LogB.Information("init string: " + str);
+               }
+               while(! str.Contains("Starting capture"));
 
                writer.WriteLine("Time;S1;S2;S3;S4");
                for(int i = 0; i < 400; i ++)


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