aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2018-08-06 09:20:25 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2018-08-06 09:20:25 +0300
commitcd92ad2dc4a8df75c1b955757b07c796b064b7e2 (patch)
tree01a24ddc0524f1486812c1f649c4f494fe724d6e /Software/Embedded_SW/Embedded/Modules/Thread
parentcd22de677cf942c8bf82c8bbb6e02ee5630076eb (diff)
parentdb2ff630640c1f2ae5df69a80a883dc8f5de17e1 (diff)
downloadTango-cd92ad2dc4a8df75c1b955757b07c796b064b7e2.tar.gz
Tango-cd92ad2dc4a8df75c1b955757b07c796b064b7e2.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_Winder.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c27
3 files changed, 29 insertions, 17 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 794559d57..486f8384f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -168,7 +168,7 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__
uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
{
uint32_t NumberOfSteps = InternalWinderCfg.segmentoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
- float screw_speed = 0;
+ float screw_horizontal_speed = 0;
float RotationsPerSecond;
if (Counter)
@@ -178,14 +178,15 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
NumberOfSteps -= (Counter/InternalWinderCfg.spoolbackingrate);
REPORT_MSG(ScrewNumberOfSteps, "Head Backing");
ScrewNumberOfSteps--;
- screw_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage;
+ screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage;
// calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second.
RotationsPerSecond = dyeingspeed / (InternalWinderCfg.diameter * PI);
RotationsPerSecond = CurrentControlledSpeed[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround;
// calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm.
- ScrewSpeed = screw_speed*RotationsPerSecond;
+ ScrewSpeed = screw_horizontal_speed*RotationsPerSecond;
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed);
+ CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed;
}
if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 1))
@@ -258,7 +259,7 @@ uint32_t WinderPresegmentReady(uint32_t deviceID, uint32_t ReadValue)
uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
{
//JobTicket* JobTicket = JobDetails;
- float screw_speed = 0;
+ float screw_horizontal_speed = 0;
float RotationsPerSecond;
if (dyeingspeed == 0)
@@ -275,15 +276,16 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
// * calculate
// * 1. calculate speed according to JobTicket->processparameters->dyeingspeed
// * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation.
- screw_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage;
+ screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage;
// calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second.
RotationsPerSecond = dyeingspeed / (InternalWinderCfg.diameter * PI);
RotationsPerSecond = CurrentControlledSpeed[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround;
// calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm.
- ScrewSpeed = screw_speed*RotationsPerSecond;
+ ScrewSpeed = screw_horizontal_speed*RotationsPerSecond;
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed);
- //screw_speed = InternalWinderCfg.milimetersperrotation
+ CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed;
+ //screw_horizontal_speed = InternalWinderCfg.milimetersperrotation
// * 2. determine optimal micro-step setting
// * 3. calculate cart travel length from winding parameters
// * 4. start move of travel length
@@ -292,7 +294,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back.
ScrewControlId = AddControlCallback(ScrewDirectionChange, eOneMillisecond,MotorControlGetnBusyState,(IfTypeMotors*0x100+HARDWARE_MOTOR_TYPE__MOTO_SCREW), HARDWARE_MOTOR_TYPE__MOTO_SCREW, 0);
- // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_speed,WinderPresegmentReady);
+ // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_horizontal_speed,WinderPresegmentReady);
//in a callback: calculate backing rate for top and bottom, update point 0, update passing length, call the appropriate move to 0 / move;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
index 7405a91d9..79c2bf843 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
@@ -25,6 +25,7 @@ extern double TotalProcessedLength;
uint32_t InternalWindingConfigMessage(JobSpool* request);
+uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId);
uint32_t ThreadPrepareState(void *JobDetails);
uint32_t ThreadPreSegmentState(void *JobDetails);
uint32_t ThreadSegmentState(void *JobDetails, int SegmentId);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index 8d1ea20fa..fbf5cb811 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -20,7 +20,8 @@
#include "StateMachines/Printing/PrintingSTM.h"
#include "drivers/Motors/Motor.h"
-#include "drivers/Danser_SSI/ssi_comm.h"
+//#include "drivers/SSI_Comm/ssi_comm.h"
+#include "drivers/SSI_Comm/Dancer/Dancer.h"
#include "drivers/Heater/TemperatureSensor.h"
#include "drivers/Heater/Heater.h"
#include "drivers/Motors/Motor.h"
@@ -127,8 +128,8 @@ void ThreadUpdateProcessLength (double length, void *Funcptr)
ProcessedLengthFuncPtr = (ProcessedLengthFunc)Funcptr;
initialpos = 0xFFFF;
}
-double MotorSentData[102] = {0};
-uint32_t PosDif[102] = {0};
+double MotorSentData[100] = {0};
+uint32_t PosDif[100] = {0};
int MotorDataIndex = 0;
@@ -181,7 +182,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//PosDif[MotorDataIndex] = positionDiff;
MotorSentData[MotorDataIndex] = length;
MotorDataIndex+=1;
- if (MotorDataIndex >= 97) MotorDataIndex = 0;
+ if (MotorDataIndex == 99) MotorDataIndex = 0;
static int pooler_counter = 0;
pooler_counter++;
TotalProcessedLength+= (length/100);
@@ -415,6 +416,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
}
//********************************************************************************************************************
+uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId)
+{
+ return CurrentControlledSpeed[MotorId];
+}
//********************************************************************************************************************
uint32_t ThreadInitialTestStub(HardwareMotor * request)
@@ -561,13 +566,17 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
//MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, OriginalMotorSpd_2PPS[FEEDER_MOTOR]);
//#warning rocker disabled
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].has_directionthreadwize)
+ if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0)
+ {
MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 2);
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].has_directionthreadwize)
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 2);
+ }
+ if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].maxfrequency > 0)
+ {
MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 2);
-//#warning rocker disabled
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 2);
+ }
+ //#warning rocker disabled
// MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 0, GPI_LS_RLOADMOTOR_UP, EndState); //TODO