aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-08-28 18:33:50 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-08-28 18:33:50 +0300
commit33a2d098936cad4e7a8ca0c16187023a78fc4e43 (patch)
treecb53af6d0fb6c94ba7037db4d2e74c716a18b550 /Software/Embedded_SW/Embedded/Modules
parentfe589d0e841bf3a6d7c3206a7e48c8e7ae9a91a8 (diff)
parent75e08ffe9aaeeca4b110a7f0a6bd6e47eb79a943 (diff)
downloadTango-33a2d098936cad4e7a8ca0c16187023a78fc4e43.tar.gz
Tango-33a2d098936cad4e7a8ca0c16187023a78fc4e43.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c18
3 files changed, 18 insertions, 6 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 9f515062d..2c9467b51 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -72,7 +72,7 @@ typedef struct MillisecMessage{
//uint32_t MotorPosition_Data[NUM_OF_MOTORS] = {0};
//bool MotorBusy_Data[NUM_OF_MOTORS] = {true};
uint32_t Dancer_Data[NUM_OF_DANCERS] = {0};
-uint32_t Speed_Data = 0;
+float Speed_Data = 0;
bool watchdogCriticalAlarm = false;
@@ -454,7 +454,7 @@ void MillisecTask(UArg arg0, UArg arg1)
assert (DeviceId < MAX_ADC_DEVICES);
return ADC_Data[DeviceId];
}*/
-uint32_t getSensorSpeedData(void)
+float getSensorSpeedData(void)
{
return Speed_Data;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h
index 77c3a5ef8..f2f7e7e77 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h
@@ -27,7 +27,7 @@ uint32_t getMotorSpeedData(int MotorId);
uint32_t getTemperatureSensorData(int SensorId);
uint32_t getADCData(int DeviceId);
*/
-uint32_t getSensorSpeedData(void);
+float getSensorSpeedData(void);
void MillisecInit(void);
void MillisecStop(void);
void MillisecStart(void);
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);