diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-07-24 15:05:40 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-07-24 15:05:40 +0300 |
| commit | fd81643e32328a0d548c7cebdba008050ae03673 (patch) | |
| tree | 852fd07c35c800cc21de995a767805c033c37658 /Software/Embedded_SW/Embedded/Modules/Thread | |
| parent | 07e200a598d01c7bb5a2b82dfdb3b99cf24f76e9 (diff) | |
| parent | 1a4e2e8a731c7d4c6150de73b36b7c40d6422cd7 (diff) | |
| download | Tango-fd81643e32328a0d548c7cebdba008050ae03673.tar.gz Tango-fd81643e32328a0d548c7cebdba008050ae03673.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
5 files changed, 126 insertions, 40 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index e927ae436..56fb79c23 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -78,6 +78,8 @@ uint32_t MotorsConfigMessage( HardwareConfiguration* HW_request); uint32_t InternalWindingConfigMessage(JobSpool* request); uint32_t ThreadInitialTestStub(HardwareMotor * request); uint32_t MotorPidRequestMessage(HardwarePidControl* request); +void SetKeepWindingCone(bool value); +void SetWinderBackToBaseTime(uint32_t value); uint32_t DancerConfigMessage(HardwareDancer * request); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 9ef7f3d0d..837221274 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -59,7 +59,7 @@ ProcessParameters ProcessParametersClear,ProcessParametersRecover; uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; - uint32_t ControlId = 0xFF; + uint32_t ControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM LoadStages); uint32_t ThreadLoadControlCBFunction(uint32_t index, uint32_t ReadValue); uint32_t Thread_Load_Dryer_UnLoading(void); @@ -146,7 +146,7 @@ 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; } @@ -167,12 +167,30 @@ //storeLoadArmParameters(); SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); } return OK; } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { + if(PullerControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); + RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction ); + PullerControlId = 0xFF; + } + if(WinderControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz); + RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction ); + WinderControlId = 0xFF; + } + /*Task_sleep(5) + MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz); + MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);*/ + + MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz); + // 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; @@ -180,7 +198,7 @@ LoadStages++; SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Set_Load_Arm_To_Start_Position(void) @@ -240,7 +258,7 @@ } if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call { - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); } } } @@ -361,7 +379,7 @@ { Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100% LoadStages++; - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); } return OK; } @@ -374,17 +392,9 @@ return OK; } - uint32_t Thread_Load_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue) + uint32_t Thread_Load_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint32_t ReadValue) { - Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); - REPORT_MSG(MotorId, "Thread_Load_Dryer_Loading_Callback Motor Id"); - MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,0,0); - if(ControlId != 0xFF) - { - MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz); - RemoveControlCallback(ControlId, ThreadLoadControlCBFunction ); - ControlId = 0xFF; - } + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200); if (CallbackCounter) { CallbackCounter--; @@ -393,12 +403,25 @@ LoadStages++; if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call { - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); } } } else LOG_ERROR(MotorId, "Thread_Load_HomingCallback Callback is already 0"); + + } + uint32_t Thread_Load_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue) + { + Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + if(ControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz); + RemoveControlCallback(ControlId, ThreadLoadControlCBFunction ); + ControlId = 0xFF; + } + //REPORT_MSG(MotorId, "Thread_Load_Dryer_Loading_Callback Motor Id"); + MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,10000); return OK; } @@ -413,6 +436,7 @@ // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius; + Report("Thread Load State Machine step.",__FILE__,LoadStages,numberOfSteps,RpMessage,(int)(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius),0); MotorControlConfig[FEEDER_MOTOR].m_params.MAX = 1; MotorControlConfig[FEEDER_MOTOR].m_params.MIN = MotorsControl[FEEDER_MOTOR].outputproportionalpowerlimit*-1; MotorControlConfig[FEEDER_MOTOR].m_params.Kd = MotorsControl[FEEDER_MOTOR].derivativetime; @@ -432,6 +456,8 @@ MotorControlConfig[FEEDER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize); + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4); + ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+FEEDER_MOTOR),FEEDER_DANCER,FEEDER_MOTOR); CallbackCounter++; MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, @@ -450,7 +476,7 @@ ControlId = 0xFF; ThreadAbortJoggingFunc(); LoadStages++; - //ThreadLoadStateMachine(LoadStages); + ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Jog_Thread(void) @@ -472,7 +498,7 @@ LoadArmInfo.LoadArmRounds = 0; uint32_t numberOfSteps = 0; //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 - SetOriginMotorSpeed(20); + SetOriginMotorSpeed(19); // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; @@ -496,7 +522,7 @@ MotorControlConfig[POOLER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize); - ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),FEEDER_DANCER,POOLER_MOTOR); + PullerControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),POOLER_DANCER,POOLER_MOTOR); //////////////////////// MotorControlConfig[WINDER_MOTOR].m_params.MAX = 1; MotorControlConfig[WINDER_MOTOR].m_params.MIN = MotorsControl[WINDER_MOTOR].outputproportionalpowerlimit*-1; @@ -515,18 +541,20 @@ MotorControlConfig[WINDER_MOTOR].m_mesuredParam = 0; MotorControlConfig[WINDER_MOTOR].m_preError = 0; MotorControlConfig[WINDER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage - MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize); + MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_WINDER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].directionthreadwize); - ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),FEEDER_DANCER,WINDER_MOTOR); + WinderControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),WINDER_DANCER,WINDER_MOTOR); //////////////////////// + MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].directionthreadwize); + MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]); CallbackCounter++; //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); 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/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; @@ -603,6 +631,7 @@ Thread_Load_Jog_Thread(); break; case THREAD_LOAD_END: + LoadStages = THREAD_LOAD_END; Thread_Load_End(); break; default: @@ -623,7 +652,14 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) uint32_t calculated_speed; double NormalizedError; - DancerId = FEEDER_DANCER;//ThreadMotorIdToDancerId[index]; + if (IfIndex>>8 != IfTypeThread) + { + LOG_ERROR (IfIndex, "Wrong Interface type"); + return 0xFFFFFFFF; + } + index = IfIndex&0xFF; + + DancerId = ThreadMotorIdToDancerId[index]; if (ReadValue < 10) { Report("Dancer value read too small.",__FILE__,__LINE__,DancerId,RpError,ReadValue,0); @@ -634,12 +670,6 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) return OK; } TranslatedReadValue = ReadValue - DancersCfg[DancerId].zeropoint; - if (IfIndex>>8 != IfTypeThread) - { - LOG_ERROR (IfIndex, "Wrong Interface type"); - return 0xFFFFFFFF; - } - index = IfIndex&0xFF; if (index == POOLER_MOTOR) { //pooler dancer is right sided: data is opposite diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 8943e5d30..510168ab8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -54,6 +54,10 @@ uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the bool SCREW_TimerActivated = false; uint32_t ScrewControlId = 0xFF; +static bool KeepWindingCone = false; +static uint32_t WindingConeLocation; +static uint32_t WinderBackToBaseTime = 800; + InternalWinderConfigStruc InternalWinderCfg = {0}; uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; @@ -65,7 +69,17 @@ uint32_t Winder_Init(void) ScrewTimerInterruptInit(); return OK; } +void SetKeepWindingCone(bool value) +{ + KeepWindingCone = value; + ReportWithPackageFilter(ThreadFilter,"set KeepWindingCone",__FILE__,__LINE__,WindingConeLocation,RpWarning,KeepWindingCone, 0); +} +void SetWinderBackToBaseTime(uint32_t value) +{ + WinderBackToBaseTime = value; + ReportWithPackageFilter(ThreadFilter,"Set WinderBackToBaseTime",__FILE__,__LINE__,WinderBackToBaseTime,RpWarning,KeepWindingCone, 0); +} uint32_t InternalWinderConfigMessage(HardwareWinder* request) { @@ -120,6 +134,15 @@ uint32_t Winder_Prepare(void *JobDetails) ScrewLocationRun[0] = 0; ScrewLocationRun[1] = 0; + if (( KeepWindingCone == false)||(WindingConeLocation == 0)) + { + WindingConeLocation = InternalWinderCfg.startoffsetpulses; + ReportWithPackageFilter(ThreadFilter,"WindingConeLocation set",__FILE__,__LINE__,WindingConeLocation,RpWarning,KeepWindingCone, 0); + } + else + { + ReportWithPackageFilter(ThreadFilter,"WindingConeLocation use previous",__FILE__,__LINE__,WindingConeLocation,RpWarning,KeepWindingCone, 0); + } if (JobTicket->has_samplewinding == true) { @@ -149,7 +172,7 @@ uint32_t Winder_Prepare(void *JobDetails) uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) { uint32_t status=OK; - uint32_t numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + uint32_t numOfSteps = WindingConeLocation*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); @@ -297,7 +320,8 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) { ScrewNumberOfSteps--; - Report("Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); + WindingConeLocation--; + ReportWithPackageFilter(ThreadFilter,"Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } else //next time going back @@ -504,7 +528,7 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) ScrewsStopControlTimer(); //move the cart to the edge so the spool can be easily replaced //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, 1000, GPI_LS_SCREW_RIGHT, NULL,0); - MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); + //MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,2000); return OK; @@ -514,7 +538,7 @@ uint32_t WinderDistanceToSpoolState(void ) double DTS_Time = ((dryerbufferlength*100)/dyeingspeed)*1000;//distance to spool time in milliseconds REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); - ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-800,TemplateDataReadCBFunction,0,0,0); + ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-WinderBackToBaseTime,TemplateDataReadCBFunction,0,0,0); REPORT_MSG ((int)msec_millisecondCounter,"ScrewDTSCallback start"); return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 78203b236..500ba9a39 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -19,6 +19,8 @@ #include "drivers/SSI_Comm/Dancer/Dancer.h" #include "drivers/Flash_ram/FlashProgram.h" +#include "drivers/Flash_ram/MCU_E2Prom.h" + #include "thread.h" MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS]={0}; HardwarePidControl MotorsControl[MAX_THREAD_MOTORS_NUM] = {0}; @@ -44,7 +46,6 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest) { uint32_t status = PASSED; TimerMotors_t Motor_i,MotorId; - MOTDRIVER_TYPE DriverType; HardwareMotor *request; if (HWrequest == NULL) return ERROR; @@ -163,6 +164,11 @@ uint32_t StoreDancerConfigMessage() DancerConfig.n_dancers++; DancersCfg[Dancer_i].zeropoint = DancerConfig.dancers[Dancer_i]->zeropoint; } + MCU_E2PromProgram(EEPROM_STORAGE_DANCER_0,DancersCfg[0].zeropoint); + MCU_E2PromProgram(EEPROM_STORAGE_DANCER_1,DancersCfg[1].zeropoint); + MCU_E2PromProgram(EEPROM_STORAGE_DANCER_2,DancersCfg[2].zeropoint); + Report("Store eeprom 0",__FILE__,DancersCfg[0].zeropoint,(int)DancersCfg[1].zeropoint,RpWarning,(int)DancersCfg[2].zeropoint,0); + response_buffer = my_malloc(hardware_configuration__get_packed_size(&DancerConfig)); if (response_buffer) { @@ -175,6 +181,7 @@ uint32_t StoreDancerConfigMessage() ReadAppAndProgram(DANCERS_MAP_IN_FLASH, sizeof(Dancers), Dancers); } + my_free(response_buffer); return Fresult; @@ -188,6 +195,7 @@ uint32_t LoadDancerConfigMessage() HardwareConfiguration *DancerConfig; int Dancer_i; HardwareDancer DancersCfg1[MAX_SYSTEM_DANCERS] = {0}; + HardwareDancer DancersCfg2[MAX_SYSTEM_DANCERS] = {0}; memcpy(DancersCfg1,(void *)DANCERS_MAP_IN_FLASH,sizeof(DancersCfg1)); @@ -197,16 +205,19 @@ uint32_t LoadDancerConfigMessage() DancerConfig = hardware_configuration__unpack(NULL, Bytes, buffer); for (Dancer_i = 0; Dancer_i < DancerConfig->n_dancers ; Dancer_i++) { - DancersCfg[Dancer_i].zeropoint = DancerConfig->dancers[Dancer_i]->zeropoint; + DancersCfg2[Dancer_i].zeropoint = DancerConfig->dancers[Dancer_i]->zeropoint; } hardware_configuration__free_unpacked(DancerConfig,NULL); free (buffer); } + MCU_E2PromRead(EEPROM_STORAGE_DANCER_0,&DancersCfg[0].zeropoint); + MCU_E2PromRead(EEPROM_STORAGE_DANCER_1,&DancersCfg[1].zeropoint); + MCU_E2PromRead(EEPROM_STORAGE_DANCER_2,&DancersCfg[2].zeropoint); + - if (DancersCfg[0].zeropoint != DancersCfg1[0].zeropoint) LOG_ERROR(DancersCfg[0].zeropoint,"DancersMismatch"); - else if (DancersCfg[1].zeropoint != DancersCfg1[1].zeropoint) LOG_ERROR(DancersCfg[1].zeropoint,"DancersMismatch"); - else if (DancersCfg[2].zeropoint != DancersCfg1[2].zeropoint) LOG_ERROR(DancersCfg[2].zeropoint,"DancersMismatch"); - else LOG_ERROR(DancersCfg[0].zeropoint,"Dancers Match!!"); + Report("Dancer 0 Store data flash, internal flash, eeprom ",__FILE__,DancersCfg[0].zeropoint,(int)DancersCfg1[0].zeropoint,RpWarning,(int)DancersCfg2[0].zeropoint,0); + Report("Dancer 1 Store data flash, internal flash, eeprom ",__FILE__,DancersCfg[1].zeropoint,(int)DancersCfg1[1].zeropoint,RpWarning,(int)DancersCfg2[1].zeropoint,0); + Report("Dancer 2 Store data flash, internal flash, eeprom ",__FILE__,DancersCfg[2].zeropoint,(int)DancersCfg1[2].zeropoint,RpWarning,(int)DancersCfg2[2].zeropoint,0); return Fresult; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index eb1b751bb..528b83c1c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -539,6 +539,25 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } BreakSensorCounter = 0; } + if (CurrentControlledSpeed[index] < (OriginalMotorSpd_2PPS[index]/3)) + { + BreakSensorCounter++; + BreakSensorLatchCounter++; + if (BreakSensorCounter>=BreakSensordebouncetimemilli) + { + //consider applying the debouce parameters later + usnprintf(TMessage, 60, "thread speed too low"); + JobEndReason = JOB_THREAD_BREAK; + ThreadControlActive = false; + SendJobProgress(0.0,0,false, TMessage); + SendSegmentFail(); + //AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true); + //EndState(CurrentJob,"ReadBreakSensor Error" ); + LOG_ERROR(index, "thread speed too low Error"); + return OK; + } + } + } } } |
