aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-05-02 17:15:51 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-05-02 17:15:51 +0300
commit75a25525976e0537e714fb2ed77acb891cfb308a (patch)
treefe56ed1c7cbfc932f62947fcfba408df8b761492 /Software/Embedded_SW/Embedded/Modules/Thread
parent66cf568417836f0d6d6d3b7ecbb3a0df5cc65b6c (diff)
parent706cc1daaea7e42dc3ad1e4587d61db042809de0 (diff)
downloadTango-75a25525976e0537e714fb2ed77acb891cfb308a.tar.gz
Tango-75a25525976e0537e714fb2ed77acb891cfb308a.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread.h4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c39
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c4
4 files changed, 34 insertions, 15 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
index 3e2a6aa40..97f3811c7 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
@@ -41,8 +41,8 @@ typedef struct
}MotorControlConfig_t;
-#define MAX_THREAD_FEED_MOTORS WINDER_MOTOR+1
-#define MAX_SYSTEM_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1
+#define MAX_THREAD_FEED_MOTORS (WINDER_MOTOR+1)
+#define MAX_SYSTEM_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1)
extern TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM];
extern HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM];
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 70f32ce6d..df88db3f9 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -54,6 +54,9 @@ uint32_t ScrewControlId = 0xFF;
InternalWinderConfigStruc InternalWinderCfg = {0};
+uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0;
+uint32_t ScrewLocationRun[3];
+
uint32_t Winder_Init(void)
{
ScrewTimerInterruptInit();
@@ -109,6 +112,10 @@ uint32_t Winder_Prepare(void)
AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true);
return ERROR;
}*/
+
+ ScrewLocationRun[0] = 0;
+ ScrewLocationRun[1] = 0;
+
if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT)
{
//REPORT_MSG(LIMIT, "Winder_Prepare at limit");
@@ -136,6 +143,11 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue)
//MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses);
//REPORT_MSG(numOfSteps, "Winder_PrepareStage2");
+ //Read_Screw_Encoder();
+ //ScrewLocationLimitSwitch = Screw_RotEnc.Position;
+ //REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location");
+
+
REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2");
if (ReadValue != LIMIT)
{
@@ -157,7 +169,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag)
//SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home
//MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency);
+ //Read_Screw_Encoder();
+ //ScrewLocationStart = Screw_RotEnc.Position;
+
+ REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location");
+
ScrewCurrentDirection = false;
+ ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position;
ScrewSpeed = 0;
ScrewControlId = 0xFF;
ScrewNumberOfSteps = 0;
@@ -230,6 +248,10 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
ScrewCurrentDirection = 1-ScrewCurrentDirection;
CalculationDirectionChangeCounter++;
+ //REPORT_MSG(ScrewLocationRun[1] - ScrewLocationRun[0], "Screw Run NumberOfSteps");
+ //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]));
+ //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]);
+ //Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0);
if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out
{
@@ -242,7 +264,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0)
{
ScrewNumberOfSteps--;
- //REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps");
+ REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps");
}
}
@@ -251,7 +273,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0)
{
ScrewNumberOfSteps++;
- //REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps");
+ REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps");
}
}
if (WinderMotorSpeedRollOver)
@@ -288,7 +310,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
//Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0);
//Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0);
//REPORT_MSG(temp , "new winder speed");
-// Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0);
+ //Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0);
}
/********************************************************************************/
@@ -440,6 +462,9 @@ void ScrewTimerInterrupt(int ARG0)
ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt
ROM_IntMasterDisable();
+ //Read_Screw_Encoder();
+ //ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position;
+
if (SCREW_TimerActivated == true)
{
ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime);
@@ -455,13 +480,7 @@ void ScrewTimerInterrupt(int ARG0)
}
ROM_IntMasterEnable();
Rotations+=0.03;
- /*random++;
- if (random >= 2)
- random = -1;*/
- //Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0);
- //
- // Enable all interrupts.
- //
+
return ;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
index d7ce917c0..91eedeb6b 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
@@ -9,7 +9,7 @@
#define WINDER_DANCER HARDWARE_DANCER_TYPE__LeftDancer
#define POOLER_DANCER HARDWARE_DANCER_TYPE__MiddleDancer
#define FEEDER_DANCER HARDWARE_DANCER_TYPE__RightDancer
-#define NUM_OF_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1
+#define NUM_OF_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1)
//} DANCER_ENUM;
typedef enum threadMotorsEnum
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index a4208ad25..c292f7dcd 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -842,8 +842,8 @@ char Endstr[150];
Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0);
ThreadUpdateProcessLength (0.0,(void *)NULL);
- TotalProcessedLength = 0.0;
- SetOriginMotorSpeed(0);
+ //TotalProcessedLength = 0.0;
+ SetOriginMotorSpeed(0);
#ifdef HUNDRED_MICROSECONDS_DANCER_READ
MillisecLogClose();
#endif