diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-10-24 17:08:45 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-10-24 17:08:45 +0300 |
| commit | b63e2f557d781fa3cfcf8e6b9c784641c0c8927f (patch) | |
| tree | 687c2d25f1a06f0f8a20d44a365eac33355c20f3 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | |
| parent | 87e24883ea2c5f1947943547cff29357bc8cbd2f (diff) | |
| parent | 50ed121723c0dad1ce5d1af7f2a12a56ae2ba8a7 (diff) | |
| download | Tango-b63e2f557d781fa3cfcf8e6b9c784641c0c8927f.tar.gz Tango-b63e2f557d781fa3cfcf8e6b9c784641c0c8927f.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_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, 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 50c1f6c33..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; @@ -127,7 +128,7 @@ uint32_t Winder_Prepare(void *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"); /* @@ -299,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) @@ -328,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, @@ -340,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"); @@ -357,6 +359,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { ScrewNumberOfSteps += 100; Add100 = false; + WinderMotorSpeedRollOver=true; } if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) |
