diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-04 11:25:10 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-04 11:25:10 +0300 |
| commit | 20310eb98a85ef1b4908c0d7b482f089c5a81bfb (patch) | |
| tree | fec538087e0b82284597aa6c1c9a205f3bd0d680 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 3e11b6594d73eb3e7eda93920ecef942f4c301c4 (diff) | |
| download | Tango-20310eb98a85ef1b4908c0d7b482f089c5a81bfb.tar.gz Tango-20310eb98a85ef1b4908c0d7b482f089c5a81bfb.zip | |
FS_SPD inmotors handled. some bugs ahndling
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 48 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h | 2 |
2 files changed, 27 insertions, 23 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index e564e52d0..aa9e6ec94 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -145,37 +145,41 @@ uint32_t WinderPresegmentReady(uint32_t deviceID, uint32_t ReadValue) return PreSegmentReady(Module_Winder,ModuleDone); } -uint32_t Winder_Presegment(void *JobDetails) +uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId) { JobTicket* JobTicket = JobDetails; int process_speed = JobTicket->processparameters->dyeingspeed; float screw_speed = 0; float RotationsPerSecond; - ScrewCurrentDirection = (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize); + if (SegmentId == 0) // do all this only in the beginning of the job. do not touch after that (assuming spool does not change mid job) + { + ScrewCurrentDirection = (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize); + + // * speed is set by the winding parameters and by winder rotational speed (read POSITION every 10msec) + // * calculate + // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed + // * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation. + screw_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; + // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. + RotationsPerSecond = process_speed / (InternalWinderCfg.diameter * PI); + // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. + ScrewSpeed = screw_speed*RotationsPerSecond; - // * speed is set by the winding parameters and by winder rotational speed (read POSITION every 10msec) - // * calculate - // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed - // * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation. - screw_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; - // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. - RotationsPerSecond = process_speed / (InternalWinderCfg.diameter * PI); - // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. - ScrewSpeed = screw_speed*RotationsPerSecond; + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); + //screw_speed = InternalWinderCfg.milimetersperrotation + // * 2. determine optimal micro-step setting + // * 3. calculate cart travel length from winding parameters + // * 4. start move of travel length + // * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed + ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back. + ScrewControlId = AddControlCallback(ScrewDirectionChange, eOneMillisecond,MotorControlGetnBusyState,(IfTypeMotors*0x100+HARDWARE_MOTOR_TYPE__MOTO_SCREW), HARDWARE_MOTOR_TYPE__MOTO_SCREW, 0); - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); - //screw_speed = InternalWinderCfg.milimetersperrotation -// * 2. determine optimal micro-step setting -// * 3. calculate cart travel length from winding parameters -// * 4. start move of travel length -// * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed - ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; - MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back. - ScrewControlId = AddControlCallback(ScrewDirectionChange, eOneMillisecond,MotorControlGetnBusyState,(IfTypeMotors*0x100+HARDWARE_MOTOR_TYPE__MOTO_SCREW), HARDWARE_MOTOR_TYPE__MOTO_SCREW, 0); + // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_speed,WinderPresegmentReady); + //in a callback: calculate backing rate for top and bottom, update point 0, update passing length, call the appropriate move to 0 / move; - // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_speed,WinderPresegmentReady); - //in a callback: calculate backing rate for top and bottom, update point 0, update passing length, call the appropriate move to 0 / move; + } PreSegmentReady(Module_Winder,ModuleDone); return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index b7401c77f..4a7f1144c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -23,7 +23,7 @@ uint32_t ThreadInitialTestStub(); //uint32_t MotorPidRequestMessage(HardwarePidControl* request); uint32_t Winder_Init(void); uint32_t Winder_Prepare(void); -uint32_t Winder_Presegment(void *JobDetails); +uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId); uint32_t Winder_End(void); |
