aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-27 11:47:54 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-27 11:47:54 +0300
commit1a4b7ffc38700febd09aa6a70c7f37d36f903ddb (patch)
treedc3e1e19499e90cdd7b0c9d82e76e73853ebcdd4 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
parentffcb06ec20597465cdbe62040bacfb4bfc7d5de0 (diff)
downloadTango-1a4b7ffc38700febd09aa6a70c7f37d36f903ddb.tar.gz
Tango-1a4b7ffc38700febd09aa6a70c7f37d36f903ddb.zip
drop ghost busy calls - trial
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 92fd9549e..f97082365 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -73,7 +73,7 @@ uint32_t Winder_Prepare(void)
//JobTicket* JobTicket = JobDetails;
//float process_speed = JobTicket->processparameters->dyeingspeed;
- double ScrewSpeed = 500;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now
+ 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");
/*
* 1. move home to the limit switch (check that the cart is clear from the limit switch, start moving, with acceleration to maximal speed. enable interrupt on the limit switch, upon interrupt stop.
@@ -203,19 +203,30 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction)
return NumberOfSteps;
}
+uint32_t wtick=0,prevwtick = 0;
+uint32_t wgap[100];
+uint32_t wgap_counter=0;
uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
uint32_t Steps;
-
-
if (BusyfirstCall)
{
BusyfirstCall = false;
return OK;
}
+ wtick++;
//ScrewCurrentDirection: false moves out, true moves home
if (BusyFlag == NOTBUSY)
{
+ if (wtick-prevwtick>10)
+ {
+ wgap[wgap_counter++] = wtick-prevwtick;
+ prevwtick = wtick;
+ if (wgap_counter >=99)
+ wgap_counter = 0;
+ }
+ else
+ return;
CalculateNumberOfSteps (DirectionChangeCounter++, ScrewCurrentDirection);
Steps = ScrewNumberOfSteps;
if (ScrewCurrentDirection == false)
@@ -298,6 +309,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId)
// * 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;
MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back.
+ wtick = 0;prevwtick = 0;
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_horizontal_speed,WinderPresegmentReady);