[chronojump] sprintEncoder end copies correctly png
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] sprintEncoder end copies correctly png
- Date: Tue, 12 Jun 2018 16:04:35 +0000 (UTC)
commit 93090d10685d550a2dec8063a9ae377a45799452
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 12 18:03:32 2018 +0200
sprintEncoder end copies correctly png
r-scripts/sprintEncoder.R | 2 +-
src/gui/runEncoder.cs | 30 ++++++++++++++++++++++--------
2 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 5b678c8b..bdfe6982 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -22,7 +22,7 @@ args <- commandArgs(TRUE)
tempPath <- args[1]
optionsFile <- paste(tempPath, "/Roptions.txt", sep="")
-pngFile <- paste(tempPath, "/sprintGraph.png", sep="")
+pngFile <- paste(tempPath, "/sprintEncoderGraph.png", sep="")
#-------------- scan options file -------------
options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 374544d5..225ca38b 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -50,6 +50,7 @@ public partial class ChronoJumpWindow
static ForceSensorValues forceSensorValues;
*/
+ static string captureEndedMessage;
string runEncoderPortName;
SerialPort portRE; //Attention!! Don't reopen port because arduino makes reset
bool portREOpened;
@@ -173,7 +174,11 @@ public partial class ChronoJumpWindow
if(! runEncoderConnect())
return false;
+ if(File.Exists(UtilEncoder.GetSprintEncoderImage()))
+ Util.FileDelete(UtilEncoder.GetSprintEncoderImage());
+
event_execute_label_message.Text = "Please, wait ...";
+ captureEndedMessage = "";
capturingRunEncoder = arduinoCaptureStatus.STARTING;
button_execute_test.Sensitive = false;
@@ -344,7 +349,6 @@ public partial class ChronoJumpWindow
//call graph. Prepare data
File.Copy(fileName, UtilEncoder.GetRunEncoderCSVFileName(), true); //can be
overwritten
lastRunEncoderFullPath = fileName;
- capturingRunEncoder = arduinoCaptureStatus.COPIED_TO_TMP;
//create graph
RunEncoderGraph reg = new RunEncoderGraph(
@@ -354,20 +358,32 @@ public partial class ChronoJumpWindow
25); //TODO: hardcoded
reg.CallR(1699, 768); //TODO: hardcoded
+ DateTime runEncoderGraphStarted = DateTime.Now;
//TODO: check better if png is saved and have a cancel button
- while(! File.Exists(UtilEncoder.GetSprintEncoderImage()))
- {
+
+ while(! File.Exists(UtilEncoder.GetSprintEncoderImage()) &&
DateTime.Now.Subtract(runEncoderGraphStarted).TotalSeconds < 5)
Thread.Sleep(500);
+
+ if(File.Exists(UtilEncoder.GetSprintEncoderImage()))
+ {
+ LogB.Information("File exists on png, trying to copy");
try {
File.Copy(UtilEncoder.GetSprintEncoderImage(),
- Util.GetRunEncoderSessionDir(currentSession.UniqueID)
+ Path.DirectorySeparatorChar +
+ Util.GetRunEncoderSessionDir(currentSession.UniqueID)
+ Path.DirectorySeparatorChar +
lastRunEncoderFile + //nameDate
".png",
true); //can be overwritten
+ captureEndedMessage = " (Everything Ok. png on runEncoder folder)";
} catch {
LogB.Information("Couldn't copy the file");
+ captureEndedMessage = " (Crated png but only on /tmp, could not copy
file)";
}
+ } else {
+ LogB.Information("File does not exist on png (after 5 seconds)");
+ captureEndedMessage = "(png not created, problem doing the graph)";
}
+
+ capturingRunEncoder = arduinoCaptureStatus.COPIED_TO_TMP;
}
}
@@ -398,7 +414,6 @@ LogB.Information(" fc C ");
if(runEncoderProcessFinish)
{
LogB.Information(" fc C finish");
-/*
if(capturingRunEncoder != arduinoCaptureStatus.COPIED_TO_TMP)
{
Thread.Sleep (25); //Wait file is copied
@@ -406,8 +421,7 @@ LogB.Information(" fc C finish");
}
else
{
-*/
- event_execute_label_message.Text = "Saved.";
+ event_execute_label_message.Text = "Saved." + captureEndedMessage;
Thread.Sleep (250); //Wait a bit to ensure is copied
/*
@@ -419,7 +433,7 @@ LogB.Information(" fc C finish");
if(force_sensor_ai_drawingareaShown)
forceSensorDoGraphAI();
*/
-// }
+ }
LogB.Information(" fc C finish 2");
} else if(runEncoderProcessCancel || runEncoderProcessError)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]