aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-07-12 09:41:33 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-07-12 09:41:33 +0300
commit1fe6f6b50598fff4d52273138936031f3dee7866 (patch)
tree26fad71aa271df637f348864b8b4a4b8738f0ee5 /Software/Embedded_SW/Embedded/Modules/Thread
parent521c56c625e7e5b494303a8b1117e693a84abd95 (diff)
downloadTango-1fe6f6b50598fff4d52273138936031f3dee7866.tar.gz
Tango-1fe6f6b50598fff4d52273138936031f3dee7866.zip
Spool cone handling, debug log in job progress
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c63
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c25
3 files changed, 62 insertions, 28 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
index dad7a1db6..7780287fb 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
@@ -48,7 +48,7 @@ extern HardwarePidControlType ThreadMotorIdToControlId[MAX_THREAD_MOTORS_NUM];
extern HardwareMotor MotorsCfg[NUM_OF_MOTORS];
extern HardwarePidControl MotorsControl[MAX_THREAD_MOTORS_NUM];
-extern InternalWinderConfigStruc InternalWinderCfg;
+//extern InternalWinderConfigStruc InternalWinderCfg;
extern HardwareDancer DancersCfg[MAX_SYSTEM_DANCERS];
#define MAX_CONTROL_SAMPLES 10
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 759e16d09..33086b636 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -11,6 +11,8 @@
#include "StateMachines/Printing/PrintingSTM.h"
#include "Modules/Control/Control.h"
+#include "Common/report/report.h"
+
#include "drivers/FPGA/FPGA.h"
#include "drivers/FPGA/FPGA_SPI_Comm.h"
@@ -27,10 +29,35 @@ uint32_t ScrewControlId = 0xFF;
uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone
uint32_t DirectionChangeCounter = 0; //holds the current number of runs of the screw - will be used to build the cone
+InternalWinderConfigStruc InternalWinderCfg = {0};
+
uint32_t Winder_Init(void)
{
return OK;
}
+
+
+uint32_t InternalWinderConfigMessage(HardwareWinder* request)
+{
+ uint32_t status = PASSED;
+
+ InternalWinderCfg.milimetersperrotation = request->millimeterperrotation;
+
+ return status;
+}
+uint32_t InternalWindingConfigMessage(JobSpool* request)
+{
+ uint32_t status = PASSED;
+
+ InternalWinderCfg.segmentoffsetpulses = request->segmentoffsetpulses;
+ InternalWinderCfg.spoolbackingrate = request->backingrate;
+ InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
+ InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
+ InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage;
+ InternalWinderCfg.diameter = request->diameter;
+
+ return status;
+}
/*
*uint32_t Winder_Prepare(void *JobDetails)
@@ -107,7 +134,13 @@ uint32_t ScrewControlId = 0xFF;
uint32_t ScrewNumberOfSteps = 0;
uint32_t DirectionChangeCounter = 0;
*/
-
+/*
+ InternalWinderCfg.segmentoffsetpulses = request->segmentoffsetpulses;
+ InternalWinderCfg.spoolbackingrate = request->backingrate;
+ InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
+ InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
+ InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage;
+ *
Calculate the number of steps.
Initial home position = ...
Initial out movement = ScrewNumberOfSteps
@@ -125,6 +158,32 @@ InternalWinderCfg.segmentoffsetpulses
numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
*/
+uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
+{
+ uint32_t NumberOfSteps = InternalWinderCfg.segmentoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
+
+ if (Counter)
+ {
+ if (Counter%InternalWinderCfg.spoolbackingrate == 0)
+ {
+ NumberOfSteps -= (Counter/InternalWinderCfg.spoolbackingrate);
+ REPORT_MSG(ScrewNumberOfSteps, "Head Backing");
+ ScrewNumberOfSteps--;
+ }
+ if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 0))
+ {
+ if (direction != MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize)
+ {
+ NumberOfSteps += (Counter/InternalWinderCfg.SpoolBottomBackingRate);
+ ScrewNumberOfSteps++;
+ REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing");
+ }
+
+ }
+ }
+ return CalculateNumberOfSteps;
+
+}
uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
if (BusyfirstCall)
@@ -135,6 +194,7 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
//ScrewCurrentDirection: false moves out, true moves home
if (BusyFlag == NOTBUSY)
{
+ CalculateNumberOfSteps (DirectionChangeCounter++, ScrewCurrentDirection);
if (ScrewCurrentDirection == false)
{
ScrewCurrentDirection = true;
@@ -144,7 +204,6 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
ScrewCurrentDirection = false;
}
MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back.
- DirectionChangeCounter++;
}
/*
* calculate new ScrewSpeed and call MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index 3c9adbc31..c5f45da78 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -18,35 +18,10 @@ int32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES] = {0};
int MotorSamplePointer[MAX_THREAD_MOTORS_NUM] = {0};
double NormalizedErrorCoEfficient[MAX_THREAD_MOTORS_NUM] = {0};
int DancerStopActivityLimit[MAX_THREAD_MOTORS_NUM] = {0};
-InternalWinderConfigStruc InternalWinderCfg = {0};
HardwareDancer DancersCfg[MAX_SYSTEM_DANCERS] = {0};
HardwarePidControlType ThreadMotorIdToControlId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_PID_CONTROL_TYPE__MotorFeeder,HARDWARE_PID_CONTROL_TYPE__MotorDryer,HARDWARE_PID_CONTROL_TYPE__MotorPooler,HARDWARE_PID_CONTROL_TYPE__MotorWinder,0};
-
-
-uint32_t InternalWinderConfigMessage(HardwareWinder* request)
-{
- uint32_t status = PASSED;
-
- InternalWinderCfg.milimetersperrotation = request->millimeterperrotation;
-
- return status;
-}
-uint32_t InternalWindingConfigMessage(JobSpool* request)
-{
- uint32_t status = PASSED;
-
- InternalWinderCfg.segmentoffsetpulses = request->segmentoffsetpulses;
- InternalWinderCfg.spoolbackingrate = request->backingrate;
- InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
- InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
- InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage;
- InternalWinderCfg.diameter = request->diameter;
-
- return status;
-}
-
//********************************************************************************************************************
uint32_t MotorsConfigMessage(HardwareMotor * request)
{