aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-12-27 12:09:52 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-12-27 12:09:52 +0200
commit2769e72857ebc543d8f40a3cbca218f2f010a77d (patch)
treeb35fc9781886083ffad35a17dffee947cfdb1800 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parent637d6a416fa3ba7784a8ebb2a28fb169d8baa574 (diff)
downloadTango-2769e72857ebc543d8f40a3cbca218f2f010a77d.tar.gz
Tango-2769e72857ebc543d8f40a3cbca218f2f010a77d.zip
Version 1.3.0.8 changes for connection resiliance: priorities, diagnostics and alarm handling
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c22
1 files changed, 11 insertions, 11 deletions
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 ;
}