diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-13 18:09:45 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-13 18:09:45 +0300 |
| commit | 3f6a1cf39932b49de12bdb996786d51bbc9e38d4 (patch) | |
| tree | 824fb080bfc764519867662f673bd664127d60e3 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | fe3e2ab49445060253492fcd8226378382331178 (diff) | |
| parent | 2f510ce9b99796ac95510980b9b8e8ea6ca57591 (diff) | |
| download | Tango-3f6a1cf39932b49de12bdb996786d51bbc9e38d4.tar.gz Tango-3f6a1cf39932b49de12bdb996786d51bbc9e38d4.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
4 files changed, 19 insertions, 12 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 7690b131f..0bda4964b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -15,6 +15,7 @@ #include "drivers/Motors/Motor.h" #include "drivers/Danser_SSI/ssi_comm.h" +#include "thread_ex.h" typedef struct { @@ -37,6 +38,7 @@ typedef enum threadMotorsEnum SCREW_MOTOR, MAX_THREAD_MOTORS_NUM }threadMotorsEnum; + #define MAX_THREAD_FEED_MOTORS WINDER_MOTOR+1 #define MAX_SYSTEM_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1 diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 5f49c7d10..3fb78d2f0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -1,6 +1,15 @@ #ifndef MODULES_THREAD_THREAD_EX_H_ #define MODULES_THREAD_THREAD_EX_H_ + +typedef enum +{ + WINDER_DANCER, + POOLER_DANCER, + FEEDER_DANCER, + NUM_OF_DANCERS +} DANCER_ENUM; + uint32_t ThreadPrepareState(void *JobDetails); uint32_t ThreadPreSegmentState(void *JobDetails); uint32_t ThreadSegmentState(void *JobDetails, int SegmentId); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 5a8c3df76..0e276fe92 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -51,7 +51,6 @@ uint32_t MotorsConfigMessage(HardwareMotor * request) { uint32_t status = PASSED; TimerMotors_t Motor_i; - MotorDriverConfigStruc MotorDriverConfig; Motor_i = request->hardwaremotortype; /*for (i=0;i<MAX_THREAD_MOTORS_NUM;i++) { @@ -69,15 +68,8 @@ uint32_t MotorsConfigMessage(HardwareMotor * request) //if (Motor_i< MAX_THREAD_MOTORS_NUM) //{ memcpy (&MotorsCfg[Motor_i],request,sizeof(HardwareMotor)); - MotorDriverConfig.ACC = MotorsCfg[Motor_i].maxchangeslope; - MotorDriverConfig.DEC = MotorsCfg[Motor_i].maxchangeslope; - MotorDriverConfig.MaxSpeed = MotorsCfg[Motor_i].maxfrequency; - MotorDriverConfig.HasMicroStep = MotorsCfg[Motor_i].has_microstep; - MotorDriverConfig.Microstep = MotorsCfg[Motor_i].microstep; - MotorDriverConfig.HasConfigWord = MotorsCfg[Motor_i].has_configword; - MotorDriverConfig.ConfigWord = MotorsCfg[Motor_i].configword; - status = MotorConfig( Motor_i, &MotorDriverConfig); + status = MotorConfig( Motor_i, &MotorsCfg[Motor_i]); // if (Motor_i == MOTOR_RDRIVING) // ThreadInitialTestStub(request); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 0e68a6406..92939dfe4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -216,7 +216,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) avreageSampleValue += MotorSamples[index][i]; avreageSampleValue = avreageSampleValue / MotorsControl[index].pvinputfilterfactormode; NormalizedError = avreageSampleValue*NormalizedErrorCoEfficient[index]; -if (index != 0) return OK; MotorControlConfig[index].m_mesuredParam = NormalizedError; MotorControlConfig[index].m_calculatedError = PIDAlgorithmCalculation((float)MotorControlConfig[index].m_SetParam , (float)MotorControlConfig[index].m_mesuredParam, &MotorControlConfig[index].m_params, &MotorControlConfig[index].m_preError, &MotorControlConfig[index].m_integral); @@ -282,7 +281,7 @@ bool InitialProcess = false; MotorSetDirection((TimerMotors_t)HW_Motor_Id,MotorsCfg[HW_Motor_Id].directionthreadwize); #ifdef DEBUG_TEST_FUNCTIONS - +/* if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled ControlIdtoMotorId[Motor_i] = AddControlCallback(ThreadLengthCBFunction, eOneMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i); if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled @@ -316,7 +315,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails) int process_speed = JobTicket->processparameters->dyeingspeed; - process_speed = 10; //debug + process_speed = 50; //debug for (Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++) { @@ -329,6 +328,11 @@ uint32_t ThreadPreSegmentState(void *JobDetails) //ControlStart(); // set the new speed in the dryer motor to the speed of the new segment MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR], MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].microstep); + //only for testing - when control works, these motors will take their speed from the dryer + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING, OriginalMotorSpd_2PPS[POOLER_MOTOR], MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].microstep); + //only for testing - when control works, these motors will take their speed from the dryer + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, OriginalMotorSpd_2PPS[FEEDER_MOTOR], MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].microstep); + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1, 1); MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1,1); |
