aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-28 11:51:22 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-28 11:51:22 +0300
commit75e08ffe9aaeeca4b110a7f0a6bd6e47eb79a943 (patch)
tree5edb9bc98d20157d72653b52fa27959a253aaa4a /Software/Embedded_SW/Embedded/Modules/Thread
parent3cd74352adfc311bec6239b93e4c5ebebaf49ead (diff)
parent78e65c6b968c0b7c6958ccebfc8d406147ed1c62 (diff)
downloadTango-75e08ffe9aaeeca4b110a7f0a6bd6e47eb79a943.tar.gz
Tango-75e08ffe9aaeeca4b110a7f0a6bd6e47eb79a943.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
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);