aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-07-28 13:24:28 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-07-28 13:24:28 +0300
commit230ea9b597a2932f5d16572d94ee14c862d5b419 (patch)
tree7e260db879dd815f5350e11a4a85ca04514237b7 /Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
parent16cc209e80498a0b39c1ad57d4f36be906cbb313 (diff)
parent30759321e22e22363eda9387e178b4d48b7d9088 (diff)
downloadTango-230ea9b597a2932f5d16572d94ee14c862d5b419.tar.gz
Tango-230ea9b597a2932f5d16572d94ee14c862d5b419.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c194
1 files changed, 133 insertions, 61 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index 9ef7f3d0d..366f4b163 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -45,21 +45,27 @@
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
- 8 THREAD_LOAD_CLOSE_ROCKERS,
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
+ 12 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
+ 8 THREAD_LOAD_CLOSE_ROCKERS,
+ 11 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION
+ 13 THREAD_LOAD_RESUME_HEATING,
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;
ProcessParameters ProcessParametersClear,ProcessParametersRecover;
+
+ int32_t keepmicrostep;
+ int32_t keepkvalrun;
+ uint8_t CallbackCounter = 0;
+ uint8_t TimeoutsCounter = 0;
+
uint8_t NumberOfDrierLoaderCycles = 0;
uint32_t status = OK;
- uint32_t ControlId = 0xFF;
+ uint32_t ControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF;
uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM LoadStages);
uint32_t ThreadLoadControlCBFunction(uint32_t index, uint32_t ReadValue);
uint32_t Thread_Load_Dryer_UnLoading(void);
@@ -146,7 +152,7 @@
Control_Voltage_To_Blower(BlowerCfg.voltage-500);
Control_Dryer_Fan(STOP,75);//use START or STOP, 0 - 100%
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
return OK;
}
@@ -163,24 +169,44 @@
}
else*/
{
- Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
+ Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
//storeLoadArmParameters();
SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
return OK;
}
uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
{
+
+ if(PullerControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction );
+ PullerControlId = 0xFF;
+ }
+ if(WinderControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction );
+ WinderControlId = 0xFF;
+ }
+ /*Task_sleep(5)
+ MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
+ MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);*/
+
+ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz);
+
// Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
- Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
+ CallbackCounter = 0;
+ Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
NumberOfDrierLoaderCycles=0;
//storeLoadArmParameters();
LoadStages++;
SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
return OK;
}
uint32_t Thread_Load_Set_Load_Arm_To_Start_Position(void)
@@ -206,13 +232,11 @@
//Use Notation How Many Rotations In The Drier, Or Check Against Stopper. Move Slowly
return OK;
}
- uint8_t CallbackCounter = 0;
- uint8_t TimeoutsCounter = 0;
uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue)
{
- Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
- REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id");
+ Report("Thread_Load_HomingCallback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
+// REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id");
if (CallbackCounter)
{
CallbackCounter--;
@@ -231,16 +255,16 @@
else
{
LoadStages++;
- if (LoadStages == THREAD_LOAD_LIFT_ROCKERS)
+ if (LoadStages == THREAD_LOAD_CLOSE_ROCKERS)
{
- MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep);
- MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep);
- MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep);
- MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep);
+ MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepmicrostep);
+ MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepmicrostep);
+ MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepkvalrun);
+ MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepkvalrun);
}
if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call
{
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
}
}
@@ -285,16 +309,18 @@
uint32_t Thread_Load_Lift_Rockers(void)
//Machine Is Ready. Send Message, Start Timer To Close Lids, Wait For Operator Response
{
+ keepmicrostep = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep;
+ keepkvalrun = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].kvalrun;
REPORT_MSG(LoadStages, "Thread Load State Machine step");
- MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1);
- MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1);
- MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 35);
- MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 35);
+ MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 2);
+ MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 2);
+ MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 70);
+ MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 70);
Task_sleep(10);
CallbackCounter++;
- MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,25000);
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000);
CallbackCounter++;
- MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,25000);
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000);
return OK;
}
@@ -316,9 +342,9 @@
{
REPORT_MSG(LoadStages, "Thread Load State Machine step");
CallbackCounter++;
- MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,12000);
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000);
CallbackCounter++;
- MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,12000);
+ MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000);
return OK;
}
@@ -361,7 +387,7 @@
{
Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100%
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
return OK;
}
@@ -370,21 +396,13 @@
{
REPORT_MSG(LoadStages, "Thread Load State Machine step");
CallbackCounter++;
- MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 200, FEEDER_DANCER ,true, Thread_Load_HomingCallback,10000);
+ MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 100, FEEDER_DANCER ,true, Thread_Load_HomingCallback,2000);
return OK;
}
- uint32_t Thread_Load_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue)
+ uint32_t Thread_Load_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint32_t ReadValue)
{
- Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
- REPORT_MSG(MotorId, "Thread_Load_Dryer_Loading_Callback Motor Id");
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,0,0);
- if(ControlId != 0xFF)
- {
- MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
- RemoveControlCallback(ControlId, ThreadLoadControlCBFunction );
- ControlId = 0xFF;
- }
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
if (CallbackCounter)
{
CallbackCounter--;
@@ -393,12 +411,25 @@
LoadStages++;
if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call
{
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
}
}
}
else
LOG_ERROR(MotorId, "Thread_Load_HomingCallback Callback is already 0");
+
+ }
+ uint32_t Thread_Load_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue)
+ {
+ Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
+ if(ControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(ControlId, ThreadLoadControlCBFunction );
+ ControlId = 0xFF;
+ }
+ //REPORT_MSG(MotorId, "Thread_Load_Dryer_Loading_Callback Motor Id");
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,10000);
return OK;
}
@@ -413,6 +444,7 @@
// CurrentControlledSpeed[FEEDER_MOTOR] = 1000;
numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+ Report("Thread Load State Machine step.",__FILE__,LoadStages,numberOfSteps,RpMessage,(int)(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius),0);
MotorControlConfig[FEEDER_MOTOR].m_params.MAX = 1;
MotorControlConfig[FEEDER_MOTOR].m_params.MIN = MotorsControl[FEEDER_MOTOR].outputproportionalpowerlimit*-1;
MotorControlConfig[FEEDER_MOTOR].m_params.Kd = MotorsControl[FEEDER_MOTOR].derivativetime;
@@ -432,7 +464,10 @@
MotorControlConfig[FEEDER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage
MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize);
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4);
+
ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+FEEDER_MOTOR),FEEDER_DANCER,FEEDER_MOTOR);
+ Report("AddControlCallback feeder",__FILE__,__LINE__,ControlId,RpMessage,IfTypeThread*0x100+FEEDER_MOTOR,0);
CallbackCounter++;
MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000);
@@ -440,7 +475,7 @@
//Keep Notation How Many Rotations In The Dryer
//LoadArmInfo.LoadArmBackLash = 0;
LoadArmInfo.LoadArmRounds = 0xFF;
- FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath);
+ FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER);
return OK;
}
uint32_t Thread_Load_Jog_ThreadStop(uint32_t index, uint32_t ReadValue)
@@ -450,7 +485,7 @@
ControlId = 0xFF;
ThreadAbortJoggingFunc();
LoadStages++;
- //ThreadLoadStateMachine(LoadStages);
+ ThreadLoadStateMachine(LoadStages);
return OK;
}
uint32_t Thread_Load_Jog_Thread(void)
@@ -464,6 +499,24 @@
uint32_t Thread_Load_End(void)
{
REPORT_MSG(LoadStages,"Loading Ended");
+ if(ControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(ControlId, ThreadLoadControlCBFunction );
+ ControlId = 0xFF;
+ }
+ if(PullerControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction );
+ PullerControlId = 0xFF;
+ }
+ if(WinderControlId != 0xFF)
+ {
+ MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz);
+ RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction );
+ WinderControlId = 0xFF;
+ }
return OK;
}
uint32_t Thread_Load_Dryer_UnLoading(void)
@@ -472,7 +525,7 @@
LoadArmInfo.LoadArmRounds = 0;
uint32_t numberOfSteps = 0;
//Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40
- SetOriginMotorSpeed(20);
+ SetOriginMotorSpeed(19);
// OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000;
// CurrentControlledSpeed[FEEDER_MOTOR] = 1000;
@@ -496,7 +549,8 @@
MotorControlConfig[POOLER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage
MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize);
- ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),FEEDER_DANCER,POOLER_MOTOR);
+ PullerControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),POOLER_DANCER,POOLER_MOTOR);
+ Report("AddControlCallback Puller",__FILE__,__LINE__,PullerControlId,RpMessage,IfTypeThread*0x100+POOLER_MOTOR,0);
////////////////////////
MotorControlConfig[WINDER_MOTOR].m_params.MAX = 1;
MotorControlConfig[WINDER_MOTOR].m_params.MIN = MotorsControl[WINDER_MOTOR].outputproportionalpowerlimit*-1;
@@ -515,23 +569,28 @@
MotorControlConfig[WINDER_MOTOR].m_mesuredParam = 0;
MotorControlConfig[WINDER_MOTOR].m_preError = 0;
MotorControlConfig[WINDER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage
- MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize);
+ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_WINDER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].directionthreadwize);
- ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),FEEDER_DANCER,WINDER_MOTOR);
+ WinderControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),WINDER_DANCER,WINDER_MOTOR);
+ Report("AddControlCallback Winder",__FILE__,__LINE__,WinderControlId,RpMessage,IfTypeThread*0x100+WINDER_MOTOR,0);
////////////////////////
+ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].directionthreadwize);
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]);
CallbackCounter++;
//MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
// numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000);
Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
+ LoadArmInfo.LoadArmBackLash = 10;
+
status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize),
- MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000);
+ MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000);
//Keep Notation How Many Rotations In The Dryer
//LoadArmInfo.LoadArmBackLash = 0;
LoadArmInfo.LoadArmRounds = 0xFF;
- FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath);
+ FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER);
return OK;
}
@@ -585,10 +644,6 @@
//LoadStages++;
Thread_Load_Close_Lids();
break;
- case THREAD_LOAD_RESUME_HEATING:
- //LoadStages++;
- Thread_Load_Resume_Heating();
- break;
case THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT://JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION
//LoadStages++;
Thread_Load_Jog_Feeder_To_Middle_Point();
@@ -598,11 +653,16 @@
//LoadStages++;
Thread_Load_Dryer_Loading();
break;
+ case THREAD_LOAD_RESUME_HEATING:
+ //LoadStages++;
+ Thread_Load_Resume_Heating();
+ break;
case THREAD_LOAD_JOG_THREAD: //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING
//LoadStages++;
Thread_Load_Jog_Thread();
break;
case THREAD_LOAD_END:
+ LoadStages = THREAD_LOAD_END;
Thread_Load_End();
break;
default:
@@ -611,7 +671,18 @@
}
return OK;
}
-
+uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
+{
+ Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0);
+ if (LoadStages > ReadValue)
+ {
+ ThreadLoadStateMachine(LoadStages+1);
+ }
+ else
+ {
+ ThreadLoadStateMachine(ReadValue);
+ }
+}
uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
//read value is the dancer angle
@@ -623,7 +694,14 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
uint32_t calculated_speed;
double NormalizedError;
- DancerId = FEEDER_DANCER;//ThreadMotorIdToDancerId[index];
+ if (IfIndex>>8 != IfTypeThread)
+ {
+ LOG_ERROR (IfIndex, "Wrong Interface type");
+ return 0xFFFFFFFF;
+ }
+ index = IfIndex&0xFF;
+
+ DancerId = ThreadMotorIdToDancerId[index];
if (ReadValue < 10)
{
Report("Dancer value read too small.",__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
@@ -634,12 +712,6 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
return OK;
}
TranslatedReadValue = ReadValue - DancersCfg[DancerId].zeropoint;
- if (IfIndex>>8 != IfTypeThread)
- {
- LOG_ERROR (IfIndex, "Wrong Interface type");
- return 0xFFFFFFFF;
- }
- index = IfIndex&0xFF;
if (index == POOLER_MOTOR)
{
//pooler dancer is right sided: data is opposite