diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-01-31 09:30:49 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-01-31 09:30:49 +0200 |
| commit | 6704280804a6d1cebd5ee13050ba18950cdb83ec (patch) | |
| tree | d6985e901f5bf7e71db3da7bb017a1610e10978e /Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | |
| parent | 4bce971463af706dad054d61e291dcfe1355fc06 (diff) | |
| parent | e679fb8fe63641c2ba1808f4ef2799f398120235 (diff) | |
| download | Tango-6704280804a6d1cebd5ee13050ba18950cdb83ec.tar.gz Tango-6704280804a6d1cebd5ee13050ba18950cdb83ec.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_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.c | 21 |
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); } |
