diff options
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
3 files changed, 37 insertions, 26 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index a82fe37e6..ff319918e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -38,21 +38,21 @@ /* typedef enum { 0 THREAD_LOAD_INIT, - 1 THREAD_LOAD_REDUCE_HEAT, //HEATERS OFF, DRYER BLOWER OFF, BLOWER LOW, - 2 THREAD_LOAD_SET_LOAD_ARM_TO_START_POSITION,//USE NOTATION HOW MANY ROTATIONS IN THE DRYER, OR CHECK AGAINST STOPPER. MOVE SLOWLY - 3 THREAD_LOAD_CENTER_HEAD_ROCKERS, //puthead cleaning rockers to middle position - 4 THREAD_LOAD_OPEN_COVERS, //OPEN DYEING HEAD COVER AND DRYER LID + 1 THREAD_LOAD_REDUCE_HEAT, //HEATERS OFF, DRYER BLOWER OFF, BLOWER LOW, + 2 THREAD_LOAD_SET_LOAD_ARM_TO_START_POSITION, //USE NOTATION HOW MANY ROTATIONS IN THE DRYER, OR CHECK AGAINST STOPPER. MOVE SLOWLY + 3 THREAD_LOAD_CENTER_HEAD_ROCKERS, //puthead cleaning rockers to middle position + 4 THREAD_LOAD_OPEN_COVERS, //OPEN DYEING HEAD COVER AND DRYER LID 5 THREAD_LOAD_LIFT_DANCERS, - 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE - 7 THREAD_LOAD_INITIAL_TENSION,//CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND + 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE + 7 THREAD_LOAD_INITIAL_TENSION, //CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND 8 THREAD_LOAD_CLOSE_ROCKERS, - 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD + 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD 10 THREAD_LOAD_CLOSE_LIDS, 11 THREAD_LOAD_RESUME_HEATING, - 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION - 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 - //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER - 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING + 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 + //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING 15 THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM;*/ THREAD_LOAD_STAGES_ENUM LoadStages = THREAD_LOAD_INIT; @@ -222,9 +222,9 @@ else { LoadStages++; - if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call + if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call { - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } } } @@ -340,7 +340,7 @@ { Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100% LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } return OK; } @@ -371,7 +371,7 @@ LoadStages++; if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call { - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } } } @@ -417,7 +417,7 @@ //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; - //LoadArmInfo.LoadArmRounds = 0xFF; + LoadArmInfo.LoadArmRounds = 0xFF; FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); return OK; } @@ -428,7 +428,7 @@ ControlId = 0xFF; ThreadAbortJoggingFunc(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Jog_Thread(void) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index c598e0c55..0277d1daa 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -40,6 +40,8 @@ void ScrewsStartControlTimer (void); bool Winder_ScrewHoming = false; bool ScrewCurrentDirection = false; //holds current screw direction uint32_t ScrewDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone +uint32_t ScrewChangeCounter = 0; +uint32_t ScrewChangeLimit = 0; uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone uint16_t WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; @@ -196,13 +198,17 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) double RotationsPerSecond; int32_t Averagewinderspeed = 0; - TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; - WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; - TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; - if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) + ScrewChangeCounter++; + if ((ScrewChangeCounter>3)&&(ScrewChangeCounter<(ScrewChangeLimit-2))) //do not take the winder speed near the limits { - WinderMotorSpeedCounter=0; - WinderMotorSpeedRollOver=true; + TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; + WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; + TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; + if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) + { + WinderMotorSpeedCounter=0; + WinderMotorSpeedRollOver=true; + } } if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) @@ -260,7 +266,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__,__LINE__,temp,RpWarning,ScrewSpeed,0); + Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } /********************************************************************************/ @@ -397,6 +403,7 @@ void ScrewsStartControlTimer (void) //ROM_TimerConfigure(Screw_timerBase, TIMER_CFG_PERIODIC); // 32 bits Timer TimerEnable(Screw_timerBase, TIMER_A); ROM_IntEnable(INT_TIMER3A); + //IntPrioritySet(Screw_timerBase, 0x40); ROM_TimerIntEnable(Screw_timerBase, TIMER_TIMA_TIMEOUT); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)1200000/*10 millisec*/ ); Report("ScrewsStartControlTimer direction,speed ", __FILE__,__LINE__,ScrewCurrentDirection, RpMessage, ScrewSpeed, 0); @@ -410,9 +417,11 @@ void ScrewTimerInterrupt(int ARG0) if (SCREW_TimerActivated == true) { + ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); - ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); + ScrewChangeCounter = 0; + ScrewChangeLimit = ScrewRunningTime/12000000; ScrewDirectionChangeCounter++; } else diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 6a8474438..f4dc6a170 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -30,6 +30,7 @@ #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "modules/heaters/heaters.h" #include "modules/General/process.h" +#include "modules/ids/ids_ex.h" #include "Modules/AlarmHandling/AlarmHandling.h" #include "Control/MillisecTask.h" @@ -708,6 +709,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails, uint32_t SegmentId) MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize); MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); } + IDS_StartLubrication(); } // activate control fr all motors //set speed for both rocker motors @@ -807,7 +809,7 @@ char Endstr[150]; } MotorStop(HARDWARE_MOTOR_TYPE__MOTO_RLOADING,Hard_Hiz); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_LLOADING,Hard_Hiz); - + IDS_StopLubrication(); return OK; } |
