diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-03 11:12:13 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-03 11:12:13 +0300 |
| commit | 5b7025699bc09a0b5afd08a4552a397c025e0c73 (patch) | |
| tree | 2c9a24d53a8304698e45648ececda7f5d837f8cf /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 61b7ed2086a8ed09e23a87d4b3720840a1b50aa7 (diff) | |
| parent | ec4baf29ede89bf4290f52578df517dc784cb71c (diff) | |
| download | Tango-5b7025699bc09a0b5afd08a4552a397c025e0c73.tar.gz Tango-5b7025699bc09a0b5afd08a4552a397c025e0c73.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 39 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 4 |
2 files changed, 31 insertions, 12 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 70f32ce6d..df88db3f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -54,6 +54,9 @@ uint32_t ScrewControlId = 0xFF; InternalWinderConfigStruc InternalWinderCfg = {0}; +uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; +uint32_t ScrewLocationRun[3]; + uint32_t Winder_Init(void) { ScrewTimerInterruptInit(); @@ -109,6 +112,10 @@ uint32_t Winder_Prepare(void) AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true); return ERROR; }*/ + + ScrewLocationRun[0] = 0; + ScrewLocationRun[1] = 0; + if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT) { //REPORT_MSG(LIMIT, "Winder_Prepare at limit"); @@ -136,6 +143,11 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); + //Read_Screw_Encoder(); + //ScrewLocationLimitSwitch = Screw_RotEnc.Position; + //REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); + + REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); if (ReadValue != LIMIT) { @@ -157,7 +169,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) //SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency); + //Read_Screw_Encoder(); + //ScrewLocationStart = Screw_RotEnc.Position; + + REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); + ScrewCurrentDirection = false; + ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; ScrewSpeed = 0; ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; @@ -230,6 +248,10 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; + //REPORT_MSG(ScrewLocationRun[1] - ScrewLocationRun[0], "Screw Run NumberOfSteps"); + //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0])); + //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); + //Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0); if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -242,7 +264,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) { ScrewNumberOfSteps--; - //REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); + REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); } } @@ -251,7 +273,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0) { ScrewNumberOfSteps++; - //REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps"); + REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps"); } } if (WinderMotorSpeedRollOver) @@ -288,7 +310,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); //Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); -// Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); + //Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } /********************************************************************************/ @@ -440,6 +462,9 @@ void ScrewTimerInterrupt(int ARG0) ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt ROM_IntMasterDisable(); + //Read_Screw_Encoder(); + //ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; + if (SCREW_TimerActivated == true) { ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); @@ -455,13 +480,7 @@ void ScrewTimerInterrupt(int ARG0) } ROM_IntMasterEnable(); Rotations+=0.03; - /*random++; - if (random >= 2) - random = -1;*/ - //Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0); - // - // Enable all interrupts. - // + return ; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index a4208ad25..c292f7dcd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -842,8 +842,8 @@ char Endstr[150]; Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); ThreadUpdateProcessLength (0.0,(void *)NULL); - TotalProcessedLength = 0.0; - SetOriginMotorSpeed(0); + //TotalProcessedLength = 0.0; + SetOriginMotorSpeed(0); #ifdef HUNDRED_MICROSECONDS_DANCER_READ MillisecLogClose(); #endif |
