aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index f5462e398..fafc43fb5 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -15,6 +15,8 @@
#include "PMR/Printing/JobSegment.pb-c.h"
#include "PMR/Printing/JobTicket.pb-c.h"
+#include <utils/ustdlib.h>
+
#include "StateMachines/Printing/PrintingSTM.h"
#include "drivers/Motors/Motor.h"
@@ -178,7 +180,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
pooler_counter++;
if (pooler_counter%10 == 0)
{
- SendJobProgress(CurrentProcessedLength/CurrentRequestedLength,CurrentSegmentId,false);
+ SendJobProgress(CurrentProcessedLength/CurrentRequestedLength,CurrentSegmentId,false, "Progress");
//SendJobProgress(/*KeepNormalizedError*/MotorControlConfig[index].m_calculatedError,CurrentSegmentId,false);
}
@@ -259,6 +261,8 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
int32_t TranslatedReadValue, avreageSampleValue = 0;
uint32_t calculated_speed;
double NormalizedError;
+ char Message[60];
+
if (IfIndex>>8 != IfTypeThread)
{
LOG_ERROR (IfIndex, "Wrong Interface type");
@@ -293,7 +297,8 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//TranslatedReadValue = 0;//test
MotorSamples[index][MotorSamplePointer[index]] = TranslatedReadValue;//(-1 * TranslatedReadValue);
MotorSamplePointer[index]++;
- if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode) MotorSamplePointer[index] = 0;
+ if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode)
+ MotorSamplePointer[index] = 0;
for (i=0;i<MotorsControl[index].pvinputfilterfactormode;i++)
avreageSampleValue += MotorSamples[index][i];
avreageSampleValue = avreageSampleValue / MotorsControl[index].pvinputfilterfactormode;
@@ -301,7 +306,9 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
if ((abs(avreageSampleValue)> DancerStopActivityLimit[index])&&(JobCounter > eOneSecond))
{
- EndState(CurrentJob);
+ usnprintf(Message, 60, "Dancer % limit%d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint);
+
+ EndState(CurrentJob,Message );
}
NormalizedError = avreageSampleValue*NormalizedErrorCoEfficient[index];
MotorControlConfig[index].m_mesuredParam = NormalizedError;
@@ -472,7 +479,9 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
//set the speed only before the first segment, speed is constant accros job
JobTicket* JobTicket = JobDetails;
- float process_speed = JobTicket->processparameters->dyeingspeed;
+ float process_speed;
+ if (JobTicket->processparameters)
+ process_speed= JobTicket->processparameters->dyeingspeed;
SetOriginMotorSpeed(process_speed);
//ControlStart();
@@ -483,14 +492,14 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
//only for testing - when control works, these motors will take their speed from the dryer
//MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, OriginalMotorSpd_2PPS[FEEDER_MOTOR]);
-//#warning rocker disabled
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].has_directionthreadwize)
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 5);
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].has_directionthreadwize)
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 5);
-//#warning rocker disabled
+#warning rocker disabled
+// if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].has_directionthreadwize)
+// MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
+// MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 5);
+// if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].has_directionthreadwize)
+// MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
+// MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 5);
+#warning rocker disabled
// MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 0, GPI_LS_RLOADMOTOR_UP, EndState); //TODO
@@ -506,6 +515,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
{
ThreadUpdateProcessLength (0,(void *)NULL);
PreSegmentReady(Module_Thread,ModuleDone);
+ JobCounter = 0;
InitialProcess = false;
}