diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-12-13 01:36:14 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-12-13 01:36:14 +0200 |
| commit | 10ed2886c61b94ed0ec294e40d260d2a69ef2cc1 (patch) | |
| tree | fd439c24cf0cd48350f42cbfa54aeb90d563e5da /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 2a73ff05b9bf95da0f9fe10aa7823bd70f01f01e (diff) | |
| parent | a793aababd2b255dda42540715792167164e1e94 (diff) | |
| download | Tango-10ed2886c61b94ed0ec294e40d260d2a69ef2cc1.tar.gz Tango-10ed2886c61b94ed0ec294e40d260d2a69ef2cc1.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 20 |
1 files changed, 13 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 a75241671..03bc9d24d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -50,6 +50,7 @@ bool WinderMotorSpeedRollOver = false; int StartWinderCalculation = 0; #define DEFAULT_SCREW_SPEED 1200 double ScrewSpeed = DEFAULT_SCREW_SPEED; +double RetreatTime = 0; double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone bool SCREW_TimerActivated = false; @@ -635,6 +636,7 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; + RetreatTime = ScrewNumberOfSteps*1000/ScrewSpeed; REPORT_MSG((int)ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); REPORT_MSG((int)ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); //MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); @@ -673,11 +675,11 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) //move the cart to the edge so the spool can be easily replaced //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, 1000, GPI_LS_SCREW_RIGHT, NULL,0); //MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,2000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,RetreatTime*2); #ifdef FOUR_WINDERS - MotorMovetoLimitSwitch (SCREW_2_Motor,MotorsCfg[SCREW_2_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE2_2, NULL,2000); - MotorMovetoLimitSwitch (SCREW_3_Motor,MotorsCfg[SCREW_3_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE1_2, NULL,2000); - MotorMovetoLimitSwitch (SCREW_4_Motor,MotorsCfg[SCREW_4_Motor].directionthreadwize, ScrewSpeed, GPI_LS_RDANCER_UP, NULL,2000); + MotorMovetoLimitSwitch (SCREW_2_Motor,MotorsCfg[SCREW_2_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE2_2, NULL,RetreatTime*2); + MotorMovetoLimitSwitch (SCREW_3_Motor,MotorsCfg[SCREW_3_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE1_2, NULL,RetreatTime*2); + MotorMovetoLimitSwitch (SCREW_4_Motor,MotorsCfg[SCREW_4_Motor].directionthreadwize, ScrewSpeed, GPI_LS_RDANCER_UP, NULL,RetreatTime*2); #endif return OK; @@ -685,10 +687,14 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) uint32_t WinderDistanceToSpoolState(void ) { double DTS_Time = (dryerbufferCentimeters/dyeingspeed)*1000;//distance to spool time in milliseconds - REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); + double WinderBackTimeBySpeed = WinderBackToBaseTime; + WinderBackTimeBySpeed *= 50; + WinderBackTimeBySpeed /= dyeingspeed; + Report("WinderDistanceToSpoolState start", __FILE__,DTS_Time,RetreatTime, RpMessage, (int)WinderBackTimeBySpeed, 0); + //REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); - ScrewDTSControlId = AddControlCallback("screw DTS",ScrewDTSCallback, DTS_Time-WinderBackToBaseTime,TemplateDataReadCBFunction,0,0,0); - Report("ScrewDTSCallback start", __FILE__,DTS_Time,msec_millisecondCounter, RpMessage, WinderBackToBaseTime, 0); + ScrewDTSControlId = AddControlCallback("screw DTS",ScrewDTSCallback, DTS_Time-RetreatTime,TemplateDataReadCBFunction,0,0,0); + Report("ScrewDTSCallback start", __FILE__,DTS_Time,msec_millisecondCounter, RpMessage, (int)WinderBackTimeBySpeed, 0); return OK; } |
