diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-02-17 17:25:52 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-02-17 17:25:52 +0200 |
| commit | 638ef66200cc71378f00e2705dc6b259c461ae78 (patch) | |
| tree | f8143befd029c56599f4f892427713960e99c50b /Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c | |
| parent | e89e1d93b6c8198828a6bda95db0bbd6cbae3955 (diff) | |
| parent | 21cdc1e12814f72e6aac795f9ddd2a32b9614389 (diff) | |
| download | Tango-638ef66200cc71378f00e2705dc6b259c461ae78.tar.gz Tango-638ef66200cc71378f00e2705dc6b259c461ae78.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 53bac3004..edfa3b0b9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -85,7 +85,7 @@ FRESULT Fresult = FR_OK; REPORT_MSG(LoadStages, "Thread Load State Machine step"); - LoadArmInfo.LoadArmBackLash = 0; + LoadArmInfo.LoadArmBackLash = 40; LoadArmInfo.LoadArmRounds = 0xFF; Fresult = f_mkdir(SW_INFO_DIR); if ((Fresult == FR_OK)||(Fresult == FR_EXIST)) @@ -103,14 +103,15 @@ memcpy (&ProcessParametersRecover,&ProcessParametersKeep,sizeof(ProcessParameters)); //NumberOfDrierLoaderCycles = loadLoadArmParameters(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Reduce_Heat(void) { + //Heaters Off, Dryer Blower Off, Blower Low, - REPORT_MSG(LoadStages, "Thread Load State Machine step"); + REPORT_MSG(LoadStages, "Thread Load State Machine step "); memcpy (&ProcessParametersClear,&ProcessParametersKeep,sizeof(ProcessParameters)); ProcessParametersClear.dryerzone1temp = 0; ProcessParametersClear.dryerzone2temp = 0; @@ -131,40 +132,43 @@ { Turn_the_Blower_On();//Turn on with the Default_Voltage if (BlowerCfg.heatingvoltage) - Cancel_Gradual_Increase_Blower(BlowerCfg.heatingvoltage); + Control_Voltage_To_Blower(BlowerCfg.heatingvoltage); else - Cancel_Gradual_Increase_Blower(BlowerCfg.voltage-500); + Control_Voltage_To_Blower(BlowerCfg.voltage-500); Control_Dryer_Fan(STOP,75);//use START or STOP, 0 - 100% LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } return OK; } uint32_t Thread_Load_Set_Load_Arm_To_Start_Position_Callback(uint32_t deviceID, uint32_t BusyFlag) { - REPORT_MSG(LoadStages, "Thread Load State Machine Callback"); + // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); NumberOfDrierLoaderCycles--; if (NumberOfDrierLoaderCycles) { + Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); status |= MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround, Thread_Load_Set_Load_Arm_To_Start_Position_Callback,1000); } else { + Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); //storeLoadArmParameters(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } return OK; } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { - REPORT_MSG(LoadStages, "Thread Load State Machine Callback"); +// Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); NumberOfDrierLoaderCycles=0; //storeLoadArmParameters(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Set_Load_Arm_To_Start_Position(void) @@ -172,14 +176,16 @@ REPORT_MSG(LoadStages, "Thread Load State Machine step"); if (LoadArmInfo.LoadArmRounds != 0xFF) { + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); NumberOfDrierLoaderCycles = LoadArmInfo.LoadArmRounds; status |= MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds, Thread_Load_Set_Load_Arm_To_Start_Position_Callback,1000); } else //number of circles is not known - compare to position of the motor to verify location at the stopper { + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/10, Thread_Load_Set_Load_Arm_To_Start_Position_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); } //Use Notation How Many Rotations In The Drier, Or Check Against Stopper. Move Slowly @@ -188,7 +194,7 @@ uint8_t CallbackCounter = 0; uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue) { - REPORT_MSG(LoadStages, "Thread Load State Machine Callback"); + Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id"); if(ControlId != 0xFF) { @@ -201,7 +207,7 @@ if (CallbackCounter == 0) { LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } } else @@ -235,7 +241,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 200, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 20, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000); CallbackCounter++; MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].directionthreadwize, 200, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2], Thread_Load_HomingCallback,10000); @@ -315,7 +321,7 @@ { Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100% LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } return OK; } @@ -350,7 +356,7 @@ ControlId = 0xFF; ThreadAbortJoggingFunc(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Jog_Thread(void) @@ -509,14 +515,15 @@ void ThreadLoadRequest(MessageContainer* requestContainer) container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); - int LoadStages = (int)request->dryerzone1temp; - ThreadLoadStateMachine(LoadStages); + int LoadStage = (int)request->dryerzone1temp; + LoadStages = LoadStage; + ThreadLoadStateMachine(LoadStage); - //if (status) + /*if (status) { responseContainer.has_error = true; responseContainer.error = ERROR_CODE__JOB_UNSPECIFIED_ERROR; - } + }*/ size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); //USBCDCD_sendData(container_buffer, container_size,10); @@ -543,11 +550,11 @@ void ThreadLoadPollRequest(MessageContainer* requestContainer) container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); - +/* { responseContainer.has_error = true; responseContainer.error = ERROR_CODE__JOB_UNSPECIFIED_ERROR; - } + }*/ size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); SendChars(container_buffer, container_size); |
