diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-10-04 14:56:36 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-10-04 14:56:36 +0300 |
| commit | 632378c43fea445b5ce0808eabc8d02a97a7a387 (patch) | |
| tree | 0f71a85552f944875da567d0dc391ed981138305 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 5461fa6ed66e087ea3cc582af39a733e1a1202c2 (diff) | |
| parent | 141b450771f7e98b93eca9492e0cbe800da13e1f (diff) | |
| download | Tango-632378c43fea445b5ce0808eabc8d02a97a7a387.tar.gz Tango-632378c43fea445b5ce0808eabc8d02a97a7a387.zip | |
merge conflict
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 19 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 2 |
2 files changed, 14 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 1b32e50fd..4b381e401 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -22,7 +22,7 @@ #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" bool Winder_ScrewHoming = false; -bool Winder_Active = false; +//bool Winder_Active = false; uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag); uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue); @@ -73,7 +73,7 @@ uint32_t Winder_Prepare(void) { uint32_t status = 0; //JobTicket* JobTicket = JobDetails; - Winder_Active = true; +// Winder_Active = true; //float process_speed = JobTicket->processparameters->dyeingspeed; double ScrewSpeed = 1000;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); @@ -89,6 +89,7 @@ uint32_t Winder_Prepare(void) } else { + REPORT_MSG(ScrewSpeed, "Winder_Prepare"); Winder_ScrewHoming = true; //REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, "Winder_Prepare move to limit"); status = MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2); @@ -108,6 +109,7 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); + REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency, "Winder_PrepareStage2"); status |= MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_SCREW, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize),numOfSteps, Winder_ScrewAtOffsetCallback); //set motor location 0 here @@ -125,7 +127,7 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; DirectionChangeCounter = 0; - //REPORT_MSG(BusyFlag, "Winder_ScrewAtOffsetCallback"); + REPORT_MSG(BusyFlag, "Winder_ScrewAtOffsetCallback"); PrepareReady(Module_Winder, ModuleDone); return OK; @@ -188,6 +190,7 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); + REPORT_MSG(ScrewSpeed, "CalculateNumberOfSteps"); CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; } @@ -208,6 +211,7 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) uint32_t wtick=0,prevwtick = 0; uint32_t wgap[100]; uint32_t wgap_counter=0; +extern void ScrewReq(void); uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { uint32_t Steps; @@ -216,12 +220,14 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag) BusyfirstCall = false; return OK; } - if (Winder_Active == false) - return OK; +// if (Winder_Active == false) +// return OK; wtick++; //ScrewCurrentDirection: false moves out, true moves home if (BusyFlag == NOTBUSY) { + ScrewReq(); + if (wtick-prevwtick>10) { wgap[wgap_counter++] = wtick-prevwtick; @@ -254,6 +260,7 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag) } */ MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,Steps); //process: set point 0, set max speed, move to the specified length, return back. + REPORT_MSG(ScrewCurrentDirection, "ScrewDirectionChange"); } /* * calculate new ScrewSpeed and call MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); @@ -329,7 +336,7 @@ uint32_t Winder_End(void) int pend; //stop screw ScrewNumberOfSteps = 0; - Winder_Active = false; +// Winder_Active = false; if (ScrewControlId != 0xFF) RemoveControlCallback(ScrewControlId,ScrewDirectionChange); CurrentControlledSpeed[SCREW_MOTOR] = 0; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index c7d5998c6..77e1939f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -401,7 +401,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint); //JobAbortedByUser = true; ThreadControlActive = false; - JobEndReason = JOB_DANCER_FAIL; + JobEndReason = JOB_WINDER_DANCER_FAIL+index; SendJobProgress(0.0,0,false, Message); //EndState(CurrentJob,Message ); SegmentReady(Module_Thread,ModuleFail); |
