diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-08-13 19:27:10 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-08-13 19:27:10 +0300 |
| commit | abc2f5fc8f757eddeccdd10646039c96b58e522d (patch) | |
| tree | c759454707c338f08e602800fb5f4a429d46f4fd /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | |
| parent | 7a914abc9e34c12acec0234ab748e17a21833af7 (diff) | |
| download | Tango-abc2f5fc8f757eddeccdd10646039c96b58e522d.tar.gz Tango-abc2f5fc8f757eddeccdd10646039c96b58e522d.zip | |
Version 1.4.3.7 Power off sequence with flushing and cleaning job. VOC alarms, safety, auto filling dispensers
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 26 |
1 files changed, 19 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 7e1312464..5d9b26f92 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -59,10 +59,11 @@ static uint32_t WindingConeLocation; static uint32_t WinderBackToBaseTime = 800; InternalWinderConfigStruc InternalWinderCfg = {0}; - +#define READ_SCREW_ENCODER +#ifdef READ_SCREW_ENCODER uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; uint32_t ScrewLocationRun[3]; - +#endif bool SampleWinding = false; uint32_t Winder_Init(void) { @@ -132,8 +133,10 @@ uint32_t Winder_Prepare(void *JobDetails) return ERROR; }*/ +#ifdef READ_SCREW_ENCODER ScrewLocationRun[0] = 0; ScrewLocationRun[1] = 0; +#endif if (( KeepWindingCone == false)||(WindingConeLocation == 0)) { WindingConeLocation = InternalWinderCfg.startoffsetpulses; @@ -176,10 +179,11 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); +#ifdef READ_SCREW_ENCODER Read_Screw_Encoder(); ScrewLocationLimitSwitch = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); - +#endif REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); if (ReadValue != LIMIT) @@ -203,6 +207,7 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) MotorStop (HARDWARE_MOTOR_TYPE__MOTO_SCREW,Soft_Hiz); //per L6470 errata between mov and run commands Task_sleep(5); +#ifdef READ_SCREW_ENCODER Reset_Screw_Encoder(); Task_sleep(5); Read_Screw_Encoder(); @@ -210,10 +215,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) ScrewLocationStart = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); +#endif SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home ScrewCurrentDirection = false; +#ifdef READ_SCREW_ENCODER ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; +#endif ScrewSpeed = 0; ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; @@ -302,13 +310,15 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if (SampleWinding) return OK; //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; - //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); +#ifdef READ_SCREW_ENCODER + + 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); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); - +#endif if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { if (Add100 == true) //once per job @@ -617,11 +627,13 @@ void ScrewTimerInterrupt(int ARG0) if (SCREW_TimerActivated == true) { - Read_Screw_Encoder(); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); +#ifdef READ_SCREW_ENCODER + Read_Screw_Encoder(); ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; +#endif // ScrewChangeCounter = 0; // ScrewChangeLimit = ScrewRunningTime/12000000; ScrewDirectionChangeCounter++; |
