From a435fa908aa5ef7e167c96866316c2c018f05877 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 11 Nov 2018 17:30:48 +0200 Subject: remove usb reconnection (only flush buffers). improve thread tracking --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 22f54eb50..24ce14676 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -5,6 +5,7 @@ * operating the dispensers according to predefined dispensing rate from the UI **************************************************************************************************************************/ #include "include.h" +#include #include "thread.h" #include "thread_ex.h" #include "../control/control.h" @@ -317,6 +318,8 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) //int TranslatedreadValue[100]; #define MAX_THREAD_CONTROL_LOG 500 double calculatedError[MAX_THREAD_CONTROL_LOG]; +double NormError[MAX_THREAD_CONTROL_LOG]; +double mIntegral[MAX_THREAD_CONTROL_LOG]; int MotorId[MAX_THREAD_CONTROL_LOG]; int readValue[MAX_THREAD_CONTROL_LOG]; int AveragereadValue[MAX_THREAD_CONTROL_LOG]; @@ -475,7 +478,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) readValue[controlIndex] = ReadValue; AveragereadValue[controlIndex] = avreageSampleValue; calculatedspeed[controlIndex] = calculated_speed; - timestamp[controlIndex] = HibernateRTCSSGet(); + NormError[controlIndex] + = MotorControlConfig[index].m_mesuredParam; + mIntegral[controlIndex] = MotorControlConfig[index].m_integral; + timestamp[controlIndex] = msec_millisecondCounter; if (controlIndex++>=MAX_THREAD_CONTROL_LOG) controlIndex = 0; } -- cgit v1.3.1 From 9699b74d7cf87fef466cb6606fe9e110e3b15120 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 11 Nov 2018 17:37:27 +0200 Subject: reset control with eNoControl value --- Software/Embedded_SW/Embedded/Modules/Control/control.c | 3 +++ .../Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index bb7bbaa92..78cdd5324 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -363,6 +363,9 @@ uint32_t ControlLoop(uint32_t tick) LOG_ERROR (Device_i, "Invalid callback ptr"); } break; + case eNoControl: + memset (&ControlArray[Device_i],0,sizeof(ControlDeviceStruc) ); + break; default: LOG_ERROR (ControlArray[Device_i].ControlTiming, "Invalid control timing value"); break; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 22f54eb50..d8dbbaaa0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -316,12 +316,12 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) //double eNormalizedError[100]; //int TranslatedreadValue[100]; #define MAX_THREAD_CONTROL_LOG 500 -double calculatedError[MAX_THREAD_CONTROL_LOG]; -int MotorId[MAX_THREAD_CONTROL_LOG]; -int readValue[MAX_THREAD_CONTROL_LOG]; -int AveragereadValue[MAX_THREAD_CONTROL_LOG]; -int calculatedspeed[MAX_THREAD_CONTROL_LOG]; -int timestamp[MAX_THREAD_CONTROL_LOG]; +double calculatedError[MAX_THREAD_CONTROL_LOG+1]; +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 controlIndex = 0; bool keepdata = true; /*int32_t KeepReadValue = 0; @@ -475,7 +475,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) readValue[controlIndex] = ReadValue; AveragereadValue[controlIndex] = avreageSampleValue; calculatedspeed[controlIndex] = calculated_speed; - timestamp[controlIndex] = HibernateRTCSSGet(); + timestamp[controlIndex] = msec_millisecondCounter; if (controlIndex++>=MAX_THREAD_CONTROL_LOG) controlIndex = 0; } -- cgit v1.3.1