aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-01-31 11:40:34 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-01-31 11:40:34 +0200
commit1dcf48d11246dcc69ca28dbb345cb53b12b7d7de (patch)
treebf38ebeb633468f1d80ee208701fbe43720c720c /Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
parent59fee3a258ff15567d21021b661f27d0a6958f8c (diff)
parentbf69a053dcec41d2a38ea63d5e0cb10453190136 (diff)
downloadTango-1dcf48d11246dcc69ca28dbb345cb53b12b7d7de.tar.gz
Tango-1dcf48d11246dcc69ca28dbb345cb53b12b7d7de.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c21
1 files changed, 12 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 c48eec522..1cb854f87 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -305,7 +305,7 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue)
}
//double eNormalizedError[100];
//int TranslatedreadValue[100];
-#define MAX_THREAD_CONTROL_LOG 100
+/*#define MAX_THREAD_CONTROL_LOG 100
double calculatedError[MAX_THREAD_CONTROL_LOG+1];
double NormError[MAX_THREAD_CONTROL_LOG+1];
double mIntegral[MAX_THREAD_CONTROL_LOG+1];
@@ -313,7 +313,7 @@ int MotorId[MAX_THREAD_CONTROL_LOG+1];
int readValue[MAX_THREAD_CONTROL_LOG+1];
int AveragereadValue[MAX_THREAD_CONTROL_LOG+1];
int calculatedspeed[MAX_THREAD_CONTROL_LOG+1];
-int timestamp[MAX_THREAD_CONTROL_LOG+1];
+int timestamp[MAX_THREAD_CONTROL_LOG+1];*/
int controlIndex = 0;
bool keepdata = true;
/*int32_t KeepReadValue = 0;
@@ -342,7 +342,7 @@ void testDancersControl()
}*/
bool dancerinvalid = false;
int MotorFailedSample[MAX_THREAD_MOTORS_NUM] = {0,0,0,0,0};
-char Message[60];
+char TMessage[60];
uint16_t BreakSensorCounter = 0;
uint16_t BreakSensorLatchCounter = 0;
uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
@@ -358,7 +358,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//double tempcalcspeed = 0;
uint32_t calculated_speed;
double NormalizedError;
- char Message[60];
if (ThreadControlActive == false)
return OK;
@@ -403,6 +402,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
MotorSamplePointer[index]++;
if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode)
MotorSamplePointer[index] = 0;
+#ifdef TEST_LONGER_PID_THREAD
+ else // test: handle tension once in pvinputfilterfactormode milliseconds
+ return OK;
+#endif
for (i=0;i<MotorsControl[index].pvinputfilterfactormode;i++)
avreageSampleValue += MotorSamples[index][i];
avreageSampleValue = avreageSampleValue / MotorsControl[index].pvinputfilterfactormode;
@@ -447,13 +450,13 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
if ((abs(avreageSampleValue)> DancerStopActivityLimit[index])&&(JobCounter > eOneSecond))
{
keepdata = false;
- usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint);
+ usnprintf(TMessage, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint);
//JobAbortedByUser = true;
ThreadControlActive = false;
//MotorGetStatusFromFPGA(ThreadMotorIdToMotorId[index]);
JobEndReason = JOB_WINDER_DANCER_FAIL+DancerId;
- SendJobProgress(0.0,0,false, Message);
- //EndState(CurrentJob,Message );
+ SendJobProgress(0.0,0,false, TMessage);
+ //EndState(CurrentJob,TMessage );
SegmentReady(Module_Thread,ModuleFail);
AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE,true);
LOG_ERROR (DancerId, "Dancer Failure");
@@ -475,7 +478,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index];
if (abs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue)
{
- if (keepdata == true)
+ /*if (keepdata == true)
{
calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError;
MotorId[controlIndex] = index;
@@ -488,7 +491,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
timestamp[controlIndex] = msec_millisecondCounter;
if (controlIndex++>=MAX_THREAD_CONTROL_LOG)
controlIndex = 0;
- }
+ }*/
CurrentControlledSpeed[index] = calculated_speed;
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed);
}