From 2769e72857ebc543d8f40a3cbca218f2f010a77d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 27 Dec 2018 12:09:52 +0200 Subject: Version 1.3.0.8 changes for connection resiliance: priorities, diagnostics and alarm handling --- .../Embedded/Modules/Thread/Thread_Winder.c | 22 +++++++++++----------- .../Embedded/Modules/Thread/Thread_print.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 6915cc657..fed1311bd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -181,7 +181,7 @@ int32_t TotalWinderSpeed=0; uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { uint32_t Steps; - double temp; + double temp,tempScrewSpeed; double screw_horizontal_speed = 0; double RotationsPerSecond; int32_t Averagewinderspeed = 0; @@ -232,16 +232,17 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) } screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage; RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; - ROM_IntMasterDisable(); - ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + //ROM_IntMasterDisable(); CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; temp = SYS_CLK_FREQ; temp *= ScrewNumberOfSteps; - temp /= ScrewSpeed; - if (ScrewRunningTime != temp) + temp /= tempScrewSpeed; + if ((ScrewRunningTime != temp)||(ScrewSpeed != tempScrewSpeed)) { + ScrewSpeed = tempScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*Steps)/ScrewSpeed; - ROM_IntMasterEnable(); + //ROM_IntMasterEnable(); //usnprintf(TempScrewStr, 100, "Winder: Horizon,Rotation, PPR, RPP{ %d, %d ,%d, %d} ",(int)screw_horizontal_speed,(int)RotationsPerSecond,(int)InternalWinderCfg.NumberOfRotationPerPassage,(int)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround); usnprintf(ScrewStr, 100, "Winder: Steps,Speed, Time, WinderSpeed{ %d, %d ,%d, %d} ",(int)ScrewNumberOfSteps,(int)ScrewSpeed,(int)temp,(int)WinderReferenceSpeed); // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); @@ -253,7 +254,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) } /********************************************************************************/ - ROM_IntMasterEnable(); + //ROM_IntMasterEnable(); return OK; } @@ -313,6 +314,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId) REPORT_MSG(ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); // MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); //ScrewDirection = 1-ScrewDirection; + REPORT_MSG(SegmentId,"Winder pre segment - SegmentId"); REPORT_MSG(ScrewSpeed,"Winder pre segment - ScrewSpeed"); //MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); ScrewsStartControlTimer (); @@ -398,12 +400,10 @@ void ScrewTimerInterrupt(int ARG0) { ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt ROM_IntMasterDisable(); - //ScrewDirectionChange(0,NOTBUSY); if (SCREW_TimerActivated == true) { MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); -// ScrewCurrentDirection = 1-ScrewCurrentDirection; MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); ScrewDirectionChangeCounter++; @@ -412,11 +412,11 @@ void ScrewTimerInterrupt(int ARG0) { TimerDisable(Screw_timerBase, TIMER_A); } - Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0); + ROM_IntMasterEnable(); + //Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0); // // Enable all interrupts. // - ROM_IntMasterEnable(); return ; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 72391e3a9..94858cae2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -462,7 +462,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint); //JobAbortedByUser = true; ThreadControlActive = false; - MotorGetStatusFromFPGA(ThreadMotorIdToMotorId[index]); + //MotorGetStatusFromFPGA(ThreadMotorIdToMotorId[index]); JobEndReason = JOB_WINDER_DANCER_FAIL+DancerId; SendJobProgress(0.0,0,false, Message); //EndState(CurrentJob,Message ); -- cgit v1.3.1