aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
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/Thread_Winder.c
parentc653fa2077b6118c2ace3b7bcc8bc91c9a9ed4f5 (diff)
parent3ed7e9cc55e10888d84aa53abcb5e765a317ddb1 (diff)
downloadTango-8a7e65715ef393a08cc39d1b5d4a3da22799c852.tar.gz
Tango-8a7e65715ef393a08cc39d1b5d4a3da22799c852.zip
merge conflicts
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c66
1 files changed, 10 insertions, 56 deletions
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;
}