From 3006b6a690a9e07140ea4e3240a52978ebe1e96d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 26 Sep 2019 14:13:51 +0300 Subject: fix winder prints --- .../Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 60bf8123f..4789c7a17 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -54,6 +54,8 @@ uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the bool SCREW_TimerActivated = false; uint32_t ScrewControlId = 0xFF; + + static bool KeepWindingCone = false; static uint32_t WindingConeLocation; static uint32_t WinderBackToBaseTime = 800; @@ -63,6 +65,8 @@ InternalWinderConfigStruc InternalWinderCfg = {0}; #ifdef READ_SCREW_ENCODER uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; uint32_t ScrewLocationRun[3]; +float WinderRunAverage = 0.0,WinderRunSum = 0.0; +int WinderRunSamples = 0; #endif bool SampleWinding = false; uint32_t Winder_Init(void) @@ -141,6 +145,10 @@ uint32_t Winder_Prepare(void *JobDetails) #ifdef READ_SCREW_ENCODER ScrewLocationRun[0] = 0; ScrewLocationRun[1] = 0; + WinderRunAverage = 0.0; + WinderRunSum = 0.0; + WinderRunSamples = 0; + #endif if (( KeepWindingCone == false)||(WindingConeLocation == 0)) { @@ -272,10 +280,6 @@ int flipflop = 0; uint32_t motspeed; float speedf; int WinderCalculation = 0; -#ifdef READ_SCREW_ENCODER -float WinderRunAverage = 0.0,WinderRunSum = 0.0; -int WinderRunSamples = 0; -#endif uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { //uint32_t Steps; @@ -322,7 +326,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) #ifdef READ_SCREW_ENCODER int WinderRun; WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]); - if ((WinderRun < 20000)&&(Add100 == false)) + if ((WinderRun < 30000)&&(WinderMotorSpeedRollOver == true)) { WinderRunSamples++; if (WinderRunSamples>10) -- cgit v1.3.1