[chronojump] Fixed label time bad value on ending jumps/runs few times
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed label time bad value on ending jumps/runs few times
- Date: Fri, 13 Feb 2015 17:41:27 +0000 (UTC)
commit 1ce17ff24ccec6411982b3a911f9a08b7cd6f3da
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 13 18:40:54 2015 +0100
Fixed label time bad value on ending jumps/runs few times
src/execute/event.cs | 4 ++--
src/execute/jump.cs | 41 ++++++++++++++++++++++++++++++++---------
src/execute/run.cs | 40 +++++++++++++++++++++-------------------
src/gui/chronojump.cs | 2 +-
4 files changed, 56 insertions(+), 31 deletions(-)
---
diff --git a/src/execute/event.cs b/src/execute/event.cs
index 4832ebf..f7f48a3 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2015 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -359,7 +359,7 @@ public class EventExecute
progressbarEventOrTimeExecution (egd.Progressbar_time, percentageMode,
egd.Label_time_value, events);
}
- protected void progressbarEventOrTimeExecution (Gtk.ProgressBar progressbar, bool percentageMode,
Gtk.Label label_value, double events)
+ private void progressbarEventOrTimeExecution (Gtk.ProgressBar progressbar, bool percentageMode,
Gtk.Label label_value, double events)
{
if(progressbarLimit == -1) { //unlimited event (until 'finish' is clicked)
progressbar.Pulse();
diff --git a/src/execute/jump.cs b/src/execute/jump.cs
index 2b424d4..9c9c453 100644
--- a/src/execute/jump.cs
+++ b/src/execute/jump.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2015 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -39,8 +39,13 @@ public class JumpExecute : EventExecute
//better as private and don't inherit, don't know why
//protected Chronopic cp;
private Chronopic cp;
-
- private Jump jumpDone;
+
+ //used by the updateTimeProgressBar for display its time information
+ //copied from execute/run.cs
+ protected enum jumpPhases {
+ PRE_OR_DOING, PLATFORM_END
+ }
+ protected static jumpPhases jumpPhase;
private int angle = -1;
@@ -135,6 +140,8 @@ public class JumpExecute : EventExecute
//prepare jump for being cancelled if desired
cancel = false;
totallyCancelled = false;
+
+ jumpPhase = jumpPhases.PRE_OR_DOING;
//in simulated mode, make the jump start just when we arrive to waitEvent at the
first time
//mark now that we have leaved platform:
@@ -216,6 +223,8 @@ public class JumpExecute : EventExecute
cancel = false;
totallyCancelled = false;
+ jumpPhase = jumpPhases.PRE_OR_DOING;
+
//in simulated mode, make the jump start just when we arrive to waitEvent at the
first time
if (simulated) {
if(fall != -1)
@@ -334,6 +343,9 @@ public class JumpExecute : EventExecute
LogB.Information(string.Format("t1:{0}", timestamp));
tv = timestamp / 1000.0;
+
+ jumpPhase = jumpPhases.PLATFORM_END;
+
write();
success = true;
@@ -369,6 +381,9 @@ public class JumpExecute : EventExecute
//if(fixedValue == 0.5)
if(type == Constants.TakeOffName || type ==
Constants.TakeOffWeightName) {
tv = 0;
+
+ jumpPhase = jumpPhases.PLATFORM_END;
+
write();
success = true;
}
@@ -468,6 +483,9 @@ public class JumpExecute : EventExecute
}
protected override void updateTimeProgressBar() {
+ if(jumpPhase == jumpPhases.PLATFORM_END)
+ return;
+
//until it has not landed for first time, show a pulse with no values
progressBarEventOrTimePreExecution(
false, //isEvent false: time
@@ -476,11 +494,6 @@ public class JumpExecute : EventExecute
);
}
-/*
- public Jump JumpDone {
- get { return jumpDone; }
- }
-*/
public virtual bool TypeHasWeight
{
get { return SqliteJumpType.HasWeight("jumpType", type); }
@@ -657,6 +670,8 @@ public class JumpRjExecute : JumpExecute
finish = false;
totallyFinished = false;
+ jumpPhase = jumpPhases.PRE_OR_DOING;
+
//in simulated mode, make the jump start just when we arrive to waitEvent at the
first time
//mark now that the opposite as before:
if (simulated) {
@@ -784,6 +799,8 @@ public class JumpRjExecute : JumpExecute
if(limitAsDouble != -1) {
if(Util.GetNumberOfJumps(tvString, false) >= limitAsDouble)
{
+ jumpPhase = jumpPhases.PLATFORM_END;
+
writeRj(false); //tempTable
success = true;
@@ -816,6 +833,8 @@ public class JumpRjExecute : JumpExecute
if (finish) {
//write only if there's a jump at minimum
if(Util.GetNumberOfJumps(tcString, false) >= 1 && Util.GetNumberOfJumps(tvString,
false) >= 1) {
+ jumpPhase = jumpPhases.PLATFORM_END;
+
writeRj(false); //tempTable
totallyFinished = true;
@@ -876,6 +895,10 @@ public class JumpRjExecute : JumpExecute
protected override void updateTimeProgressBar() {
//limited by jumps or time or unlimited, but has no finished
+
+ if(jumpPhase == jumpPhases.PLATFORM_END)
+ return;
+
if(firstRjValue)
//until it has not landed for first time, show a pulse with no values
@@ -886,7 +909,7 @@ public class JumpRjExecute : JumpExecute
);
else
//after show a progressBar with time value
- if(! finish)
+ if(! finish) //this finish happens when user clicks 'finish' or it finished by time.
The above PLATFORM_END is used when test end by done tracks
progressBarEventOrTimePreExecution(
false, //isEvent false: time
!jumpsLimited, //if jumpsLimited: activity, if timeLimited:
fraction
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 5846292..46515a8 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2015 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -41,7 +41,7 @@ public class RunExecute : EventExecute
protected enum runPhases {
PRE_RUNNING, PLATFORM_INI_YES_TIME, PLATFORM_INI_NO_TIME, RUNNING, PLATFORM_END
}
- protected runPhases runPhase;
+ protected static runPhases runPhase;
protected bool checkDoubleContact;
protected int checkDoubleContactTime;
@@ -272,6 +272,8 @@ public class RunExecute : EventExecute
success = true;
if(success) {
+ runPhase = runPhases.PLATFORM_END;
+
//add the first contact time if PLATFORM_INI_YES_TIME
if(timestampFirstContact > 0)
timestamp += timestampFirstContact;
@@ -288,8 +290,6 @@ public class RunExecute : EventExecute
3
);
needUpdateEventProgressBar = true;
-
- runPhase = runPhases.PLATFORM_END;
}
}
}
@@ -338,7 +338,7 @@ public class RunExecute : EventExecute
}
protected override void updateTimeProgressBar() {
- /* 5 situations:
+ /* 4 situations:
* 1- if we start out and have not arrived to platform, it should be a pulse with no time
value on label:
* case runPhases.PRE_RUNNING
* 2- if we are on the platform, it should be a pulse
@@ -351,8 +351,13 @@ public class RunExecute : EventExecute
* 3- if we leave the platform, it should be a pulse with timerCount on label:
* case runPhases.RUNNING
* 4- if we arrive (finish), it should be a pulse with chronopic time on label:
- * case runPhases.PLATFORM_END
+ * case runPhases.PLATFORM_END.
+ * Don't update time label here because later it will be overrided with the good
data from Chronopic
+ * and sometimes can happen in different order, and then bad data (timerCount)
will be shown on label at the end of test
*/
+
+ if(runPhase == runPhases.PLATFORM_END) //see comment above
+ return;
double myTimeValue = 0;
switch (runPhase) {
@@ -368,10 +373,6 @@ public class RunExecute : EventExecute
case runPhases.RUNNING:
myTimeValue = timerCount; //show time from the timerCount
break;
- case runPhases.PLATFORM_END:
- myTimeValue = timerCount; //show time from the timerCount
- //but chronojump.cs will update info soon with chronopic value
- break;
}
@@ -659,10 +660,11 @@ public class RunIntervalExecute : RunExecute
//has arrived, limited by tracks
if(tracks >= limitAsDouble)
{
+ runPhase = runPhases.PLATFORM_END;
+
//finished
writeRunInterval(false); //tempTable
= false
success = true;
- runPhase = runPhases.PLATFORM_END;
}
//progressBarEventOrTimePreExecution(
updateProgressBar= new UpdateProgressBar (
@@ -743,6 +745,8 @@ public class RunIntervalExecute : RunExecute
} while ( ! success && ! cancel && ! finish );
if (finish) {
+ runPhase = runPhases.PLATFORM_END;
+
//write();
//write only if there's a run at minimum
if(Util.GetNumberOfJumps(intervalTimesString, false) >= 1) {
@@ -753,8 +757,6 @@ public class RunIntervalExecute : RunExecute
//cancel a run if clicked finish before any events done, or ended by time
without events
cancel = true;
}
-
- runPhase = runPhases.PLATFORM_END;
}
if(cancel || finish) {
//event will be raised, and managed in chronojump.cs
@@ -799,7 +801,7 @@ public class RunIntervalExecute : RunExecute
}
protected override void updateTimeProgressBar() {
- /* 5 situations:
+ /* 4 situations:
* 1- if we start out and have not arrived to platform, it should be a pulse with no time
value on label:
* case runPhases.PRE_RUNNING
* 2- if we are on the platform, it should be a pulse
@@ -813,8 +815,13 @@ public class RunIntervalExecute : RunExecute
* case runPhases.RUNNING
* 4- if we arrive (finish), it should be a pulse with chronopic time on label:
* case runPhases.PLATFORM_END
+ * Don't update time label here because later it will be overrided with the good
data from Chronopic
+ * and sometimes can happen in different order, and then bad data (timerCount)
will be shown on label at the end of test
*/
+ if(runPhase == runPhases.PLATFORM_END) //see comment above
+ return;
+
double myTimeValue = 0;
bool percentageMode = true; //false is activity mode
switch (runPhase) {
@@ -834,11 +841,6 @@ public class RunIntervalExecute : RunExecute
percentageMode = !tracksLimited;
myTimeValue = timerCount; //show time from the timerCount
break;
- case runPhases.PLATFORM_END:
- percentageMode = !tracksLimited;
- myTimeValue = timerCount; //show time from the timerCount
- //but chronojump.cs will update info soon with chronopic value
- break;
}
if(! finish)
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 494c99f..3b1597f 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2015 Xavier de Blas <xaviblas gmail com>
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]