aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-07-16 10:49:07 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-07-16 10:49:07 +0300
commite033f489d7e0e5b258c04425835ef9c484e0417d (patch)
treee07968ef14ce17bedcf847c8f5463ea714340991 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
parent366c53d4833131f4dcd507f5c8123ad10a8d23da (diff)
downloadTango-e033f489d7e0e5b258c04425835ef9c484e0417d.tar.gz
Tango-e033f489d7e0e5b258c04425835ef9c484e0417d.zip
send job response during prepare state, with heaters temp. send progress with total processed meters
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
-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