diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-03-29 15:46:42 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-03-29 15:46:42 +0300 |
| commit | fd16e827fd4d59636798c4cd4a7ebd00c3cb146f (patch) | |
| tree | e284c218e6c4bfbede448fb18e6c5e598c44ceaf /Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | |
| parent | 08bd4400dfd45245ae301b5cb28103322ddf865a (diff) | |
| download | Tango-fd16e827fd4d59636798c4cd4a7ebd00c3cb146f.tar.gz Tango-fd16e827fd4d59636798c4cd4a7ebd00c3cb146f.zip | |
State machine handling
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 5f14a17a7..e850ad776 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -10,6 +10,8 @@ #include "../control/pidalgo.h" #include "PMR/Hardware/HardwareMotor.pb-c.h" #include "PMR/Hardware/HardwareMotorType.pb-c.h" +#include "PMR/Printing/JobSegment.pb-c.h" +#include "PMR/Printing/JobTicket.pb-c.h" #include "drivers/Motors/Motor.h" #include "drivers/Danser_SSI/ssi_comm.h" @@ -126,10 +128,11 @@ uint32_t ThreadControlCBFunction(uint32_t deviceID, uint32_t ReadValue) uint32_t Debug_Get_Dancer_Read(uint32_t DancerId, uint32_t Parameter1, uint32_t Parameter2) { + return (rand() % (103 + 1 + 103) - 103); } #endif //******************************************************************************************************************** - ReturnCode PrepareState(void *JobDetails) + uint32_t ThreadPrepareState(void *JobDetails) { int Motor_i; //start thread control for all motors @@ -161,7 +164,7 @@ uint32_t Debug_Get_Dancer_Read(uint32_t DancerId, uint32_t Parameter1, uint32_t AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Read_Dancer_Position,ThreadMotorIdToDancerId[Motor_i],0); #endif } - + Winder_Prepare(); //set 3 dancers to the profile positions return OK; } @@ -169,13 +172,14 @@ uint32_t Debug_Get_Dancer_Read(uint32_t DancerId, uint32_t Parameter1, uint32_t //******************************************************************************************************************** ReturnCode PreSegmentState(void *JobDetails) { +//set the speed only before the first segment, speed is constant accros job + JobTicket* JobTicket = JobDetails; + int process_speed = JobTicket->processparameters->dyeingspeed; + int dryer_speed = process_speed * MotorsCfg[DRYER_MOTOR].ratio2dryerspeed; //set dryer_speed_translation_here - TimerMotors_t Motor_i; - for (Motor_i = 0;Motor_i < MAX_THREAD_MOTORS_NUM;Motor_i++) - { - MotorControlConfig[Motor_i].m_SetParam = MotorGetSpeed(getMotorId(Motor_i));//need to update SetParams on presegment stage - } // set the new speed in the dryer motor to the speed of the new segment + MotorSetSpeed(MOTOR_DRYER_DRIVING, process_speed, MotorsCfg[DRYER_MOTOR].minmicrostep); + // activate control fr all motors //set speed for both rocker motors //wait for all motors to get to the required speed (set the target speed for the control to check) |
