From abc2f5fc8f757eddeccdd10646039c96b58e522d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 13 Aug 2019 19:27:10 +0300 Subject: Version 1.4.3.7 Power off sequence with flushing and cleaning job. VOC alarms, safety, auto filling dispensers --- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 29 +++++++--- .../Embedded/Modules/Control/MillisecTask.c | 9 +-- .../Embedded_SW/Embedded/Modules/Control/control.c | 8 +++ .../Embedded_SW/Embedded/Modules/Control/control.h | 1 + .../Embedded/Modules/Diagnostics/Diagnostics.c | 64 ++++++++++++++++++++-- .../Embedded/Modules/General/GeneralHardware.c | 2 + Software/Embedded_SW/Embedded/Modules/IDS/IDS.h | 2 + .../Embedded/Modules/IDS/IDS_dispenser.c | 15 ++--- Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h | 2 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 51 +++++++++++++++++ .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 47 +++++++++++----- .../Embedded/Modules/Thread/Thread_Winder.c | 26 ++++++--- 12 files changed, 212 insertions(+), 44 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index d1eabb6c7..6f80fdffb 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -178,12 +178,22 @@ AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_7_OVERPRESSURE}, {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_8_OVERPRESSURE}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_1_EMPTY}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_2_EMPTY}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_3_EMPTY}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_4_EMPTY}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_5_EMPTY}, - {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,60/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_8_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_1_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_2_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_3_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_4_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_5_LOW_LEVEL}, + //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_6_LOW_LEVEL}, + //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_7_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_8_LOW_LEVEL}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_1_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_2_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_3_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_4_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_5_EMPTY}, + //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_6_EMPTY}, + //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_7_EMPTY}, + {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,20/*500cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_8_EMPTY}, {eOneSecond,ALARM_SOURCE_TYPE__MotorAlarm,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,x_STATUS_OCD,false,DEBUG_LOG_CATEGORY__Error,0xFF,2,EVENT_TYPE__DRYER_MOTOR_OVERCURRENT }, @@ -340,6 +350,9 @@ AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ {eOneSecond, ALARM_SOURCE_TYPE__CurrentAlarm, HEATER_DRYER_CURRENT_2, HEATER_DRYER_CURRENT_2, 0 , FALSE , DEBUG_LOG_CATEGORY__Warning , 0xFF , 2 , EVENT_TYPE__DRYER_HEATERS_ZONE_2_CURRENT_LOOP_BREAK }, /* 6004 */ {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DYEING_HEAD_THERMAL_CUTOFF}, + {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__VOC_SENSOR_ALARM_TIME}, + {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE}, + {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Warning,0xFF,0,EVENT_TYPE__THREAD_BREAK}, {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Warning,0xFF,0,EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER}, {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Warning,0xFF,0,EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER}, @@ -531,11 +544,11 @@ uint32_t AlarmHandlingConsequentActions(uint32_t AlarmId, DebugLogCategory Sever { if (Severity == DEBUG_LOG_CATEGORY__Info) { - IDS_Dispenser_Alarm_Off(AlarmItem[AlarmId].ModuleDeviceId); + IDS_Dispenser_Alarm_Off(AlarmItem[AlarmId].ModuleDeviceId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); } else { - IDS_Dispenser_Alarm_On (AlarmItem[AlarmId].ModuleDeviceId); + IDS_Dispenser_Alarm_On (AlarmItem[AlarmId].ModuleDeviceId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); } } break; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index f5ac6cf92..fa94614fd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -88,14 +88,13 @@ uint32_t Dancer_Data[NUM_OF_DANCERS] = {0}; float Speed_Data = 0; uint32_t DrawerFansStatus = 0; uint32_t SystemFansStatus = 0; -uint8_t Gas_PPM = 0; - bool watchdogCriticalAlarm = false; uint32_t msec_millisecondCounter = 0; extern bool Machine_Idle_Mode; +uint8_t Gas_PPM_Info; MillisecMotorDataStruc ScrewSetMaxSpeedPending = {0}; MillisecMotorDataStruc ScrewMovePending = {0}; MillisecMotorDataStruc MotorData[NUM_OF_MOTORS] = {0}; @@ -111,6 +110,7 @@ static GateMutex_Handle gateMillisecDB; uint32_t Millisec_timerBase = TIMER1_BASE; //Timer handle /******************** Functions ********************************************/ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Read); +void CalculateVOCAlarms(void); //********************************************************************** /******************** CODE ********************************************/ //********************************************************************** @@ -595,7 +595,6 @@ uint32_t MillisecLowLoop(uint32_t tick) Read_Heaters_Current(Heater_i); } } - Gas_PPM = Calculate_Gas_Power_Consumption(); for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++) { TemperatureCalc[Sensor_i] = MillisecCalculateTemperatures ( Sensor_i); @@ -615,6 +614,8 @@ uint32_t MillisecLowLoop(uint32_t tick) MotorGetStatusFromFPGA(Motor_i); }*/ midtankDisplay = 1-midtankDisplay; + Gas_PPM_Info = Calculate_Gas_Power_Consumption(); + } if (OneHourTick) { @@ -720,7 +721,7 @@ uint32_t getDrawerFansStatus(void) } uint8_t getGasReading(void) { - return Gas_PPM; + return Gas_PPM_Info; } uint32_t getSystemFansStatus(void) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index f1e19d851..a88f67d5e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -479,6 +479,14 @@ uint32_t GetControlLowDevice_i(void) { return ControlLowDevice_i; } +ControlCBFunction GetControlCallbackFuncPtr(uint32_t ControlId) +{ + if (ControlArray[ControlId].ControlActive) + return ControlArray[ControlId].ControlCallbackPtr; + else + return NULL; + +} uint32_t ControlLoop(uint32_t tick) { if (MaxHighDevices == 0xFF) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h index 380040e34..c54909f73 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.h +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h @@ -47,6 +47,7 @@ int SafeRemoveHighControlCallback(uint32_t deviceId , ControlCBFunction uint32_t TemplateDataReadCBFunction (uint32_t deviceId, uint32_t Parameter1); uint32_t GetControlDevice_i(void); uint32_t GetControlLowDevice_i(void); +ControlCBFunction GetControlCallbackFuncPtr(uint32_t ControlId); extern Task_Handle Control_Task_Handle; extern uint32_t millisecondCounter; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 116988720..8956f417d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -60,6 +60,7 @@ uint32_t DiagnosticsStop(void); uint32_t Diagnostics_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue); uint32_t Diagnostics_TenMiliControlTrigger(uint32_t IfIndex, uint32_t ReadValue); +uint32_t Diagnostics_OneSecControlTrigger(uint32_t IfIndex, uint32_t ReadValue); uint32_t DispensersCollection(uint32_t IfIndex, uint32_t ReadValue); //#define REDUCED_DIAGNOSTICS @@ -81,7 +82,7 @@ int DiagnosticLimit =eOneSecond; //frequency of data collection int DiagnosticLimit =eHundredMillisecond; //frequency of data collection #endif int DiagnosticFastLimit = eTenMillisecond; //frequency of data collection -#define TEN_MSEC_COLLECTION +//#define TEN_MSEC_COLLECTION //DigitalPin DigitalPinArray[1][DIAGNOSTICS_LIMIT+1]; double dancer1angle[DIAGNOSTICS_LIMIT+1]; double dancer2angle[DIAGNOSTICS_LIMIT+1]; @@ -138,6 +139,7 @@ typedef enum { DiagnosticsTrigger, DiagnosticsTenMiliTrigger, + DiagnosticsOneSecTrigger, }DiagnosticsMessages; typedef struct DiagnosticsMessage{ @@ -338,7 +340,7 @@ void DiagnosticTenMsecCollection(void) { if (DiagnosticsActive == false) return; -#ifdef TEN_MSEC_COLLECTION +//#ifdef TEN_MSEC_COLLECTION /*if (JobIsActive()== false) return;*/ DiagnosticLoadDancer(WINDER_DANCER,Control_Read_Dancer_Position(WINDER_DANCER, 0,0)); @@ -350,7 +352,33 @@ void DiagnosticTenMsecCollection(void) DiagnosticLoadDancerError(FEEDER_DANCER,ThreadGetMotorCalculatedError(FEEDER_DANCER)); //DiagnosticLoadSpeedSensor(getSensorSpeedData()); -#endif +//#endif +} +void DiagnosticOneSecCollection(void) +{ + int i; + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__MixerHeater, MillisecGetTemperatures( MIXER_PT100)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP1)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP2)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP3)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP4)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP5)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, MillisecGetTemperatures(HEAD6_PT100)); + + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP2)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP3)); + for (i=0;i=HomingBacklashTimeout[DispenserId])&&(HomingBacklashTimeout[DispenserId]>0))) + { + //stop this control loop + SafeRemoveControlCallback(DispenserBacklashControlId[DispenserId], IDS_HomeDispenserWaitForHomingEndCallback ); + DispenserBacklashControlId[DispenserId] = 0xFF; + + if (HomingBacklashCallback[DispenserId]) + { + if ( HomingActive[DispenserId]== false) + HomingBacklashCallback[DispenserId](DispenserId,OK); + else + HomingBacklashCallback[DispenserId](DispenserId,ERROR); + } + HomingBacklashCallback[DispenserId] = 0; + } + return OK; +} +uint32_t IDS_HomeDispenserWaitForHomingEnd(uint32_t DispenserId, uint32_t timeout , callback_fptr callback) +{ + assert(DispenserId < MAX_SYSTEM_DISPENSERS); + + if (HomingBacklashCallback[DispenserId]!=NULL) + return ERROR; + HomingBacklashCallback[DispenserId] = callback; + HomingBacklashTimeout[DispenserId] = timeout; + HomingBacklashTime[DispenserId] = 0; + + if (DispenserBacklashControlId[DispenserId] != 0xFF) + { + RemoveControlCallback(DispenserBacklashControlId[DispenserId], IDS_HomeDispenserWaitForHomingEndCallback ); + DispenserBacklashControlId[DispenserId] = 0xFF; + //return ERROR; + } + DispenserBacklashControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserWaitForHomingEnd,eOneSecond , TemplateDataReadCBFunction,DispenserId,0, 0 ); + if ( DispenserBacklashControlId[DispenserId] == 0xFF) + return ERROR; + + return OK; +} + uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) { uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 039b152e5..7a719d39a 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -686,6 +686,19 @@ c. Go to step 2.a x Segment.BrushStopsCount. } return OK; } + uint32_t IDSPrepareStartDispenserAfterHoming(uint32_t DispenserId, uint32_t Result) + { + double dispenserspeed = 0; + Report("IDSPrepare Start Dispenser After Homing",__FILE__,__LINE__,DispenserId,RpWarning,(int)Result,0); + dispenserspeed = DispenserPrepareSpeed; + if (DispenserUsedInJob[DispenserId] == true) //we actually should check for all dispensers + { + Report("Prepare Speed",__FILE__,__LINE__,DispenserId,RpWarning,(int)dispenserspeed,0); + IDS_Dispenser_Start_Motor_and_Open_Valve(DispenserId,dispenserspeed, NULL); + } + return OK; + + } void IDSPrepareStart(void) { int i; @@ -700,9 +713,9 @@ c. Go to step 2.a x Segment.BrushStopsCount. NumOfActiveDispensers = 0; for (i = 0; i < MAX_DYE_DISPENSERS; i++) { - //IDS_StopHomeDispenser(i); if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { + IDS_StopHomeDispenser(i); NumOfActiveDispensers++; } } @@ -714,8 +727,16 @@ c. Go to step 2.a x Segment.BrushStopsCount. dispenserspeed = DispenserPrepareSpeed; if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { - Report("Prepare Speed",__FILE__,__LINE__,i,RpWarning,(int)dispenserspeed,0); - IDS_Dispenser_Start_Motor_and_Open_Valve(i,dispenserspeed, NULL); + if (HomingActive[i] == false) + { + Report("Prepare Speed",__FILE__,__LINE__,i,RpWarning,(int)dispenserspeed,0); + IDS_Dispenser_Start_Motor_and_Open_Valve(i,dispenserspeed, NULL); + } + else + { + Report("IDSPrepare Stop Dispenser Homing",__FILE__,__LINE__,i,RpWarning,(int)HomingActive[i],0); + IDS_HomeDispenserWaitForHomingEnd(i, DispenserPrepareTimeout/2 , IDSPrepareStartDispenserAfterHoming); + } } } } @@ -745,7 +766,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. if (DispenserBuildTimeCounter<(1*eOneSecond)) { - REPORT_MSG(DispenserBuildTimeCounter,"waiting 1 seconds for pressure changes"); + //REPORT_MSG(DispenserBuildTimeCounter,"waiting 1 seconds for pressure changes"); return OK; } if (PreSegmentWCFStarted == true) @@ -782,14 +803,14 @@ c. Go to step 2.a x Segment.BrushStopsCount. } if ((NumofReadyDispensers)&&(DispenserBuildTimeCounter%1000 == 0)) - Report("IDS_PreSegmentPrepare_Callback",__FILE__,DispenserBuildTimeCounter,NumofReadyDispensers,RpWarning,(int)NumOfActiveDispensers,0); + Report("IDS_PreSegmentPrepare_Callback",__FILE__,DispenserBuildTimeCounter,InterSegmentStepsCount,RpWarning,(int)NumOfActiveDispensers,0); if (NumofReadyDispensers>=NumOfActiveDispensers) pressureReady = true; if ((DispenserBuildTimeCounter >= DispenserPrepareTimeout)||(pressureReady == true)) { - Report("IDS_PreSegmentPrepare_Callback SafeRemoveControlCallback",__FILE__,DispenserPrepareControlId,NumofReadyDispensers,RpWarning,(int)NumOfActiveDispensers,0); + Report("IDS_PreSegmentPrepare_Callback SafeRemoveControlCallback",__FILE__,DispenserPrepareControlId,InterSegmentStepsCount,RpWarning,(int)NumOfActiveDispensers,0); SafeRemoveControlCallback(DispenserPrepareControlId, IDS_Prepare_Callback ); DispenserPrepareControlId = 0xFF; @@ -800,7 +821,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. //******************************************************************************************************************** void IDSPresegmentPrepareStart(void) { - int i; + int Dispenser_i,n_dispensers,DispenserId; TimerMotors_t HW_Motor_Id; double segmentfirst_speed; @@ -837,16 +858,16 @@ c. Go to step 2.a x Segment.BrushStopsCount. DispenserUsedInSegment[Dispenser_i] = true; MotorSetSpeed(HW_Motor_Id, DispenserPrepareSpeed); CurrentDispenserSpeed[Dispenser_i] = DispenserPrepareSpeed; - usnprintf(IdsMessage, 80,"WFCF Prepare Dispenser %d speed %d",DispenserId,(int) segmentfirst_speed); + usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d speed %d",DispenserId,(int) DispenserPrepareSpeed); //REPORT_MSG(segmentfirst_speed,IdsMessage); - Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); + Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, DispenserPrepareSpeed, 0); //SendJobProgress(0.0, 0, false, IdsMessage); } else { MotorStop(HW_Motor_Id, Hard_Hiz); CurrentDispenserSpeed[Dispenser_i] = 0; - usnprintf(IdsMessage, 80,"WFCF Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); + usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); } @@ -960,7 +981,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); { IDS_PreSegmentPrepare_Callback(0,0); } - if ((InterSegmentStartWFCFDispensers > 0)&&(InterSegmentStartWFCFDispensers == InterSegmentStepsCount)) + if ((InterSegmentStartWFCFDispensers > 0)&&(InterSegmentStartWFCFDispensers == (lInterSegmentLength-InterSegmentStepsCount))) { Report("start dispensers at rate * WFCF",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); PreSegmentWCFStarted = true; // stop any presegment prepare stages, if still exist @@ -1448,7 +1469,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) InterSegmentStartRocking = 1000; InterSegmentCenterRockers = 3000; }*/ - InterSegmentStartWFCFDispensers = 0; + //InterSegmentStartWFCFDispensers = 0; return OK; @@ -1459,7 +1480,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) //TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[deviceID]; //REPORT_MSG(deviceID,"Dispenser End called"); //MotorStop(HW_Motor_Id,Hard_Hiz); - //IDS_HomeDispenser (deviceID, 800 , NULL); + //IDS_HomeDispenser (deviceID, 1000 , NULL); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 7e1312464..5d9b26f92 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -59,10 +59,11 @@ static uint32_t WindingConeLocation; static uint32_t WinderBackToBaseTime = 800; InternalWinderConfigStruc InternalWinderCfg = {0}; - +#define READ_SCREW_ENCODER +#ifdef READ_SCREW_ENCODER uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; uint32_t ScrewLocationRun[3]; - +#endif bool SampleWinding = false; uint32_t Winder_Init(void) { @@ -132,8 +133,10 @@ uint32_t Winder_Prepare(void *JobDetails) return ERROR; }*/ +#ifdef READ_SCREW_ENCODER ScrewLocationRun[0] = 0; ScrewLocationRun[1] = 0; +#endif if (( KeepWindingCone == false)||(WindingConeLocation == 0)) { WindingConeLocation = InternalWinderCfg.startoffsetpulses; @@ -176,10 +179,11 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); +#ifdef READ_SCREW_ENCODER Read_Screw_Encoder(); ScrewLocationLimitSwitch = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); - +#endif REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); if (ReadValue != LIMIT) @@ -203,6 +207,7 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) MotorStop (HARDWARE_MOTOR_TYPE__MOTO_SCREW,Soft_Hiz); //per L6470 errata between mov and run commands Task_sleep(5); +#ifdef READ_SCREW_ENCODER Reset_Screw_Encoder(); Task_sleep(5); Read_Screw_Encoder(); @@ -210,10 +215,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) ScrewLocationStart = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); +#endif SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home ScrewCurrentDirection = false; +#ifdef READ_SCREW_ENCODER ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; +#endif ScrewSpeed = 0; ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; @@ -302,13 +310,15 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if (SampleWinding) return OK; //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; - //REPORT_MSG((abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); -// usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); +#ifdef READ_SCREW_ENCODER + + REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); + //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); //usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, // abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); - +#endif if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { if (Add100 == true) //once per job @@ -617,11 +627,13 @@ void ScrewTimerInterrupt(int ARG0) if (SCREW_TimerActivated == true) { - Read_Screw_Encoder(); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); +#ifdef READ_SCREW_ENCODER + Read_Screw_Encoder(); ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; +#endif // ScrewChangeCounter = 0; // ScrewChangeLimit = ScrewRunningTime/12000000; ScrewDirectionChangeCounter++; -- cgit v1.3.1