[chronojump] Force sensor manages better when sensor is not connected...
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor manages better when sensor is not connected...
- Date: Tue, 17 Oct 2017 14:37:54 +0000 (UTC)
commit 7bc6c97b6d63c7b69c176b6ada1d11be8b7f49df
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Oct 17 16:33:04 2017 +0200
Force sensor manages better when sensor is not connected...
src/gui/chronojump.cs | 9 +--------
src/gui/forceSensor.cs | 27 +++++++++++----------------
2 files changed, 12 insertions(+), 24 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5aee332..58cfc8e 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3703,14 +3703,7 @@ public partial class ChronoJumpWindow
on_force_sensor_activate(canCaptureC);
*/
- int numForceSensor = chronopicRegister.NumConnectedOfType(
- ChronopicRegisterPort.Types.ARDUINO_FORCE);
-
- if(numForceSensor == 0)
- new DialogMessage(Constants.MessageTypes.WARNING, "Sensor not found.");
- else
- on_buttons_force_sensor_clicked(button_execute_test, new EventArgs ());
-
+ on_buttons_force_sensor_clicked(button_execute_test, new EventArgs ());
return;
}
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 6f64f5f..362c486 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -137,8 +137,19 @@ public partial class ChronoJumpWindow
enum forceSensorOtherModeEnum { TARE, CALIBRATE, CAPTURE_PRE, CHECK_VERSION }
static forceSensorOtherModeEnum forceSensorOtherMode;
+ //buttons: tare, calibrate, check version and capture (via on_button_execute_test_cicked) come here
private void on_buttons_force_sensor_clicked(object o, EventArgs args)
{
+ if(chronopicRegister.NumConnectedOfType(ChronopicRegisterPort.Types.ARDUINO_FORCE) == 0)
+ {
+ new DialogMessage(Constants.MessageTypes.WARNING, "Sensor not found.");
+ return;
+ }
+
+ if(! portFSOpened)
+ if(! forceSensorConnect())
+ return;
+
capturingForce = forceStatus.STOP;
forceSensorButtonsSensitive(false);
forceSensorTimeStart = DateTime.Now;
@@ -216,10 +227,6 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorTare()
{
- if(! portFSOpened)
- if(! forceSensorConnect())
- return;
-
if(! forceSensorSendCommand("tare:", "Taring ...", "Catched force taring"))
return;
@@ -238,10 +245,6 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorCalibrate()
{
- if(! portFSOpened)
- if(! forceSensorConnect())
- return;
-
if(! forceSensorSendCommand("calibrate:" +
spin_force_sensor_calibration_kg_value.Value.ToString() + ";",
"Calibrating ...", "Catched force calibrating"))
return;
@@ -261,10 +264,6 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorCheckVersion()
{
- if(! portFSOpened)
- if(! forceSensorConnect())
- return;
-
if(! forceSensorSendCommand("get_version:", "Checking version ...", "Catched checking
version"))
return;
@@ -283,10 +282,6 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorCapturePre()
{
- if(! portFSOpened)
- if(! forceSensorConnect())
- return;
-
forceSensorOtherMessage = "Please, wait ...";
capturingForce = forceStatus.STARTING;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]