aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-08-15 16:07:19 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-08-15 16:07:19 +0300
commit22f532c29fdcb2c8610dfd38ab461392f1d43648 (patch)
tree37820a03df306e59c09dc64c67ef6a03d6ff22f4 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parent723e2b8854db8c409268f31ab76f5252211ec494 (diff)
downloadTango-22f532c29fdcb2c8610dfd38ab461392f1d43648.tar.gz
Tango-22f532c29fdcb2c8610dfd38ab461392f1d43648.zip
fixes in waste/ink
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 0ac23baf5..0ed0f5318 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -90,6 +90,8 @@ uint32_t InternalWinderConfigMessage(HardwareWinder* request)
return status;
}
+char ScrewStr[150];
+
uint32_t InternalWindingConfigMessage(JobSpool* request)
{
uint32_t status = PASSED;
@@ -100,6 +102,9 @@ uint32_t InternalWindingConfigMessage(JobSpool* request)
InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//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);
+ Report(ScrewStr,__FILE__,__LINE__,(int)InternalWinderCfg.diameter,RpWarning,(int)(InternalWinderCfg.NumberOfRotationPerPassage*1000), 0);
return status;
}
@@ -257,7 +262,7 @@ InternalWinderCfg.segmentoffsetpulses
numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
*/
-char ScrewStr[150];
+
//char TempScrewStr[100];
double WinderReferenceSpeed=0;
double TotalWinderSpeed=0;
@@ -267,6 +272,8 @@ int flipflop = 0;
uint32_t motspeed;
float speedf;
int WinderCalculation = 0;
+float WinderRunAverage = 0.0,WinderRunSum = 0.0;
+int WinderRunSamples = 0;
uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
//uint32_t Steps;
@@ -274,6 +281,8 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
double screw_horizontal_speed = 0;
double RotationsPerSecond;
double Averagewinderspeed = 0;
+ int WinderRun;
+
// {
// TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter];
@@ -312,14 +321,15 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
//double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed;
#ifdef READ_SCREW_ENCODER
WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]);
- if (WinderRun < 50000)
+ if ((WinderRun < 50000)&&(Add100 == false))
{
WinderRunSum+=WinderRun;
WinderRunSamples++;
WinderRunAverage = WinderRunSum/WinderRunSamples;
- if ((fabs(WinderRun-WinderRunAverage)>=50)||(WinderRunSamples%50 == 0))
+ if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0))
{
- usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d }",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples);
+ usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples,
+ (int)(100*WinderRun/ScrewNumberOfSteps));
Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0);
}
}
@@ -343,7 +353,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
ScrewNumberOfSteps--;
WindingConeLocation--;
- // ReportWithPackageFilter(ThreadFilter,"Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0);
+ ReportWithPackageFilter(ThreadFilter,"Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0);
}
}
else //next time going back
@@ -351,7 +361,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0)
{
ScrewNumberOfSteps++;
- // Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0);
+ Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0);
}
}
/* if (WinderMotorSpeedRollOver)