aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-03-27 15:16:39 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-03-27 15:16:39 +0200
commit84d06b05bb02a35bde4507832ad850ac3183dfe6 (patch)
tree3ca88b66495848f90821616a082f700e9132a273 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parentaa41735a62ec39e33c7cbed34dc2f0d1c80910d6 (diff)
downloadTango-84d06b05bb02a35bde4507832ad850ac3183dfe6.tar.gz
Tango-84d06b05bb02a35bde4507832ad850ac3183dfe6.zip
Version 1.3.8.12 printing function calls with segments info. ids - no valves. improved winding. dispensers pressure build on startup. try not to touch valves during job
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c39
1 files changed, 28 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 d8a96a4d9..faee55608 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -40,8 +40,8 @@ void ScrewsStartControlTimer (void);
bool Winder_ScrewHoming = false;
bool ScrewCurrentDirection = false; //holds current screw direction
uint32_t ScrewDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone
-uint32_t ScrewChangeCounter = 0;
-uint32_t ScrewChangeLimit = 0;
+//uint32_t ScrewChangeCounter = 0;
+//uint32_t ScrewChangeLimit = 0;
uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone
uint16_t WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION];
uint16_t WinderMotorSpeedCounter = 0;
@@ -77,7 +77,7 @@ uint32_t InternalWindingConfigMessage(JobSpool* request)
InternalWinderCfg.spoolbackingrate = request->backingrate;
InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
- InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage;
+ InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//request->rotationsperpassage;
InternalWinderCfg.diameter = request->diameter;
return status;
@@ -198,6 +198,8 @@ char ScrewStr[100];
//char TempScrewStr[100];
double WinderReferenceSpeed=0;
int32_t TotalWinderSpeed=0;
+bool Add100 = false;
+double Rotations = 6.0;
uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
//uint32_t Steps;
@@ -206,14 +208,18 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
double RotationsPerSecond;
int32_t Averagewinderspeed = 0;
- ScrewChangeCounter++;
- if ((ScrewChangeCounter>3)&&(ScrewChangeCounter<(ScrewChangeLimit-2))) //do not take the winder speed near the limits
+ //ScrewChangeCounter++;
+ //if ((ScrewChangeCounter>3)&&(ScrewChangeCounter<(ScrewChangeLimit-2))) //do not take the winder speed near the limits
{
TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter];
WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR];
TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter];
if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION)
{
+ if (WinderMotorSpeedRollOver == false)
+ {
+ Add100 = true;
+ }
WinderMotorSpeedCounter=0;
WinderMotorSpeedRollOver=true;
}
@@ -227,6 +233,12 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out
{
+ if (Add100 == true) //once per job
+ {
+ ScrewNumberOfSteps += 100;
+ Add100 = false;
+ }
+
if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0)
{
ScrewNumberOfSteps--;
@@ -254,7 +266,9 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
WinderReferenceSpeed = Averagewinderspeed;
}
- screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage;
+ screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage;
+ if (Rotations > 7.0)
+ Rotations = 6.0;
RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround;
tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond;
//ROM_IntMasterDisable();
@@ -288,7 +302,7 @@ uint32_t WinderPresegmentReady(uint32_t deviceID, uint32_t ReadValue)
return PreSegmentReady(Module_Winder,ModuleDone);
}
-uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
+uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId)
{
//JobTicket* JobTicket = JobDetails;
double screw_horizontal_speed = 0;
@@ -330,6 +344,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
// * 4. start move of travel length
// * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed
ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
+ ScrewNumberOfSteps -= 100;
temp = SYS_CLK_FREQ;
temp *= InternalWinderCfg.segmentoffsetpulses;
temp /= ScrewSpeed;
@@ -349,6 +364,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
WinderMotorSpeedCounter=0;
TotalWinderSpeed = 0;
WinderMotorSpeedRollOver=false;
+ Add100 = false;
}
PreSegmentReady(Module_Winder,ModuleDone);
@@ -429,8 +445,8 @@ void ScrewTimerInterrupt(int ARG0)
ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime);
MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection);
MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed+random);
- ScrewChangeCounter = 0;
- ScrewChangeLimit = ScrewRunningTime/12000000;
+ // ScrewChangeCounter = 0;
+ // ScrewChangeLimit = ScrewRunningTime/12000000;
ScrewDirectionChangeCounter++;
}
else
@@ -438,9 +454,10 @@ void ScrewTimerInterrupt(int ARG0)
TimerDisable(Screw_timerBase, TIMER_A);
}
ROM_IntMasterEnable();
- random++;
+ Rotations+=0.1;
+ /*random++;
if (random >= 2)
- random = -1;
+ random = -1;*/
//Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0);
//
// Enable all interrupts.