aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-12-17 14:37:38 +0200
committerAvi Levkovich <avi@twine-s.com>2019-12-17 14:37:38 +0200
commit8a7e65715ef393a08cc39d1b5d4a3da22799c852 (patch)
treef71065b4c0000aafad1356ff2ab6b17f8287476b /Software/Embedded_SW/Embedded/Modules/Thread
parentc653fa2077b6118c2ace3b7bcc8bc91c9a9ed4f5 (diff)
parent3ed7e9cc55e10888d84aa53abcb5e765a317ddb1 (diff)
downloadTango-8a7e65715ef393a08cc39d1b5d4a3da22799c852.tar.gz
Tango-8a7e65715ef393a08cc39d1b5d4a3da22799c852.zip
merge conflicts
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c19
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c66
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c10
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c72
4 files changed, 60 insertions, 107 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index 856812c12..852c19a1a 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -67,6 +67,7 @@
uint8_t CallbackCounter = 0;
uint8_t TimeoutsCounter = 0;
+ uint32_t UnloadingStart = 0;
uint8_t NumberOfDrierLoaderCycles = 0;
uint32_t status = OK;
uint32_t LoadingControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF;
@@ -184,8 +185,6 @@
{
Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
//storeLoadArmParameters();
- MotorMove(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,LoadArmInfo.LoadArmBackLash );
-
SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
LoadStages++;
ThreadLoadStateMachine(LoadStages);
@@ -215,6 +214,8 @@
//move to exact location?
// Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
CallbackCounter = 0;
+ Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0);
+
Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
NumberOfDrierLoaderCycles=0;
//storeLoadArmParameters();
@@ -614,7 +615,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(19);
+ SetOriginMotorSpeed(30);
// OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000;
// CurrentControlledSpeed[FEEDER_MOTOR] = 1000;
@@ -670,14 +671,14 @@
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);
+ UnloadingStart = msec_millisecondCounter;
+ Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,UnloadingStart,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
LoadArmInfo.LoadArmBackLash = 5;
-
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/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000);
+ MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000);
//Keep Notation How Many Rotations In The Dryer
- LoadArmInfo.LoadArmBackLash = 5;
+ //LoadArmInfo.LoadArmBackLash = 0;
LoadArmInfo.LoadArmRounds = (int)dryerbufferlength;
load.color = BLINK;
return OK;
@@ -840,7 +841,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
CurrentControlledSpeed[index] = calculated_speed;
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed);
}
- if (index == POOLER_MOTOR)
+ /* if (index == POOLER_MOTOR)
{
if ((TranslatedReadValue)<(-1200))
{
@@ -868,7 +869,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
}
- }
+ }*/
/* LoadCounter++;
if ((LoadCounter % 5001) == 0)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 741fed7af..4db985954 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -62,7 +62,7 @@ static uint32_t WindingConeLocation;
static uint32_t WinderBackToBaseTime = 800;
InternalWinderConfigStruc InternalWinderCfg = {0};
-#define READ_SCREW_ENCODER
+//#define READ_SCREW_ENCODER
#ifdef READ_SCREW_ENCODER
uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0;
uint32_t ScrewLocationRun[3];
@@ -107,6 +107,8 @@ uint32_t InternalWindingConfigMessage(JobSpool* request)
InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//request->rotationsperpassage;
+ if (request->rotationsperpassage > 6.1)
+ InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage;
InternalWinderCfg.diameter = request->diameter;
usnprintf(ScrewStr, 150, "WindingConfig start,offset,head,tail {, %d, %d, %d, %d, %d}",InternalWinderCfg.startoffsetpulses,(int)InternalWinderCfg.segmentoffsetpulses,
(int)InternalWinderCfg.spoolbackingrate,(int)InternalWinderCfg.SpoolBottomBackingRate);
@@ -138,13 +140,13 @@ uint32_t Winder_Prepare(void *JobDetails)
* report ready to the job STM
*/
- /*if (FPGA_Read_limit_Switches(GPI_SW_SPOOL_EXISTS)==LIMIT)
+ if (FPGA_Read_limit_Switches(GPI_SW_SPOOL_EXISTS)==LIMIT)
{
REPORT_MSG(LIMIT, "No cone in winder");
- PrepareReady(Module_Winder,ModuleFail);
- AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true);
- return ERROR;
- }*/
+ // PrepareReady(Module_Winder,ModuleFail);
+ // AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true);
+ // return ERROR;
+ }
#ifdef READ_SCREW_ENCODER
ScrewLocationRun[0] = 0;
@@ -279,7 +281,6 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__
double WinderReferenceSpeed=0;
double TotalWinderSpeed=0;
bool Add100 = false;
-double Rotations = 6.0;
int flipflop = 0;
uint32_t motspeed;
float speedf;
@@ -288,14 +289,8 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
//uint32_t Steps;
double temp,tempScrewSpeed;
- double screw_horizontal_speed = 0;
- double RotationsPerSecond;
- //double Averagewinderspeed = 0;
-
-// {
-// TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter];
-// WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR];
-// TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter];
+ //double screw_horizontal_speed = 0;
+ //double RotationsPerSecond;
if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION)
{
if (WinderMotorSpeedRollOver == false)
@@ -305,17 +300,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
}
// WinderMotorSpeedCounter=0;
}
-// }
- /*if (flipflop == 0)
- {
- MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW);
- }
- else if (flipflop == 1)
- {
- speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW);
- }
- flipflop ++;
- */
if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter)
return OK;
//deley TODO
@@ -353,16 +337,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
Report("Winder difference",__FILE__,CalculationDirectionChangeCounter,ScrewLocationPrev[0],RpWarning,ScrewLocationRun[0], 0);
}
ScrewLocationPrev[0] = ScrewLocationRun[0];
- //else
- // Report("winder run error value" ,__FILE__,WinderRun,ScrewLocationRun[0],RpWarning,ScrewLocationRun[1], 0);
-
- //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0);
- //REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps");
- //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10);
- //usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter,
- // abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf);
- //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]);
- //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0);
#endif
if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out
{
@@ -388,24 +362,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
// Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0);
}
}
- /* if (WinderMotorSpeedRollOver)
- {
- if (WinderCalculation%60000 == 0)//100 minutes
- {
- Averagewinderspeed = TotalWinderSpeed/MAX_WINDER_SPEED_CALCULATION;
- //Report("WinderSpeedUpdated",__FILE__,__LINE__,(int)TotalWinderSpeed,RpWarning,(int)Averagewinderspeed,0);
- WinderReferenceSpeed = Averagewinderspeed;
- }
- WinderCalculation++;
- }*/
- //WinderReferenceSpeed = 1000;
- //ScrewNumberOfSteps = 1000;
- screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage;
- // if (Rotations > 6.6)//7.0)
- // Rotations = 6.0;
- RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround;
- tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond;
- //ROM_IntMasterDisable();
tempScrewSpeed = ScrewSpeed;
CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed;
@@ -468,7 +424,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId)
InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples
InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw
JobSegment* Segment = SegmentDetails;
- InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw
ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/3);
ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
@@ -481,7 +436,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId)
InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples
InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw
JobSegment* Segment = SegmentDetails;
- InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw
ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/20);
ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index 226bb2559..0df950f34 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -154,12 +154,12 @@ char DancerConfigPath[50] = "0://SysInfo//DancCfg.cfg";
uint32_t StoreDancerConfigMessage()
{
uint32_t status = OK;
- /* FRESULT Fresult = FR_OK;
- // HardwareConfiguration DancerConfig;
- // HardwareDancer Dancers[MAX_SYSTEM_DANCERS];
+ // FRESULT Fresult = FR_OK;
+ HardwareConfiguration DancerConfig;
+ HardwareDancer Dancers[MAX_SYSTEM_DANCERS];
// uint8_t* response_buffer;
// size_t response_size = 0;
- // int Dancer_i;
+ int Dancer_i;
hardware_configuration__init(&DancerConfig);
DancerConfig.dancers = (HardwareDancer**)my_malloc(sizeof(HardwareDancer*)*MAX_SYSTEM_DANCERS);
@@ -174,7 +174,7 @@ uint32_t StoreDancerConfigMessage()
DancerConfig.n_dancers++;
DancersCfg[Dancer_i].zeropoint = DancerConfig.dancers[Dancer_i]->zeropoint;
}
- */
+
status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_0,DancersCfg[0].zeropoint);
status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_1,DancersCfg[1].zeropoint);
status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_2,DancersCfg[2].zeropoint);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index 9d408a4a6..34934af0c 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -118,7 +118,7 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea
if (Current_Read < Previous_Read)
{
Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1;
- Report("Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0);
+ ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0);
}
else
Time_Pass = Current_Read - Previous_Read;
@@ -192,7 +192,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
usnprintf(Lenstr, 100, "length huge: length %d, diff 0x%x, pos 0x%x prev 0x%x",(int)length*100,(int)positionDiff,PreviousPosition,prevprev);
SendJobProgress(0.0,0,false, Lenstr);
- Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
+ ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
length = 0;
}
@@ -224,7 +224,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
usnprintf(Lenstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength);
SendJobProgress(0.0,0,false, Lenstr);
- Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
+ ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
// segment/intersegment/distance to spool finished
if (ProcessedLengthFuncPtr)
ProcessedLengthFuncPtr();
@@ -282,7 +282,7 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
usnprintf(Lenstr, 100, "length huge: length %d, diff 0x%x, pos 0x%x prev 0x%x",(int)length*100,(int)positionDiff,PreviousPosition,prevprev);
SendJobProgress(0.0,0,false, Lenstr);
- Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
+ ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
length = 0;
}
@@ -300,9 +300,12 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (PrepareState == true)
{
+#ifdef Use_Head_Card
+ strcpy(Lenstr,"Heating up");
+#else
//later - add temperatures
TemperatureListString(Lenstr);
-
+#endif
SendJobProgress(0.0,0,false, Lenstr);
}
else
@@ -315,7 +318,7 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
usnprintf(Lenstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength);
SendJobProgress(0.0,0,false, Lenstr);
- Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
+ ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
// segment/intersegment/distance to spool finished
if (ProcessedLengthFuncPtr)
ProcessedLengthFuncPtr();
@@ -421,7 +424,7 @@ void testDancersControl()
len = usnprintf(time, 150, "params: speed 50, divider %d p %d * %d i %d * %d Dt*1000 %d Norm Coef %d initial speed %d",NORMAL_COEF_DIVIDER,(int)MotorsControl[FEEDER_MOTOR].proportionalgain,(int)MotorsControl[FEEDER_MOTOR].outputonoffhysteresisvalue,
(int)MotorsControl[FEEDER_MOTOR].integraltime,(int)MotorsControl[FEEDER_MOTOR].setpointramprateorsoftstartramp,(int)(MotorsControl[FEEDER_MOTOR].controloutputtype*1000),
(int)(NormalizedErrorCoEfficient[FEEDER_MOTOR]*1000000000),OriginalMotorSpd_2PPS[FEEDER_MOTOR]);
- Report(time,__FILE__,__LINE__,111,RpError,111,0);
+ ReportWithPackageFilter(ThreadFilter,time,__FILE__,__LINE__,111,RpError,111,0);
Task_sleep(100);
ThreadControlCBFunction(IfTypeThread*0x100+FEEDER_MOTOR, DancersCfg[HARDWARE_DANCER_TYPE__RightDancer].zeropoint - mm20);
ThreadControlCBFunction(IfTypeThread*0x100+FEEDER_MOTOR, DancersCfg[HARDWARE_DANCER_TYPE__RightDancer].zeropoint - mm10);
@@ -478,7 +481,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
if (ReadValue < 10)
{
MotorFailedSample[index]++;
- Report("Dancer value read too small.",__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
+ ReportWithPackageFilter(ThreadFilter,"Dancer value read too small.",__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
return OK;
}
if (ReadValue == 0x3FFF)
@@ -533,7 +536,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
SendSegmentFail();
//AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true);
//EndState(CurrentJob,"ReadBreakSensor Error" );
- LOG_ERROR(index, "ReadBreakSensor Error");
+ ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0);
return OK;
} //passed limit
}//ReadBreakSensor()==ERROR
@@ -541,7 +544,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
if (BreakSensorCounter)
{
- LOG_ERROR(BreakSensorCounter, "ReadBreakSensor Spike");
+ ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Spike",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0);
}
BreakSensorCounter = 0;
}
@@ -559,7 +562,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
SendSegmentFail();
//AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true);
//EndState(CurrentJob,"ReadBreakSensor Error" );
- LOG_ERROR(index, "thread speed too low Error");
+ ReportWithPackageFilter(ThreadFilter,"thread speed too low Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0);
return OK;
}
}
@@ -573,7 +576,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
keepdata = false;
usnprintf(TMessage, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint);
- Report(TMessage,__FILE__,__LINE__,avreageSampleValue,RpWarning,DancerStopActivityLimit[index],0);
+ ReportWithPackageFilter(ThreadFilter,TMessage,__FILE__,__LINE__,avreageSampleValue,RpWarning,DancerStopActivityLimit[index],0);
//JobAbortedByUser = true;
ThreadControlActive = false;
//MotorGetStatusFromFPGA(ThreadMotorIdToMotorId[index]);
@@ -593,7 +596,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER,true);
break;
}*/
- LOG_ERROR (DancerId, "Dancer Failure");
+ ReportWithPackageFilter(ThreadFilter,"Dancer Failure",__FILE__,DancerId,(int)avreageSampleValue,RpError,(int)JobCounter,0);
return OK;
}
NormalizedError = avreageSampleValue*NormalizedErrorCoEfficient[index];
@@ -613,7 +616,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
//if (index == WINDER_MOTOR) //feeder unit handles errors opposite to left unit
//{
- // Report("MotorSpeedUpdated",__FILE__,index,OriginalMotorSpd_2PPS[index],RpWarning,CurrentControlledSpeed[index],0);
+ // ReportWithPackageFilter(ThreadFilter,"MotorSpeedUpdated",__FILE__,index,OriginalMotorSpd_2PPS[index],RpWarning,CurrentControlledSpeed[index],0);
//}
/`*if (JobCounter >= 3000)
{
@@ -624,7 +627,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
for (i=0;i<MAX_CONTROL_SAMPLES;i++)
avreageMotorSampleValue += MotorSpeedSamples[index][i];
avreageMotorSampleValue = avreageMotorSampleValue / MAX_CONTROL_SAMPLES;
- //Report("MotorSpeedUpdated",__FILE__,index,OriginalMotorSpd_2PPS[index],RpWarning,avreageMotorSampleValue,0);
+ //ReportWithPackageFilter(ThreadFilter,"MotorSpeedUpdated",__FILE__,index,OriginalMotorSpd_2PPS[index],RpWarning,avreageMotorSampleValue,0);
OriginalMotorSpd_2PPS[index] = avreageMotorSampleValue;
}*`/
}*/
@@ -640,7 +643,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed);
/*if (((JobCounter % 2000) == index*100)&&(index == WINDER_MOTOR)) //feeder unit handles errors opposite to left unit
{
- Report("MotorSpeedUpdated",__FILE__,index,(int)OriginalMotorSpd_2PPS[index],RpWarning,(int)CurrentControlledSpeed[index],0);
+ ReportWithPackageFilter(ThreadFilter,"MotorSpeedUpdated",__FILE__,index,(int)OriginalMotorSpd_2PPS[index],RpWarning,(int)CurrentControlledSpeed[index],0);
}*/
#ifdef TEST_PID_THREAD
int len;
@@ -659,7 +662,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
ReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000),
(int)(MotorControlConfig[index].m_integral*1000000000),(int)((MotorControlConfig[index].m_mesuredParam*MotorControlConfig[index].m_params.dt)*1000000000),
(int)(MotorControlConfig[index].m_calculatedError*1000),(int)calculated_speed);
- Report(TMessage,__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
+ ReportWithPackageFilter(ThreadFilter,TMessage,__FILE__,__LINE__,DancerId,RpError,ReadValue,0);
//Task_sleep(100);
//if (controlIndex++>=MAX_THREAD_CONTROL_LOG)
// controlIndex = 0;
@@ -725,6 +728,8 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request)
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER,false);
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER,false);
AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,false);
+ AlarmHandlingSetAlarm(EVENT_TYPE__FPGA_WATCHDOG_ACTIVATED,false);
+
EnableLubrication = JobTicket->enablelubrication;
EnableIntersegment = JobTicket->enableintersegment;
@@ -735,16 +740,16 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request)
if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) != LIMIT)
{
ReportWithPackageFilter(ThreadFilter,"Dyeing head is open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpFatalError,LIMIT,0);
- JobEndReason = JOB_LIDS_OPEN;
- PrepareReady(Module_Thread,ModuleFail);
- return ERROR;
+ //JobEndReason = JOB_LIDS_OPEN;
+ //PrepareReady(Module_Thread,ModuleFail);
+ //return ERROR;
}
if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID]) != LIMIT)
{
ReportWithPackageFilter(ThreadFilter,"Dryer lid is open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID,RpFatalError,LIMIT,0);
- JobEndReason = JOB_LIDS_OPEN;
- PrepareReady(Module_Thread,ModuleFail);
- return ERROR;
+ //JobEndReason = JOB_LIDS_OPEN;
+ //PrepareReady(Module_Thread,ModuleFail);
+ //return ERROR;
}
//start thread control for all motors
@@ -774,7 +779,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request)
if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled
{
- Report("Feeder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
+ ReportWithPackageFilter(ThreadFilter,"Feeder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
if (SpeedControlId != 0xFF)
{
RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction);
@@ -786,7 +791,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request)
}
if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled
{
- Report("Puller Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
+ ReportWithPackageFilter(ThreadFilter,"Puller Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
if (PoolerSpeedControlId != 0xFF)
{
if (RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK)
@@ -826,7 +831,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request)
}
if (Motor_i == WINDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled
{
- Report("Winder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
+ ReportWithPackageFilter(ThreadFilter,"Winder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);
if (ControlIdtoMotorId[Motor_i] != 0xFF)
{
if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK)
@@ -869,7 +874,7 @@ void SetOriginMotorSpeed(float process_speed)
OriginalMotorSpd_2PPS[Motor_i] = (int) motor_speed;
InitialDryerSpeed = 0.0;
CurrentControlledSpeed[Motor_i] = (int) motor_speed;
- //Report("Original Speed",__FILE__,Motor_i,motor_speed,RpWarning,process_speed,0);
+ //ReportWithPackageFilter(ThreadFilter,"Original Speed",__FILE__,Motor_i,motor_speed,RpWarning,process_speed,0);
for (i = 0; i <= MAX_CONTROL_SAMPLES; i++)
MotorSpeedSamples[Motor_i][i] = motor_speed;
@@ -881,8 +886,6 @@ void ThreadPreSegmentEnded(void)
REPORT_MSG (0,"First ThreadPreSegmentEnded");
PreSegmentReady(Module_Thread,ModuleDone);
}
-#define DRYER_RAMPUP 1
-#ifdef DRYER_RAMPUP
int DrierDivider = 10;
uint32_t ThreadDryerRampUp(uint32_t IfIndex, uint32_t BusyFlag)
{
@@ -895,12 +898,11 @@ uint32_t ThreadDryerRampUp(uint32_t IfIndex, uint32_t BusyFlag)
}
MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,InitialDryerSpeed );
- Report("ThreadDryerRampUp",__FILE__,ControlIdtoMotorId[DRYER_MOTOR],(int)InitialDryerSpeed,RpWarning,(int)OriginalMotorSpd_2PPS[DRYER_MOTOR],0);
+ //ReportWithPackageFilter(ThreadFilter,"ThreadDryerRampUp",__FILE__,ControlIdtoMotorId[DRYER_MOTOR],(int)InitialDryerSpeed,RpWarning,(int)OriginalMotorSpd_2PPS[DRYER_MOTOR],0);
return OK;
}
-#endif
//********************************************************************************************************************
uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId)
@@ -922,16 +924,12 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId)
PrepareState = false;
#ifndef TEST_PID_THREAD
// set the new speed in the dryer motor to the speed of the new segment
-#ifndef DRYER_RAMPUP
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]);
-#else
DrierDivider = dyeingspeed/5; //ramp up drier in 5 cm/sec steps
- Report("Drier ramp up",__FILE__,__LINE__,(int)dyeingspeed,RpWarning,(int)DrierDivider,0);
+ ReportWithPackageFilter(ThreadFilter,"Drier ramp up",__FILE__,__LINE__,(int)dyeingspeed,RpWarning,(int)DrierDivider,0);
InitialDryerSpeed = OriginalMotorSpd_2PPS[DRYER_MOTOR]/DrierDivider;
MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,InitialDryerSpeed );
ControlIdtoMotorId[DRYER_MOTOR] = AddControlCallback("DryerRampUp",ThreadDryerRampUp, 200,TemplateDataReadCBFunction,0,0,0);
#endif
-#endif
#ifdef HUNDRED_MICROSECONDS_DANCER_READ
MillisecLogInit();
#endif
@@ -1051,7 +1049,7 @@ char Endstr[150];
usnprintf(Endstr, 100, "Total _processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength);
SendJobProgress(0.0,0,false, Endstr);
- Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
+ ReportWithPackageFilter(ThreadFilter,Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
ThreadUpdateProcessLength (0.0,(void *)NULL);
//TotalProcessedLength = 0.0;