aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-09-26 13:28:23 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-09-26 13:28:23 +0300
commit97831ef4082566980924cbd10536aa3261d80f4f (patch)
treee6dabc2a36d712deeb55640e1750b4a2abbc4c72 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parent0c100a23f6006a73a7c1717d90da9a7fc25832d6 (diff)
parentabb10d023660d96414c614a77b5e687ca1aed4b2 (diff)
downloadTango-97831ef4082566980924cbd10536aa3261d80f4f.tar.gz
Tango-97831ef4082566980924cbd10536aa3261d80f4f.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
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