aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-07-17 15:44:17 +0300
committerAvi Levkovich <avi@twine-s.com>2018-07-17 15:44:17 +0300
commit316552019c43e27114669a7f3e6138902c9d8220 (patch)
tree8b0f8ff0645f721718e60ff1cc9c0c76f2537ebc /Software/Embedded_SW/Embedded/Modules/Thread
parentaf99264e5ca64bcb0173f2586c2295fc0cb21d75 (diff)
parentf4aad3bc7f9d4c457805a233f969938ef341b22c (diff)
downloadTango-316552019c43e27114669a7f3e6138902c9d8220.tar.gz
Tango-316552019c43e27114669a7f3e6138902c9d8220.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c60
2 files changed, 24 insertions, 40 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index e40be86a0..a8ca46574 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -166,13 +166,13 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
if (Counter)
{
- if (Counter%InternalWinderCfg.spoolbackingrate == 0)
+ if (Counter%InternalWinderCfg.spoolbackingrate == 1)
{
NumberOfSteps -= (Counter/InternalWinderCfg.spoolbackingrate);
REPORT_MSG(ScrewNumberOfSteps, "Head Backing");
ScrewNumberOfSteps--;
}
- if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 0))
+ if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 1))
{
if (direction != MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index fd86f0973..5bf666383 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -62,8 +62,9 @@ uint32_t PreviousPosition = 0, CurrentPosition = 0;
double totalLength = 0.0;
double CurrentRequestedLength = 0.0;
double CurrentProcessedLength = 0.0;
+double TotalProcessedLength = 0.0;
double LengthCalculationMultiplier;
-
+bool PrepareState = false;
int CurrentSegmentId = 0;
typedef void (* ProcessedLengthFunc)(void);
ProcessedLengthFunc ProcessedLengthFuncPtr = NULL;
@@ -136,6 +137,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
uint32_t positionDiff = 0;
double length = 0.0;
+ char str[150];
int index = MAX_THREAD_MOTORS_NUM;
if (IfIndex>>8 != IfTypeThread)
{
@@ -143,16 +145,16 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
return 0xFFFFFFFF;
}
index = IfIndex&0xFF;
- if (CurrentRequestedLength == 0.0)
- return OK;
+// if (CurrentRequestedLength == 0.0)
+// return OK;
if (index != FEEDER_MOTOR)
{
LOG_ERROR (IfIndex, "Wrong Motor");
return 0xFFFFFFFF;
}
CurrentPosition = MotorGetPosition(ThreadMotorIdToMotorId[index]);
- if (CurrentPosition == 0)
- return OK; //unusable data
+// if (CurrentPosition == 0)
+// return OK; //unusable data
if (initialpos == 0xFFFF)
{
PreviousPosition = CurrentPosition;
@@ -184,15 +186,19 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
pooler_counter++;
if (pooler_counter%10 == 0)
{
- SendJobProgress(CurrentProcessedLength/100,CurrentSegmentId,false, "Progress");
+ if (PrepareState == true)
+ {
+ //later - add temperatures
+ TemperatureListString(str);
- }
- if (pooler_counter>=100)
- {
- //HeatingTestSendResonse(0, false,true,true, MotorDriverRequest[22].Speed,MotorDriverRequest[18].Speed,MotorDriverRequest[15].Speed,MotorDriverRequest[3].Speed, "MotorSpeed");
+ SendJobProgress(0.0,0,false, str);
+ }
+ else
+ {
+ TotalProcessedLength+= (length/100);
+ SendJobProgress(TotalProcessedLength,0,false, "Progress");
+ }
- //HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,positionDiff/*(int)error_integered*/,CurrentProcessedLength,CurrentRequestedLength, "FeederLength");
- // pooler_counter = 0;
}
if (CurrentProcessedLength>=CurrentRequestedLength )
{
@@ -291,7 +297,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//read value is the dancer angle
int i,index=MAX_THREAD_MOTORS_NUM;
int DancerId;
- static int pooler_counter = 0;
int32_t TranslatedReadValue, avreageSampleValue = 0;
//double tempcalcspeed = 0;
uint32_t calculated_speed;
@@ -390,30 +395,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed);
}
}
- if (index == FEEDER_MOTOR)
- {
- pooler_counter++;
- if (pooler_counter>=1000)
- {
- //float error_integered = MotorControlConfig[index].m_calculatedError*1000;
- /*{
- "HeaterGroupId": 0,
- "Zone1Temp": 80,
- "Zone2Temp": 2641,
- "Heater1Active": false,
- "Heater2Active": false,
- "Heater1Percentage": 3,
- "Heater2Percentage": 4000,
- "InfoMessage": "Standard DC"
-} void HeatingTestSendResonse(uint32_t status, bool last,bool heater1Active,bool heater2Active, int temperature1, int temperature2,int Heater1Percentage,int Heater2Percentage, char* Message)
-
-}*/
- //HeatingTestSendResonse(0, false,true,true, MotorDriverRequest[22].Speed,MotorDriverRequest[18].Speed,MotorDriverRequest[15].Speed,MotorDriverRequest[3].Speed, "MotorSpeed");
-
- //HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/_speed,OriginalMotorSpd_2PPS[index]/*(int)error_integered*/,MotorControlConfig[index].m_calculatedError,ReadValue, "FeederSpeed");
- // pooler_counter = 0;
- }
- }
return OK;
}
@@ -438,6 +419,8 @@ bool InitialProcess = false;
CurrentSegmentId = 0;
JobCounter = 0;
+ TotalProcessedLength = 0.0;
+ PrepareState = true;
//start thread control for all motors
for (Motor_i = 0;Motor_i < MAX_THREAD_MOTORS_NUM;Motor_i++)
{
@@ -541,7 +524,7 @@ void SetOriginMotorSpeed(float process_speed)
//********************************************************************************************************************
uint32_t ThreadPreSegmentState(void *JobDetails)
{
-//set the speed only before the first segment, speed is constant accros job
+//set the speed only before the first segment, speed is constant across all job segments and intersegments
JobTicket* JobTicket = JobDetails;
float process_speed = dyeingspeed;
@@ -553,6 +536,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
SetOriginMotorSpeed(process_speed);
ThreadControlActive = true;
+ PrepareState = false;
// set the new speed in the dryer motor to the speed of the new segment
MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]);
//only for testing - when control works, these motors will take their speed from the dryer