diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-03-17 15:07:53 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-03-17 15:07:53 +0200 |
| commit | 50cb0b54f51275ee650d4f2c838b1c670da1c8dd (patch) | |
| tree | d423351789ae48dbd4466b4c937abf8b2a2cd505 /Software/Embedded_SW/Embedded/Modules | |
| parent | 3ba4bb906d68acb627e8814a97023c68a8ce91cd (diff) | |
| parent | a1be0b0db7f8284cac6a9b5c3aecd1c9968c82ce (diff) | |
| download | Tango-50cb0b54f51275ee650d4f2c838b1c670da1c8dd.tar.gz Tango-50cb0b54f51275ee650d4f2c838b1c670da1c8dd.zip | |
merge tpf
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
12 files changed, 129 insertions, 43 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 5fe242436..8e4a36e62 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -499,9 +499,9 @@ uint32_t MillisecLowLoop(uint32_t tick) //Read_MidTank_Pressure_Sensor(Disp_i); } FPGA_GetAllDispensersValveBusyOCD(); - /*temp = Read_Fans_Tacho(); + temp = Read_Fans_Tacho(); DrawerFansStatus = temp & 0x1F; - SystemFansStatus = temp & 0xE0;*/ + SystemFansStatus = temp & 0xE0; KeepAliveOneSecondCall(); for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) { diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index e3f593924..425894857 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -254,6 +254,12 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) else Valve_Set(VALVE_MIXCHIP_WASTECH,0); break; + case INTERFACE_IOS__GPO_BLOWER_PWM: + if (request->value == true) + Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100%(); + else + Control_Dryer_Fan(STOP,0);//use START or STOP, 0 - 100%(); + break; default: responseContainer.has_error = true; responseContainer.error = ERROR_CODE__GENERAL_ERROR; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 3f62fc3b6..8b9db2126 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -385,7 +385,7 @@ uint32_t HeaterCommandRequestMessage(int HeaterId, bool OnOff, int Temperature) PrepareHeater(HeaterId,Temperature); //prepare the heaters control info //set the power balance handler (if not set yet) // if the heater is off (?) start it. - ActivateHeater(HeaterId); + //ActivateHeater(HeaterId); //set the heater operation mode to fast heating - depended on the current temperature // timers are prepared but not started yet!!! only when the system is hot. @@ -518,7 +518,7 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue) return ERROR; } - //Report("PrepareHeater ", __FILE__,__LINE__,HeaterId, SetTemperatue, 0, 0); + Report("PrepareHeater ", __FILE__,__LINE__,HeaterId, SetTemperatue, 0, 0); //start thread control for all motors HeaterPIDConfig[HeaterId].m_params.MAX = HeaterControl[HeaterId].outputproportionalpowerlimit*100; @@ -699,6 +699,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) } } DeActivateHeater(index); + HeaterRecalculateHeaterParams(index, 0); HeaterMaxTempFlag[index] = true; //LOG_ERROR ((MinreadValue/100), "Heater Over the max temperature, turned off"); Report("Heater Over the max temperature, turned off",__FILE__,__LINE__,index,RpWarning,HeaterPreviousRead[index], HeaterControl[index].sensormaxvalue); @@ -782,6 +783,8 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) if (readValue > HeaterCmd[index].targettemperatue) { DeActivateHeater(index); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); } return ERROR; } @@ -795,6 +798,8 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); //Heaters OFF until coming into the proportional band + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); return OK; } // if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index d27fb7c56..e7e6f3ff6 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -31,7 +31,6 @@ void IDS_Dispenser_Set_Flow_Params (char DispenserId,double NanoLitterPerPulse,c void IDS_Dispenser_RefillStarted (char DispenserId); void IDS_Dispenser_RefillEnded (char DispenserId); void IDS_Dispenser_MovingDirection (char DispenserId, bool direction); -uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback); #endif //MODULES_IDS_IDS_H_ diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index acaf19744..abfabe17d 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -62,10 +62,15 @@ uint32_t IdsGetMotorSpeed(uint32_t DispenserId) uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t ReadValue) { + uint32_t status; DispenserPrepareTime[DispenserId]+=DispenserPrepareTimeLag; if ((GetDispenserPressure(DispenserId)>=DispenserPreparePressure)||(DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout)) { + if (DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout) + status = ERROR; + else + status = OK; if (SafeRemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_Build_Pressure_Callback )==OK) DispenserControlId[DispenserId] = 0xFF; else @@ -76,11 +81,12 @@ uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t Re if (DispenserCallback[DispenserId]) { - DispenserCallback[DispenserId](DispenserId,ReadValue); + + DispenserCallback[DispenserId](DispenserId,status); DispenserCallback[DispenserId] = 0; } } - return OK; + return status; } uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback) diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h index bf73ed7fa..b201e6611 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h @@ -39,6 +39,9 @@ uint32_t IDSSegmentState(void *JobDetails, int SegmentId); uint32_t IDSDistanceToSpoolState(void); uint32_t IDSEndState(void *JobDetails); +uint32_t IDS_StartLubrication(void); +uint32_t IDS_StopLubrication(void); + uint32_t IDS_DispenserPidRequestMessage(HardwarePidControl* request); uint32_t IDS_DispenserControlInit(); @@ -49,6 +52,7 @@ uint32_t IDS_Dispenser_Alarm_On (uint8_t deviceID); uint32_t IDS_Dispenser_Alarm_Off (uint8_t deviceID); uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id); +uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback); void IDS_Dispenser_SetTimeOutValues(uint32_t CloseTimeout, uint32_t OpenTimeout); void IDS_Dispenser_SetBackLashValues(double initialdispenserpressure, uint32_t initialdispensertimeout, uint32_t initialdispensertimelag); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 2be233962..0a9d40a15 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -31,11 +31,12 @@ typedef struct PID_Config_Params m_params; }DispenserControlConfig_t; HardwarePidControl *DispensersControl;// = (HardwarePidControl *)GENHWCFG_MAP_IN_FLASH + 0x4000; - +#define LUBRICANT_DISPENSER 7 +#define MAX_DYE_DISPENSERS 7 int32_t DispenserSamples[MAX_SYSTEM_DISPENSERS][MAX_CONTROL_SAMPLES] = {0}; int DispenserSamplePointer[MAX_SYSTEM_DISPENSERS] = {0}; double DispenserNormalizedErrorCoEfficient[MAX_SYSTEM_DISPENSERS] = {0}; - +double lubricant_speed = 0.0; HardwarePidControlType ThreadDispenserIdToControlId[MAX_SYSTEM_DISPENSERS] = { HARDWARE_PID_CONTROL_TYPE__Dispenser1,HARDWARE_PID_CONTROL_TYPE__Dispenser2,HARDWARE_PID_CONTROL_TYPE__Dispenser3,HARDWARE_PID_CONTROL_TYPE__Dispenser4,HARDWARE_PID_CONTROL_TYPE__Dispenser5,HARDWARE_PID_CONTROL_TYPE__Dispenser6,HARDWARE_PID_CONTROL_TYPE__Dispenser7,HARDWARE_PID_CONTROL_TYPE__Dispenser8}; bool DispenserReady[MAX_SYSTEM_DISPENSERS] = {true}; @@ -160,6 +161,13 @@ void DispenserPrepareReady(void) if (JobTicket->segments[Segment_i]->brushstops[Brush_i]->dispensers[Dispenser_i]->nanolitterpersecond>0.0) { DispenserUsedInJob[DispenserId] = true; + if(DispenserId == LUBRICANT_DISPENSER) + { + lubricant_speed = JobTicket->segments[0]->brushstops[0]->dispensers[Dispenser_i]->nanolitterpersecond/ + JobTicket->segments[0]->brushstops[0]->dispensers[Dispenser_i]->nanoliterperpulse; + REPORT_MSG (lubricant_speed*100, "LUBRICANT_SPEED*100"); + } + } }//for dispenser }//if dispensers @@ -522,3 +530,18 @@ uint32_t IDSPreSegmentState(void *JobDetails, int SegmentId) return OK; } +uint32_t IDS_StartLubrication(void) +{ + IDS_Dispenser_Start_Motor_and_Open_Valve(LUBRICANT_DISPENSER,lubricant_speed,NULL); + Lubricant_2Way_Valve (START); + return OK; +} +uint32_t IDS_StopLubrication(void) +{ + if(DispenserUsedInJob[LUBRICANT_DISPENSER]) + { + IDS_Dispenser_Close_Valve_And_Stop_Motor(LUBRICANT_DISPENSER,IDS_Valve_EndValveReady); + Lubricant_2Way_Valve (STOP); + } + return OK; +} diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c index 7c0a4c980..eb1de19ad 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c @@ -11,18 +11,18 @@ #include "drivers/adc_sampling/adc.h" #include "modules/ids/ids_ex.h" - +#include <Drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h> #include "Stub_Status.h" #include <math.h> void Stub_DispenserRequest(MessageContainer* requestContainer) { - uint32_t status = NOT_SUPPORTED; + uint32_t status = PASSED; MessageContainer responseContainer; StubDispenserRequest* request = stub_dispenser_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); - +/* ADCAcquireInit(); SysCtlDelay(10000); ADCAcquireStart(0,1); @@ -32,9 +32,36 @@ void Stub_DispenserRequest(MessageContainer* requestContainer) ADC0SS0Handler(); SysCtlDelay(100000); +*/ + + TCA9534Regs Regs; + + status |= TCA9534Init(request->dispenserid, &Regs); + if(request->start == 1) + { + TCA9534ByPass(request->dispenserid, &Regs, ENABLE); + } + else + TCA9534ByPass(request->dispenserid, &Regs, DISABLE); + delayms(5); + + if(request->setdirection == 1) + { + TCA9534TestRelay(request->dispenserid, &Regs,ENABLE); + } + else + TCA9534TestRelay(request->dispenserid, &Regs,DISABLE); + + delayms(5); + if(request->setmicrostepdivision == 1) + TCA9534TestByPassTestRelay(request->dispenserid, &Regs); + delayms(5); + if(request->setspeed == 1) + test_IO(); + delayms(5); //request->dispenserid //request->start //request->setdirection @@ -46,15 +73,19 @@ void Stub_DispenserRequest(MessageContainer* requestContainer) response.dispenserid = (uint32_t)((round)(CalculateDispenserPressure(0x00000004)));//CHAN_DISPENSE_PRESSURE_6); + + status |= TCA9534SetReadInputReg(request->dispenserid); + status |= TCA9534ReadInputReg(request->dispenserid, &Regs); + - //response.dispenserid = request->dispenserid; + response.dispenserid = request->dispenserid; response.has_dispenserid = true; - //response.dispenserposition - response.has_dispenserposition = false; + response.dispenserposition = (Read_Notification_Disp_UP(request->dispenserid, &Regs) << 8) | (Read_Notification_Disp_Down(request->dispenserid, &Regs)); + response.has_dispenserposition = true; - //response.inkworninglevel - response.has_inkworninglevel = false; + response.inkworninglevel = (Read_Notification_Realy_On(request->dispenserid, &Regs) << 8) | (Read_Notification_Over_Press(request->dispenserid, &Regs)); + response.has_inkworninglevel = true; status_response(status,&response.status, &response.statusword ,&response.has_statusword); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c index 7735c9955..6848dd1cf 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c @@ -22,6 +22,7 @@ #include "Drivers/Heater/Heater.h" #include "../control/control.h" #include "Drivers/Heater/TemperatureSensor.h" +#include "Modules/heaters/heaters_ex.h" void Stub_HeaterRequest(MessageContainer* requestContainer) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index a82fe37e6..ff319918e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -38,21 +38,21 @@ /* typedef enum { 0 THREAD_LOAD_INIT, - 1 THREAD_LOAD_REDUCE_HEAT, //HEATERS OFF, DRYER BLOWER OFF, BLOWER LOW, - 2 THREAD_LOAD_SET_LOAD_ARM_TO_START_POSITION,//USE NOTATION HOW MANY ROTATIONS IN THE DRYER, OR CHECK AGAINST STOPPER. MOVE SLOWLY - 3 THREAD_LOAD_CENTER_HEAD_ROCKERS, //puthead cleaning rockers to middle position - 4 THREAD_LOAD_OPEN_COVERS, //OPEN DYEING HEAD COVER AND DRYER LID + 1 THREAD_LOAD_REDUCE_HEAT, //HEATERS OFF, DRYER BLOWER OFF, BLOWER LOW, + 2 THREAD_LOAD_SET_LOAD_ARM_TO_START_POSITION, //USE NOTATION HOW MANY ROTATIONS IN THE DRYER, OR CHECK AGAINST STOPPER. MOVE SLOWLY + 3 THREAD_LOAD_CENTER_HEAD_ROCKERS, //puthead cleaning rockers to middle position + 4 THREAD_LOAD_OPEN_COVERS, //OPEN DYEING HEAD COVER AND DRYER LID 5 THREAD_LOAD_LIFT_DANCERS, - 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE - 7 THREAD_LOAD_INITIAL_TENSION,//CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND + 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE + 7 THREAD_LOAD_INITIAL_TENSION, //CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND 8 THREAD_LOAD_CLOSE_ROCKERS, - 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD + 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD 10 THREAD_LOAD_CLOSE_LIDS, 11 THREAD_LOAD_RESUME_HEATING, - 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION - 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 - //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER - 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING + 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 + //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING 15 THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM;*/ THREAD_LOAD_STAGES_ENUM LoadStages = THREAD_LOAD_INIT; @@ -222,9 +222,9 @@ else { LoadStages++; - if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call + if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call { - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } } } @@ -340,7 +340,7 @@ { Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100% LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } return OK; } @@ -371,7 +371,7 @@ LoadStages++; if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call { - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); } } } @@ -417,7 +417,7 @@ //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; - //LoadArmInfo.LoadArmRounds = 0xFF; + LoadArmInfo.LoadArmRounds = 0xFF; FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); return OK; } @@ -428,7 +428,7 @@ ControlId = 0xFF; ThreadAbortJoggingFunc(); LoadStages++; - ThreadLoadStateMachine(LoadStages); + //ThreadLoadStateMachine(LoadStages); return OK; } uint32_t Thread_Load_Jog_Thread(void) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index c598e0c55..0277d1daa 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -40,6 +40,8 @@ void ScrewsStartControlTimer (void); bool Winder_ScrewHoming = false; bool ScrewCurrentDirection = false; //holds current screw direction uint32_t ScrewDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone +uint32_t ScrewChangeCounter = 0; +uint32_t ScrewChangeLimit = 0; uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone uint16_t WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; @@ -196,13 +198,17 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) double RotationsPerSecond; int32_t Averagewinderspeed = 0; - TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; - WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; - TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; - if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) + ScrewChangeCounter++; + if ((ScrewChangeCounter>3)&&(ScrewChangeCounter<(ScrewChangeLimit-2))) //do not take the winder speed near the limits { - WinderMotorSpeedCounter=0; - WinderMotorSpeedRollOver=true; + TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; + WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; + TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; + if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) + { + WinderMotorSpeedCounter=0; + WinderMotorSpeedRollOver=true; + } } if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) @@ -260,7 +266,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); //Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); - Report("new winder speed",__FILE__,__LINE__,temp,RpWarning,ScrewSpeed,0); + Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } /********************************************************************************/ @@ -397,6 +403,7 @@ void ScrewsStartControlTimer (void) //ROM_TimerConfigure(Screw_timerBase, TIMER_CFG_PERIODIC); // 32 bits Timer TimerEnable(Screw_timerBase, TIMER_A); ROM_IntEnable(INT_TIMER3A); + //IntPrioritySet(Screw_timerBase, 0x40); ROM_TimerIntEnable(Screw_timerBase, TIMER_TIMA_TIMEOUT); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)1200000/*10 millisec*/ ); Report("ScrewsStartControlTimer direction,speed ", __FILE__,__LINE__,ScrewCurrentDirection, RpMessage, ScrewSpeed, 0); @@ -410,9 +417,11 @@ void ScrewTimerInterrupt(int ARG0) if (SCREW_TimerActivated == true) { + ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); - ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); + ScrewChangeCounter = 0; + ScrewChangeLimit = ScrewRunningTime/12000000; ScrewDirectionChangeCounter++; } else diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 6a8474438..f4dc6a170 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -30,6 +30,7 @@ #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "modules/heaters/heaters.h" #include "modules/General/process.h" +#include "modules/ids/ids_ex.h" #include "Modules/AlarmHandling/AlarmHandling.h" #include "Control/MillisecTask.h" @@ -708,6 +709,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails, uint32_t SegmentId) MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize); MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); } + IDS_StartLubrication(); } // activate control fr all motors //set speed for both rocker motors @@ -807,7 +809,7 @@ char Endstr[150]; } MotorStop(HARDWARE_MOTOR_TYPE__MOTO_RLOADING,Hard_Hiz); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_LLOADING,Hard_Hiz); - + IDS_StopLubrication(); return OK; } |
