[chronojump] Arduino status variables unified
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Arduino status variables unified
- Date: Fri, 18 May 2018 07:50:45 +0000 (UTC)
commit 387803d1bedc6e96144435379ebfaba1fc1ddc92
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri May 18 09:47:09 2018 +0200
Arduino status variables unified
src/gui/chronojump.cs | 14 +++++-----
src/gui/forceSensor.cs | 60 ++++++++++++++++++++++++------------------------
src/gui/runEncoder.cs | 24 ++++++------------
3 files changed, 45 insertions(+), 53 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 48dad27..b25d845 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2220,7 +2220,7 @@ public partial class ChronoJumpWindow
encoderRProcAnalyze.SendEndProcess();
//cancel force capture process
- if(capturingForce == forceStatus.STARTING || capturingForce == forceStatus.CAPTURING)
+ if(capturingForce == arduinoCaptureStatus.STARTING || capturingForce ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("cancelling force capture");
forceProcessCancel = true;
@@ -2231,7 +2231,7 @@ public partial class ChronoJumpWindow
portFS.Close();
//cancel runEncoder capture process
- if(capturingRunEncoder == runEncoderStatus.STARTING || capturingRunEncoder ==
runEncoderStatus.CAPTURING)
+ if(capturingRunEncoder == arduinoCaptureStatus.STARTING || capturingRunEncoder ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("cancelling runEncoder capture");
runEncoderProcessCancel = true;
@@ -3127,7 +3127,7 @@ public partial class ChronoJumpWindow
notebook_capture_graph_table.ShowTabs = true;
//cancel force capture process if mode is changed
- if(capturingForce == forceStatus.STARTING || capturingForce == forceStatus.CAPTURING)
+ if(capturingForce == arduinoCaptureStatus.STARTING || capturingForce ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("cancelling force capture");
forceProcessCancel = true;
@@ -3859,13 +3859,13 @@ public partial class ChronoJumpWindow
{
event_execute_ButtonCancel.Clicked -= new EventHandler(on_cancel_clicked);
- if(capturingForce == forceStatus.STARTING || capturingForce == forceStatus.CAPTURING)
+ if(capturingForce == arduinoCaptureStatus.STARTING || capturingForce ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("cancel clicked on force");
forceProcessCancel = true;
return;
}
- if(capturingRunEncoder == runEncoderStatus.STARTING || capturingRunEncoder ==
runEncoderStatus.CAPTURING)
+ if(capturingRunEncoder == arduinoCaptureStatus.STARTING || capturingRunEncoder ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("cancel clicked on runEncoder");
runEncoderProcessCancel = true;
@@ -3901,13 +3901,13 @@ public partial class ChronoJumpWindow
//to avoid doble finish or cancel while finishing
hideButtons();
- if(capturingForce == forceStatus.STARTING || capturingForce == forceStatus.CAPTURING)
+ if(capturingForce == arduinoCaptureStatus.STARTING || capturingForce ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("finish clicked on force");
forceProcessFinish = true;
return;
}
- if(capturingRunEncoder == runEncoderStatus.STARTING || capturingRunEncoder ==
runEncoderStatus.CAPTURING)
+ if(capturingRunEncoder == arduinoCaptureStatus.STARTING || capturingRunEncoder ==
arduinoCaptureStatus.CAPTURING)
{
LogB.Information("finish clicked on runEncoder");
runEncoderProcessFinish = true;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index b33e1c8..cfedfcd 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -95,14 +95,14 @@ public partial class ChronoJumpWindow
int usbDisconnectedLastTime;
/*
- * forceStatus:
+ * arduinoCaptureStatus:
* STOP is when is not used
* STARTING is while is waiting forceSensor to start capturing
* CAPTURING is when data is arriving
* COPIED_TO_TMP means data is on tmp and graph can be called
*/
- enum forceStatus { STOP, STARTING, CAPTURING, COPIED_TO_TMP }
- static forceStatus capturingForce = forceStatus.STOP;
+ enum arduinoCaptureStatus { STOP, STARTING, CAPTURING, COPIED_TO_TMP }
+ static arduinoCaptureStatus capturingForce = arduinoCaptureStatus.STOP;
static bool redoingPoints; //don't draw while redoing points (adjusting screen)
static bool forceCaptureStartMark; //Just needed to display "Capturing message"
@@ -284,7 +284,7 @@ public partial class ChronoJumpWindow
return;
}
- capturingForce = forceStatus.STOP;
+ capturingForce = arduinoCaptureStatus.STOP;
forceSensorTimeStart = DateTime.Now;
forceSensorOtherMessageShowSeconds = true;
@@ -502,7 +502,7 @@ public partial class ChronoJumpWindow
return;
forceSensorOtherMessage = "Please, wait ...";
- capturingForce = forceStatus.STARTING;
+ capturingForce = arduinoCaptureStatus.STARTING;
}
private void forceSensorCapturePre2()
@@ -577,7 +577,7 @@ public partial class ChronoJumpWindow
while(! str.Contains("Starting capture"));
forceCaptureStartMark = true;
- capturingForce = forceStatus.CAPTURING;
+ capturingForce = arduinoCaptureStatus.CAPTURING;
Util.CreateForceSensorSessionDirIfNeeded (currentSession.UniqueID);
@@ -647,7 +647,7 @@ public partial class ChronoJumpWindow
if(! forceSensorSendCommand("end_capture:", "Ending capture ...", "Catched ending capture"))
{
forceProcessError = true;
- capturingForce = forceStatus.STOP;
+ capturingForce = arduinoCaptureStatus.STOP;
Util.FileDelete(fileName);
return;
}
@@ -668,7 +668,7 @@ public partial class ChronoJumpWindow
writer.Flush();
writer.Close();
((IDisposable)writer).Dispose();
- capturingForce = forceStatus.STOP;
+ capturingForce = arduinoCaptureStatus.STOP;
//port.Close();
@@ -678,27 +678,27 @@ public partial class ChronoJumpWindow
//call graph
File.Copy(fileName, UtilEncoder.GetmifCSVFileName(), true); //can be overwritten
lastForceSensorFullPath = fileName;
- capturingForce = forceStatus.COPIED_TO_TMP;
+ capturingForce = arduinoCaptureStatus.COPIED_TO_TMP;
}
}
private bool pulseGTKForceSensorCapture ()
{
-LogB.Information(" fc A ");
+LogB.Information(" re A ");
if(forceCaptureThread == null)
{
Thread.Sleep (25);
return true;
}
-LogB.Information(" fc B ");
+LogB.Information(" re B ");
//LogB.Information(capturingForce.ToString())
if(! forceCaptureThread.IsAlive || forceProcessFinish || forceProcessCancel ||
forceProcessError)
{
-LogB.Information(" fc C ");
+LogB.Information(" re C ");
if(forceProcessFinish)
{
- if(capturingForce != forceStatus.COPIED_TO_TMP)
+ if(capturingForce != arduinoCaptureStatus.COPIED_TO_TMP)
{
Thread.Sleep (25); //Wait file is copied
return true;
@@ -740,7 +740,7 @@ LogB.Information(" fc C ");
*/
while(forceCaptureThread.IsAlive)
Thread.Sleep (250);
-LogB.Information(" fc D ");
+LogB.Information(" re D ");
LogB.ThreadEnded();
@@ -757,17 +757,17 @@ LogB.Information(" fc D ");
return false;
}
-LogB.Information(" fc E ");
+LogB.Information(" re E ");
if(forceCaptureStartMark)
{
event_execute_label_message.Text = "Capturing ...";
forceCaptureStartMark = false;
}
-LogB.Information(" fc F ");
+LogB.Information(" re F ");
- if(capturingForce == forceStatus.CAPTURING)
+ if(capturingForce == arduinoCaptureStatus.CAPTURING)
{
-LogB.Information(" fc G ");
+LogB.Information(" re G ");
//------------------- vscale -----------------
/*
//A) resize vscale if needed
@@ -796,12 +796,12 @@ LogB.Information(" fc G ");
label_force_sensor_value_min.Text = forceSensorValues.ForceMin.ToString();
-LogB.Information(" fc H ");
+LogB.Information(" re H ");
//------------------- realtime graph -----------------
if(redoingPoints || fscPoints == null || fscPoints.Points == null ||
force_capture_drawingarea == null)
return true;
-LogB.Information(" fc H2 ");
+LogB.Information(" re H2 ");
if(usbDisconnectedLastTime == forceSensorValues.TimeLast)
{
usbDisconnectedCount ++;
@@ -818,7 +818,7 @@ LogB.Information(" fc H2 ");
usbDisconnectedCount = 0;
}
-LogB.Information(" fc I ");
+LogB.Information(" re I ");
//mark meaning screen should be erased
if(fscPoints.NumPainted == -1) {
UtilGtk.ErasePaint(force_capture_drawingarea, force_capture_pixmap);
@@ -827,32 +827,32 @@ LogB.Information(" fc I ");
fscPoints.NumPainted = 0;
}
-LogB.Information(" fc J ");
+LogB.Information(" re J ");
//use these integers and this List to not have errors by updating data on the other
thread
int numCaptured = fscPoints.NumCaptured;
int numPainted = fscPoints.NumPainted;
List<Gdk.Point> points = fscPoints.Points;
-LogB.Information(" fc K ");
+LogB.Information(" re K ");
int toDraw = numCaptured - numPainted;
LogB.Information("points count: " + points.Count +
"; NumCaptured: " + numCaptured + "; NumPainted: " + numPainted +
"; toDraw: " + toDraw.ToString() );
-LogB.Information(" fc L ");
+LogB.Information(" re L ");
//fixes crash at the end
if(toDraw == 0)
return true;
-LogB.Information(" fc M ");
+LogB.Information(" re M ");
Gdk.Point [] paintPoints;
if(numPainted > 0)
paintPoints = new Gdk.Point[toDraw +1]; // if something has been painted,
connected first point with previous points
else
paintPoints = new Gdk.Point[toDraw];
-LogB.Information(" fc N ");
+LogB.Information(" re N ");
int jStart = 0;
int iStart = 0;
if(numPainted > 0)
@@ -863,14 +863,14 @@ LogB.Information(" fc N ");
iStart = numPainted;
//LogB.Information("X: " + paintPoints[0].X.ToString() + "; Y: " +
paintPoints[0].Y.ToString());
}
-LogB.Information(" fc O ");
+LogB.Information(" re O ");
for(int j=jStart, i = iStart ; i < numCaptured ; i ++, j++)
{
if(points.Count > i) //extra check to avoid going outside of arrays
paintPoints[j] = points[i];
//LogB.Information("X: " + paintPoints[j].X.ToString() + "; Y: " +
paintPoints[j].Y.ToString());
}
-LogB.Information(" fc P ");
+LogB.Information(" re P ");
force_capture_pixmap.DrawLines(pen_black_force_capture, paintPoints);
force_capture_drawingarea.QueueDraw(); // -- refresh
@@ -881,9 +881,9 @@ LogB.Information(" fc P ");
if(fscPoints.NumPainted != -1)
fscPoints.NumPainted = numCaptured;
-LogB.Information(" fc Q ");
+LogB.Information(" re Q ");
}
-LogB.Information(" fc R ");
+LogB.Information(" re R ");
Thread.Sleep (25);
//LogB.Information(" ForceSensor:"+ forceCaptureThread.ThreadState.ToString());
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index ca658fc..7aafd09 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -42,15 +42,7 @@ public partial class ChronoJumpWindow
//int usbDisconnectedCount;
//int usbDisconnectedLastTime;
- /*
- * runEncoderStatus:
- * STOP is when is not used
- * STARTING is while is waiting run encoder sensor to start capturing
- * CAPTURING is when data is arriving
- * COPIED_TO_TMP means data is on tmp and graph can be called
- */
- enum runEncoderStatus { STOP, STARTING, CAPTURING, COPIED_TO_TMP }
- static runEncoderStatus capturingRunEncoder = runEncoderStatus.STOP;
+ static arduinoCaptureStatus capturingRunEncoder = arduinoCaptureStatus.STOP;
/*
static bool redoingPoints; //don't draw while redoing points (adjusting screen)
@@ -168,7 +160,7 @@ public partial class ChronoJumpWindow
return false;
event_execute_label_message.Text = "Please, wait ...";
- capturingRunEncoder = runEncoderStatus.STARTING;
+ capturingRunEncoder = arduinoCaptureStatus.STARTING;
button_execute_test.Sensitive = false;
event_execute_button_finish.Sensitive = true;
@@ -233,7 +225,7 @@ public partial class ChronoJumpWindow
while(! str.Contains("Starting capture"));
//forceCaptureStartMark = true;
- capturingRunEncoder = runEncoderStatus.CAPTURING;
+ capturingRunEncoder = arduinoCaptureStatus.CAPTURING;
Util.CreateRunEncoderSessionDirIfNeeded (currentSession.UniqueID);
@@ -307,7 +299,7 @@ public partial class ChronoJumpWindow
if(! runEncoderSendCommand("end_capture:", "Ending capture ...", "Catched ending capture"))
{
runEncoderProcessError = true;
- capturingRunEncoder = runEncoderStatus.STOP;
+ capturingRunEncoder = arduinoCaptureStatus.STOP;
Util.FileDelete(fileName);
return;
}
@@ -328,7 +320,7 @@ public partial class ChronoJumpWindow
writer.Flush();
writer.Close();
((IDisposable)writer).Dispose();
- capturingRunEncoder = runEncoderStatus.STOP;
+ capturingRunEncoder = arduinoCaptureStatus.STOP;
//port.Close();
@@ -338,7 +330,7 @@ public partial class ChronoJumpWindow
//call graph
File.Copy(fileName, UtilEncoder.GetRunEncoderCSVFileName(), true); //can be
overwritten
lastRunEncoderFullPath = fileName;
- capturingRunEncoder = runEncoderStatus.COPIED_TO_TMP;
+ capturingRunEncoder = arduinoCaptureStatus.COPIED_TO_TMP;
}
}
@@ -370,7 +362,7 @@ LogB.Information(" fc C ");
{
LogB.Information(" fc C finish");
/*
- if(capturingRunEncoder != runEncoderStatus.COPIED_TO_TMP)
+ if(capturingRunEncoder != arduinoCaptureStatus.COPIED_TO_TMP)
{
Thread.Sleep (25); //Wait file is copied
return true;
@@ -442,7 +434,7 @@ LogB.Information(" fc E ");
*/
LogB.Information(" fc F ");
- if(capturingRunEncoder == runEncoderStatus.CAPTURING)
+ if(capturingRunEncoder == arduinoCaptureStatus.CAPTURING)
{
LogB.Information(" fc G ");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]