aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-16 20:01:25 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-16 20:01:25 +0300
commitc5a54597a0a02da5b3cf942fff95586a9dfe836d (patch)
treec88af8d4263b1a2b75c03a5eae110b5fa69edc50 /Software/Embedded_SW/Embedded/Modules/Thread
parent69bbedacee151090d5d0b6665b3a1614e65f1997 (diff)
parent9ede0976fe74419bde17cea8c1f1a29e948ea130 (diff)
downloadTango-c5a54597a0a02da5b3cf942fff95586a9dfe836d.tar.gz
Tango-c5a54597a0a02da5b3cf942fff95586a9dfe836d.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_print.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index fd86f0973..a64ac6cef 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)
{
@@ -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+= (CurrentProcessedLength/100);
+ SendJobProgress(CurrentProcessedLength,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 )
{
@@ -438,6 +444,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 +549,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 +561,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