aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-10-03 12:13:36 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-10-03 12:13:36 +0300
commit0f546e28ff310f93da65ec6a8e7fd53ae19c0988 (patch)
treea2cdb47560d97a45ac7021321cc054725bdad97e /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parent48c38d2f1c5b21cd0fc58eae781fe3c470a66cf5 (diff)
downloadTango-0f546e28ff310f93da65ec6a8e7fd53ae19c0988.tar.gz
Tango-0f546e28ff310f93da65ec6a8e7fd53ae19c0988.zip
mostly stubs unification
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 1b32e50fd..4b381e401 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -22,7 +22,7 @@
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
bool Winder_ScrewHoming = false;
-bool Winder_Active = false;
+//bool Winder_Active = false;
uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag);
uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue);
@@ -73,7 +73,7 @@ uint32_t Winder_Prepare(void)
{
uint32_t status = 0;
//JobTicket* JobTicket = JobDetails;
- Winder_Active = true;
+// Winder_Active = true;
//float process_speed = JobTicket->processparameters->dyeingspeed;
double ScrewSpeed = 1000;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now
//REPORT_MSG(ScrewSpeed, "Winder_Prepare");
@@ -89,6 +89,7 @@ uint32_t Winder_Prepare(void)
}
else
{
+ REPORT_MSG(ScrewSpeed, "Winder_Prepare");
Winder_ScrewHoming = true;
//REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, "Winder_Prepare move to limit");
status = MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2);
@@ -108,6 +109,7 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue)
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency);
//REPORT_MSG(numOfSteps, "Winder_PrepareStage2");
+ REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency, "Winder_PrepareStage2");
status |= MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_SCREW, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize),numOfSteps, Winder_ScrewAtOffsetCallback);
//set motor location 0 here
@@ -125,7 +127,7 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag)
ScrewControlId = 0xFF;
ScrewNumberOfSteps = 0;
DirectionChangeCounter = 0;
- //REPORT_MSG(BusyFlag, "Winder_ScrewAtOffsetCallback");
+ REPORT_MSG(BusyFlag, "Winder_ScrewAtOffsetCallback");
PrepareReady(Module_Winder, ModuleDone);
return OK;
@@ -188,6 +190,7 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
ScrewSpeed = screw_horizontal_speed*RotationsPerSecond;
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed);
+ REPORT_MSG(ScrewSpeed, "CalculateNumberOfSteps");
CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed;
}
@@ -208,6 +211,7 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
uint32_t wtick=0,prevwtick = 0;
uint32_t wgap[100];
uint32_t wgap_counter=0;
+extern void ScrewReq(void);
uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
uint32_t Steps;
@@ -216,12 +220,14 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
BusyfirstCall = false;
return OK;
}
- if (Winder_Active == false)
- return OK;
+// if (Winder_Active == false)
+// return OK;
wtick++;
//ScrewCurrentDirection: false moves out, true moves home
if (BusyFlag == NOTBUSY)
{
+ ScrewReq();
+
if (wtick-prevwtick>10)
{
wgap[wgap_counter++] = wtick-prevwtick;
@@ -254,6 +260,7 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
}
*/
MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,Steps); //process: set point 0, set max speed, move to the specified length, return back.
+ REPORT_MSG(ScrewCurrentDirection, "ScrewDirectionChange");
}
/*
* calculate new ScrewSpeed and call MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed);
@@ -329,7 +336,7 @@ uint32_t Winder_End(void)
int pend;
//stop screw
ScrewNumberOfSteps = 0;
- Winder_Active = false;
+// Winder_Active = false;
if (ScrewControlId != 0xFF)
RemoveControlCallback(ScrewControlId,ScrewDirectionChange);
CurrentControlledSpeed[SCREW_MOTOR] = 0;