aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-09-26 12:32:54 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-09-26 12:32:54 +0300
commit387c1ee40b7bce5edd92491dc8d9edeb30a02524 (patch)
treea935cdc365230ab4d4e324c5c1712ffe4ba39b60 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parent771b7e5014a6023e660139100bb9221f86474a2b (diff)
downloadTango-387c1ee40b7bce5edd92491dc8d9edeb30a02524.tar.gz
Tango-387c1ee40b7bce5edd92491dc8d9edeb30a02524.zip
fix bug where thread jogging caused next jobs to be without ink, and other small problems
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 4cbe1f70f..60bf8123f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -322,16 +322,19 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
#ifdef READ_SCREW_ENCODER
int WinderRun;
WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]);
- if ((WinderRun < 50000)&&(Add100 == false))
+ if ((WinderRun < 20000)&&(Add100 == false))
{
- WinderRunSum+=WinderRun;
WinderRunSamples++;
- WinderRunAverage = WinderRunSum/WinderRunSamples;
- if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0))
+ if (WinderRunSamples>10)
{
- usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples,
- (int)(100*WinderRun/ScrewNumberOfSteps));
- Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0);
+ WinderRunSum+=WinderRun;
+ WinderRunAverage = WinderRunSum/(WinderRunSamples-10);
+ if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0))
+ {
+ usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples,
+ (int)(100*WinderRun/ScrewNumberOfSteps));
+ Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0);
+ }
}
}
else