diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-28 13:55:52 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-28 13:55:52 +0200 |
| commit | 521326ce426ed0cd5b8d92b280cdf0c7213e7b50 (patch) | |
| tree | 3c3f8e7f1490a6d848ed307ee108c04fad80fa0a /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | |
| parent | a43d087e6d77333cd6f40642acb731519697998e (diff) | |
| parent | abc09fbcd0a9c0883b957378d71679be776b6f56 (diff) | |
| download | Tango-521326ce426ed0cd5b8d92b280cdf0c7213e7b50.tar.gz Tango-521326ce426ed0cd5b8d92b280cdf0c7213e7b50.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.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 32dea353a..9d57cd29f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -47,6 +47,7 @@ uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of ru double WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; bool WinderMotorSpeedRollOver = false; +int StartWinderCalculation = 0; #define DEFAULT_SCREW_SPEED 1200 double ScrewSpeed = DEFAULT_SCREW_SPEED; double ScrewRunningTime = 0; @@ -126,6 +127,8 @@ uint32_t Winder_Prepare(void *JobDetails) //JobTicket* JobTicket = JobDetails; //float process_speed = JobTicket->processparameters->dyeingspeed; double ScrewSpeed = DEFAULT_SCREW_SPEED;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now + WinderMotorSpeedRollOver=false; + StartWinderCalculation = 0; //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); /* @@ -297,10 +300,9 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if (WinderMotorSpeedRollOver == false) { Add100 = true; - LOG_ERROR(Add100, "Add100 = true"); + //LOG_ERROR(Add100, "Add100 = true"); } // WinderMotorSpeedCounter=0; - WinderMotorSpeedRollOver=true; } // } if (flipflop == 0) @@ -326,11 +328,13 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) #ifdef READ_SCREW_ENCODER int WinderRun; WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]); - if ((WinderRun < 30000)&&(WinderMotorSpeedRollOver == true)) + if (WinderMotorSpeedRollOver == true) + StartWinderCalculation++; + if ((WinderRun < 30000)&&(StartWinderCalculation >= 2)) { WinderRunSamples++; WinderRunSum+=WinderRun; - WinderRunAverage = WinderRunSum/(WinderRunSamples); + WinderRunAverage = WinderRunSum/WinderRunSamples; 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, @@ -338,8 +342,8 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); } } - else - Report("winder run error value" ,__FILE__,WinderRun,ScrewLocationRun[0],RpWarning,ScrewLocationRun[1], 0); + //else + // Report("winder run error value" ,__FILE__,WinderRun,ScrewLocationRun[0],RpWarning,ScrewLocationRun[1], 0); //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); //REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); @@ -355,6 +359,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { ScrewNumberOfSteps += 100; Add100 = false; + WinderMotorSpeedRollOver=true; } if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) |
