[chronojump] Show to user if set is corrected (not fully extended)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Show to user if set is corrected (not fully extended)
- Date: Thu, 4 Aug 2016 12:00:57 +0000 (UTC)
commit 5f390dc868d9f4d74d7800ece4cafe5f0e786205
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Aug 4 13:56:23 2016 +0200
Show to user if set is corrected (not fully extended)
encoder/graph.R | 3 ++-
encoder/util.R | 10 +++++++---
src/encoderRProc.cs | 4 ++--
src/gui/encoder.cs | 11 +++++++++++
4 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index aa4cd6a..eb3ed78 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2449,7 +2449,8 @@ doProcess <- function(options)
displacement <- fixInertialSignalIfNotFullyExtended(displacement,
paste(op$EncoderTempPath,
"/chronojump-last-encoder-data.txt",
- sep=""),
+ sep=""),
+ op$SpecialData,
FALSE)
diametersPerMs <- getInertialDiametersPerMs(displacement, op$diameter)
diff --git a/encoder/util.R b/encoder/util.R
index 0de09ec..32315e2 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -1103,8 +1103,9 @@ getDisplacementInertialBody <- function(positionStart, displacement, draw, title
#used when user captures without string fully extended
#signal is the information coming from the encoder, graph is to debug
#see codeExplained/image detect-and-fix-inertial-string-not-fully-extended.png
-fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, graph)
+fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, specialDataFile, graph)
{
+ write("at fixInertialSignalIfNotFullyExtended", stderr())
angle <- cumsum(signal) #360 degrees every 200 ticks
maximums <- extrema(angle)$maxindex[,1]
@@ -1185,10 +1186,13 @@ fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, graph)
par(mfrow=c(1,1))
}
- #define new signal only if the error in extended string is more than 360
- if(meanByExtrema > 200) {
+ #define new signal only if the error in extended string is more than 4 revolutions
+ if(abs(meanByExtrema) > 800) {
+ write(signal, file="/tmp/old.txt", ncolumns=length(signal), sep=", ")
signal <- signal[angleCorrectedCrossZero:length(signal)]
+ write("SIGNAL CORRECTED", specialDataFile)
+
#write to file and return displacement to be used
write(signal, file=saveFile, ncolumns=length(signal), sep=", ")
}
diff --git a/src/encoderRProc.cs b/src/encoderRProc.cs
index 3a10375..5a3e8c7 100644
--- a/src/encoderRProc.cs
+++ b/src/encoderRProc.cs
@@ -438,7 +438,7 @@ public class EncoderRProcAnalyze : EncoderRProc
if(es.Ep.Analysis == "exportCSV")
Util.FileDelete(UtilEncoder.GetEncoderStatusTempBaseFileName() + "6.txt");
- //delete 1RM data if exists
+ //delete SpecialData if exists
string specialData = UtilEncoder.GetEncoderSpecialDataTempFileName();
if (File.Exists(specialData))
File.Delete(specialData);
@@ -512,7 +512,7 @@ public class EncoderRProcAnalyze : EncoderRProc
if(es.Ep.Analysis == "exportCSV")
Util.FileDelete(UtilEncoder.GetEncoderStatusTempBaseFileName() + "6.txt");
- //delete 1RM data if exists
+ //delete SpecialData if exists
string specialData = UtilEncoder.GetEncoderSpecialDataTempFileName();
if (File.Exists(specialData))
File.Delete(specialData);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 12242f7..938a3f9 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5544,6 +5544,17 @@ public partial class ChronoJumpWindow
if(action == encoderActions.CURVES_AC && radio_encoder_capture_cont.Active && !
encoderProcessFinishContMode)
on_button_encoder_capture_clicked (new object (), new EventArgs ());
+
+ //on inertial, check after capture if string was not fully extended and was corrected
+ if(getMenuItemMode() == Constants.Menuitem_modes.POWERINERTIAL &&
+ action == encoderActions.CURVES_AC &&
+ Util.FileExists(UtilEncoder.GetEncoderSpecialDataTempFileName()))
+ {
+ string str = Util.ReadFile(UtilEncoder.GetEncoderSpecialDataTempFileName(),
true);
+ if(str != null && str == "SIGNAL CORRECTED")
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Set corrected. string was not fully
extended at the beginning."));
+ }
} else { //ANALYZE
if(encoderProcessCancel) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]