aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index 3b17cd5dd..5390ed0a7 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -42,7 +42,7 @@ uint32_t CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM] = {0};
TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW};
HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {FEEDER_DANCER,NUM_OF_DANCERS,POOLER_DANCER,WINDER_DANCER,NUM_OF_DANCERS};
-uint32_t ControlIdtoMotorId [MAX_THREAD_MOTORS_NUM] = {0xFF};
+uint32_t ControlIdtoMotorId [MAX_THREAD_MOTORS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF};
uint32_t SpeedControlId=0xFF;
uint32_t PoolerSpeedControlId=0xFF;
@@ -582,8 +582,9 @@ uint32_t ThreadEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (PoolerSpeedControlId != 0xFF)
{
- RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction);
- PoolerSpeedControlId = 0xFF;
+ if (RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"Remove Control Failed");
+ PoolerSpeedControlId = 0xFF;
}
//SetMotHome(ThreadMotorIdToMotorId[Motor_i]);
PoolerLengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep);
@@ -593,7 +594,8 @@ uint32_t ThreadEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (ControlIdtoMotorId[Motor_i] != 0xFF)
{
- RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction);
+ if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"Remove Control Failed");
ControlIdtoMotorId[Motor_i] = 0xFF;
CurrentControlledSpeed[Motor_i] = 0;
}
@@ -604,7 +606,8 @@ uint32_t ThreadEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (ControlIdtoMotorId[Motor_i] != 0xFF)
{
- RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction);
+ if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"Remove Control Failed");
CurrentControlledSpeed[Motor_i] = 0;
ControlIdtoMotorId[Motor_i] = 0xFF;
}
@@ -614,7 +617,8 @@ uint32_t ThreadEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (ControlIdtoMotorId[Motor_i] != 0xFF)
{
- RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction);
+ if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"Remove Control Failed");
CurrentControlledSpeed[Motor_i] = 0;
ControlIdtoMotorId[Motor_i] = 0xFF;
}
@@ -706,16 +710,20 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
return OK;
}
+int REPSegmentId = 0;
void ThreadInterSegmentEnded(void)
{
+ LOG_ERROR (REPSegmentId,"ThreadInterSegmentEnded");
PreSegmentReady(Module_Thread,ModuleDone);
}
void ThreadSegmentEnded(void)
{
+ LOG_ERROR (REPSegmentId," ThreadSegmentState");
SegmentReady(Module_Thread,ModuleDone);
}
void ThreadDistanceToSpoolEnded(void)
{
+ LOG_ERROR (REPSegmentId," ThreadDistanceToSpoolEnded");
DistanceToSpoolReady(Module_Thread,ModuleDone);
}
double seglength = 0.0;
@@ -723,8 +731,10 @@ double seglength = 0.0;
uint32_t ThreadSegmentState(void *JobDetails, int SegmentId)
{
JobTicket* JobTicket = JobDetails;
+ REPSegmentId = SegmentId;
seglength = JobTicket->segments[SegmentId]->length;
CurrentSegmentId = SegmentId;
+ LOG_ERROR (seglength," ThreadSegmentState");
ThreadUpdateProcessLength (seglength,(void *)ThreadSegmentEnded);
return OK;
}
@@ -733,6 +743,7 @@ uint32_t ThreadSegmentState(void *JobDetails, int SegmentId)
uint32_t ThreadDistanceToSpoolState(void )
{
seglength = dryerbufferlength;
+ LOG_ERROR (seglength,"ThreadDistanceToSpoolState");
ThreadUpdateProcessLength (seglength,(void *)ThreadDistanceToSpoolEnded);
return OK;
}
@@ -753,20 +764,25 @@ char Endstr[150];
if (SpeedControlId != 0xFF)
{
- RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction);
+ if(RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"RemoveControl Failed");
SpeedControlId = 0xFF;
}
if (PoolerSpeedControlId != 0xFF)
{
- RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction);
+ if(RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK)
+ LOG_ERROR(Motor_i,"RemoveControl Failed");
PoolerSpeedControlId = 0xFF;
}
- for ( Motor_i = 0;Motor_i < MAX_THREAD_MOTORS_NUM;Motor_i++)
+ for ( Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++)
{
if (ControlIdtoMotorId[Motor_i] != 0xFF)
{
- RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction);
+ if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction) == OK)
+ ControlIdtoMotorId[Motor_i] == 0xFF;
+ else
+ LOG_ERROR (ControlIdtoMotorId[Motor_i],"Remove Control failed");
}
MotorStop(ThreadMotorIdToMotorId[Motor_i],Hard_Hiz);
}