diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-08-15 10:09:04 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-08-15 10:09:04 +0300 |
| commit | cecf66097e99a12d6bcb965da06e44ff3bd925fd (patch) | |
| tree | 9e56fed444c4ac95a6a61e84d02b15a9f4c1861c /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | bad27bfb9f964ec404f421aa412e6f37804815c1 (diff) | |
| download | Tango-cecf66097e99a12d6bcb965da06e44ff3bd925fd.tar.gz Tango-cecf66097e99a12d6bcb965da06e44ff3bd925fd.zip | |
added by shlomo to thread winder
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 5d9b26f92..0ac23baf5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -311,8 +311,20 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) return OK; //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; #ifdef READ_SCREW_ENCODER - - REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); + WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]); + if (WinderRun < 50000) + { + WinderRunSum+=WinderRun; + WinderRunSamples++; + WinderRunAverage = WinderRunSum/WinderRunSamples; + if ((fabs(WinderRun-WinderRunAverage)>=50)||(WinderRunSamples%50 == 0)) + { + usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d }",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples); + Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); + } + } + //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); + //REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); //usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, // abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); |
