diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-02-20 11:39:04 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-02-20 11:39:04 +0200 |
| commit | 57a828b4d11ab8274053ee035c8de8014ddd4ca1 (patch) | |
| tree | c88e63b5e9019fe67cc3be451e46fbe57efc4a35 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 2d55102532afaccc447c8a28ded8ccb93437683b (diff) | |
| parent | d6e2772dd98e6880de14ea12be0ef53bae24f763 (diff) | |
| download | Tango-57a828b4d11ab8274053ee035c8de8014ddd4ca1.tar.gz Tango-57a828b4d11ab8274053ee035c8de8014ddd4ca1.zip | |
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
3 files changed, 57 insertions, 33 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index bac3ba1d0..128564586 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -31,7 +31,7 @@ #include "drivers/SSI_Comm/Dancer/Dancer.h" #include "drivers/motors/motor.h" #include "drivers/Flash_ram/MCU_E2Prom.h" - +#include "Drivers/I2C_Communication/I2C.h" #include "PMR/Stubs/StubHeatingTestRequest.pb-c.h" #include "PMR/Stubs/StubHeatingTestResponse.pb-c.h" #include "PMR/Stubs/StubHeatingTestPollRequest.pb-c.h" @@ -180,6 +180,14 @@ ProcessParametersClear.headzone4temp = 0; ProcessParametersClear.headzone5temp = 0; ProcessParametersClear.headzone6temp = 0; + ProcessParametersClear.headzone7temp = 0; + ProcessParametersClear.headzone8temp = 0; + ProcessParametersClear.headzone9temp = 0; + ProcessParametersClear.headzone10temp = 0; + ProcessParametersClear.headzone11temp = 0; + ProcessParametersClear.headzone12temp = 0; + ProcessParametersClear.stspzone1temp = 0; + ProcessParametersClear.stspzone2temp = 0; ProcessParametersClear.dyeingspeed = 40; ProcessParametersClear.dryerbufferlength = ProcessParametersKeep.dryerbufferlength; if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) @@ -191,6 +199,7 @@ } else { + //WHS_Start_Blower_Control_Closed_Loop(2.5); Turn_the_Blower_On();//Turn on with the Default_Voltage if (BlowerCfg.heatingvoltage) Control_Voltage_To_Blower(BlowerCfg.heatingvoltage); @@ -401,9 +410,7 @@ CallbackCounter++; //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID].directionthreadwize, 200, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID], Thread_Load_HomingCallback,10000); MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID, 0, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID], Thread_Load_HomingCallback,10000); -#ifdef Use_Head_Card - HeadCard_Actuators_Control(ACTOT, LOW,true); -#endif + Trigger_Head_Actuators_Control(ACTOT, LOW,true); return OK; } uint32_t Thread_Load_Lift_Dancers(void) @@ -511,9 +518,7 @@ CallbackCounter++; // MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID].directionthreadwize, 200, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID], Thread_Load_HomingCallback,10000); MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID, 2, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID], Thread_Load_HomingCallback,10000); -#ifdef Use_Head_Card - HeadCard_Actuators_Control(ACTOT, LOW,false); -#endif + Trigger_Head_Actuators_Control(ACTOT, LOW,false); return OK; } uint32_t Thread_Load_Resume_Heating(void) @@ -538,7 +543,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 100, FEEDER_DANCER ,true, Thread_Load_Jog_Feeder_To_Middle_Point_Callback,4000); + MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 400, FEEDER_DANCER ,true, Thread_Load_Jog_Feeder_To_Middle_Point_Callback,4000); return OK; } @@ -1360,6 +1365,7 @@ uint32_t ThreadLoadingReport(void) //------------------------------------------------------------------------------------------- responseContainer = createContainer(MESSAGE_TYPE__StartThreadLoadingResponse, ThreadLoadingToken, last, &response, &start_thread_loading_response__pack, &start_thread_loading_response__get_packed_size); + responseContainer.has_continuous = true; responseContainer.continuous = true; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); @@ -1416,6 +1422,7 @@ uint32_t StopThreadLoadingFunc(MessageContainer* requestContainer) MessageContainer responseContainer; MessageState = 2; Thread_Load_End(); + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles); Report("StopThreadLoadingFunc",__FILE__,__LINE__,0xFF,RpWarning,(int)LoadStages,0); responseContainer = createContainer(MESSAGE_TYPE__StopThreadLoadingResponse, requestContainer->token, true, &Cresponse, &stop_thread_loading_response__pack, &stop_thread_loading_response__get_packed_size); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 420b782b5..114edc0cd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -38,6 +38,8 @@ uint32_t ThreadDistanceToSpoolState(void); uint32_t ThreadEndState(); uint32_t ThreadInitialTestStub(); +bool Set_Thread_Rockers_Bypass (int value); + uint32_t StoreDancerConfigMessage(void); uint32_t LoadDancerConfigMessage(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 2484b9444..1dd101f82 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -28,6 +28,7 @@ #include "drivers/Heater/Heater.h" #include "drivers/Motors/Motor.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" +#include "drivers/FPGA/FPGA_SPI_Comm.h" #include "modules/heaters/heaters.h" #include "modules/General/process.h" #include "modules/ids/ids_ex.h" @@ -117,8 +118,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea if (Current_Read < Previous_Read) { - ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0); Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1; + ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,Time_Pass,(int)Current_Read,RpWarning,(int)Previous_Read,0); } else Time_Pass = Current_Read - Previous_Read; @@ -178,7 +179,10 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) initialpos = 0; } prevprev = PreviousPosition; - positionDiff = Control_Delta_Position_Pass(CurrentPosition,PreviousPosition); + if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction + positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition); + else + positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; PreviousPosition = CurrentPosition; @@ -268,7 +272,10 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) Poolerinitialpos = 0; } prevprev = PoolerPreviousPosition; - positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); + if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction + positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition); + else + positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; PoolerPreviousPosition = PoolerCurrentPosition; @@ -300,12 +307,7 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) { if (PrepareState == true) { -//#ifdef Use_Head_Card -// strcpy(Lenstr,"Heating up"); -//#else - //later - add temperatures - TemperatureListString(Lenstr); -//#endif + TemperatureListString(Lenstr); SendJobProgress(0.0,0,false, Lenstr); } else @@ -505,6 +507,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { //pooler dancer is right sided: data is opposite TranslatedReadValue = (-1*TranslatedReadValue); + } + if (index == POOLER_MOTOR) + { + //pooler dancer is right sided: data is opposite JobCounter++; } //TranslatedReadValue = 0;//test @@ -911,7 +917,7 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) void SetOriginMotorSpeed(float process_speed) { - int i,Motor_i, HW_Motor_Id; + int Motor_i, HW_Motor_Id; for (Motor_i = 0; Motor_i <= WINDER_MOTOR; Motor_i++) { HW_Motor_Id = ThreadMotorIdToMotorId[Motor_i]; @@ -959,6 +965,15 @@ uint32_t ThreadDryerRampUp(uint32_t IfIndex, uint32_t BusyFlag) return OK; } +bool Thread_Rockers_Bypass = false; +bool Set_Thread_Rockers_Bypass (int value) +{ + if (value == 0) + Thread_Rockers_Bypass = false; + else + Thread_Rockers_Bypass = true; + return Thread_Rockers_Bypass; +} //******************************************************************************************************************** uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId) @@ -996,17 +1011,19 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId) #ifdef HUNDRED_MICROSECONDS_DANCER_READ MillisecLogInit(); #endif - - if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0) - { - MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize); - MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1); - } - if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].maxfrequency > 0) - { - MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize); - MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); - } + if (Thread_Rockers_Bypass == false) + { + if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].maxfrequency > 0) + { + MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize); + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1); + } + if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].maxfrequency > 0) + { + MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize); + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); + } + } if (EnableLubrication == true) { IDS_StartLubrication(); @@ -1109,7 +1126,7 @@ char Endstr[150]; { int Motor_i; ThreadControlActive = false; - uint32_t status = OK,tempCtl; + uint32_t status = OK; usnprintf(Endstr, 100, "Total _processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); SendJobProgress(0.0,0,false, Endstr); ReportWithPackageFilter(ThreadFilter,Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); @@ -1123,7 +1140,7 @@ char Endstr[150]; if (SpeedControlId != 0xFF) { if(RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction)!=OK) - ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)Motor_i,RpError,(int)SpeedControlId,0); + ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)ThreadLengthCBFunction,RpError,(int)SpeedControlId,0); SpeedControlId = 0xFF; } if (PoolerSpeedControlId != 0xFF) @@ -1135,7 +1152,6 @@ char Endstr[150]; for ( Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++) { - tempCtl = ControlIdtoMotorId[Motor_i]; if (ControlIdtoMotorId[Motor_i] != 0xFF) { status = RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction); @@ -1144,7 +1160,6 @@ char Endstr[150]; else ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)Motor_i,RpError,(int)ControlIdtoMotorId[Motor_i],0); } - //ReportWithPackageFilter(ThreadFilter,"Remove Control",__FILE__,Motor_i,(int)status,RpError,(int)tempCtl,0); } Task_sleep(100); |
