diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-01 14:34:42 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-01 14:34:42 +0200 |
| commit | 797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f (patch) | |
| tree | d16c6a43558a34f0d2d2fb2cb0c7d7393eddb67d /Software/Embedded_SW/Embedded/Modules | |
| parent | 8276e5eb7c56b58ed86f611ca5bd9b1dc56b25b9 (diff) | |
| download | Tango-797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f.tar.gz Tango-797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f.zip | |
update with Beta code
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
12 files changed, 166 insertions, 90 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 6d5dc00b2..11d08d45a 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -1129,26 +1129,27 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (FPGA_WD_Occurred == true) { Status = false; - break; } - if (isMotorConfigured((TimerMotors_t)AlarmItem[Alarm_i].DeviceId) == false) + else if (isMotorConfigured((TimerMotors_t)AlarmItem[Alarm_i].DeviceId) == false) { Status = false; - break; } - value = MotorGetStatus((TimerMotors_t)AlarmItem[Alarm_i].DeviceId); - if (AlarmItem[Alarm_i].AlarmDirection == true) + else { - if (value && AlarmItem[Alarm_i].AlarmValue) + value = MotorGetStatus((TimerMotors_t)AlarmItem[Alarm_i].DeviceId); + if (AlarmItem[Alarm_i].AlarmDirection == true) { - Status = true; + if (value && AlarmItem[Alarm_i].AlarmValue) + { + Status = true; + } } - } - else - { - if ((value && AlarmItem[Alarm_i].AlarmValue)==false) + else { - Status = true; + if ((value && AlarmItem[Alarm_i].AlarmValue)==false) + { + Status = true; + } } } } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 1f5e008d3..8dad3fa60 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -170,7 +170,7 @@ uint32_t ControlActivityLed( uint32_t Parameter1) if(FPGA_WD_Occurred == true) { ACTIVITY_GREEN_LED_ON; - HWConfigurationInit(); + //Motor_ReconfigAllMotors(); } else ACTIVITY_GREEN_LED_OFF; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index ccf5455d4..5c0af7589 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -515,7 +515,7 @@ void Diagnostic100msecCollection(void) return; //DiagnosticLoadSpeedSensor(getSensorSpeedData()); - if (DiagnosticMode == Diagnostic_Extended_Mode) + if (DiagnosticMode == Diagnostic_Extreme_Mode) DiagnosticTenMsecCollection(); //call the 10msec function every 100 msec to reduce transport if (DiagnosticMode >= Diagnostic_Extended_Mode) @@ -553,7 +553,13 @@ void Diagnostic100msecCollection(void) MidTankpressure[i][0] = 1.00-(IDS_Dispenser_Data[i].consumedinnanolitter/5800000); } */ - + if (DiagnosticMode == Diagnostic_Extreme_Mode) + { + for (i=0;i<NUM_OF_CURRENT_HEATERS;i++) + { + HeatersCurrent[i][0] = Get_Heaters_Current(i); + } + } /*dispenser1motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); dispenser2motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_2); dispenser3motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_3); @@ -719,7 +725,6 @@ void SendDiagnostics(void) DiagnosticsMonitor.dispenserspressure[i] = &DiagnosticsDispenserPressure[i]; } } - /**/ DiagnosticsMonitor.n_dispenserslinearpositions = 0; DiagnosticsMonitor.n_dispensersangularencoders = 0; @@ -742,6 +747,43 @@ void SendDiagnostics(void) DiagnosticsMonitor.dispenser8pressure = dispenserspressure[7]; + DiagnosticsMonitor.n_midtank1level = 1; + DiagnosticsMonitor.midtank1level = MidTankpressure[0]; + DiagnosticsMonitor.n_midtank2level = 1; + DiagnosticsMonitor.midtank2level = MidTankpressure[1]; + DiagnosticsMonitor.n_midtank3level = 1; + DiagnosticsMonitor.midtank3level = MidTankpressure[2]; + DiagnosticsMonitor.n_midtank4level = 1; + DiagnosticsMonitor.midtank4level = MidTankpressure[3]; + DiagnosticsMonitor.n_midtank5level = 1; + DiagnosticsMonitor.midtank5level = MidTankpressure[4]; + DiagnosticsMonitor.n_midtank6level = 1; + DiagnosticsMonitor.midtank6level = MidTankpressure[5]; + DiagnosticsMonitor.n_midtank7level = 1; + DiagnosticsMonitor.midtank7level = MidTankpressure[6]; + DiagnosticsMonitor.n_midtank8level = 1; + DiagnosticsMonitor.midtank8level = MidTankpressure[7]; + + DiagnosticsMonitor.n_drierzone1heatercurrent = 1; + DiagnosticsMonitor.drierzone1heatercurrent = HeatersCurrent[HEATER_DRYER_CURRENT_1]; + DiagnosticsMonitor.n_drierzone2heatercurrent = 1; + DiagnosticsMonitor.drierzone2heatercurrent = HeatersCurrent[HEATER_DRYER_CURRENT_2]; + DiagnosticsMonitor.n_mixer1heatercurrent = 1; + DiagnosticsMonitor.mixer1heatercurrent = HeatersCurrent[HEATER_MIXCHIP_CURRENT]; + DiagnosticsMonitor.n_headzone1heatercurrent = 1; + DiagnosticsMonitor.headzone1heatercurrent = HeatersCurrent[HEATER_HEAD_CURRENT_ZONE_1]; + DiagnosticsMonitor.n_headzone2heatercurrent = 1; + DiagnosticsMonitor.headzone2heatercurrent = HeatersCurrent[HEATER_HEAD_CURRENT_ZONE_2]; + DiagnosticsMonitor.n_headzone3heatercurrent = 1; + DiagnosticsMonitor.headzone3heatercurrent = HeatersCurrent[HEATER_HEAD_CURRENT_ZONE_3]; + DiagnosticsMonitor.n_headzone4heatercurrent = 1; + DiagnosticsMonitor.headzone4heatercurrent = HeatersCurrent[HEATER_HEAD_CURRENT_ZONE_4]; + DiagnosticsMonitor.n_headzone5_6heatercurrent = 1; + DiagnosticsMonitor.headzone5_6heatercurrent = HeatersCurrent[HEATER_HEAD_CURRENT_ZONE_5_6]; + + VOC_Sensor = (double) getGasReading(); + DiagnosticsMonitor.n_filterdeltapressure = 1; + DiagnosticsMonitor.filterdeltapressure = &VOC_Sensor; response.monitors = &DiagnosticsMonitor; //response.digitalpins = DigitalPinArray; @@ -805,26 +847,6 @@ void SendDiagnostics(void) DiagnosticsStop(); } DiagnosticsReset(); -/* DiagnosticsMonitor.n_drierzone1heatercurrent = 0; - DiagnosticsMonitor.n_drierzone2heatercurrent = 0; - DiagnosticsMonitor.n_mixer1heatercurrent = 0; - DiagnosticsMonitor.n_headzone1heatercurrent = 0; - DiagnosticsMonitor.n_headzone2heatercurrent = 0; - DiagnosticsMonitor.n_headzone3heatercurrent = 0; - DiagnosticsMonitor.n_headzone4heatercurrent = 0; - DiagnosticsMonitor.n_headzone5_6heatercurrent = 0; - DiagnosticsMonitor.n_filterdeltapressure = 0; - DiagnosticsMonitor.n_midtank1level = 0; - DiagnosticsMonitor.n_midtank2level = 0; - DiagnosticsMonitor.n_midtank3level = 0; - DiagnosticsMonitor.n_midtank4level = 0; - DiagnosticsMonitor.n_midtank5level = 0; - DiagnosticsMonitor.n_midtank6level = 0; - DiagnosticsMonitor.n_midtank7level = 0; - DiagnosticsMonitor.n_midtank8level = 0; - DiagnosticsMonitor.n_dispensersinklevel = 0; - DiagnosticsMonitor.n_midtanksinklevel = 0; -*/ } uint32_t DiagnosticsControlId = 0xff; uint32_t Diagnostics10MSControlId = 0xff; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index 38f9b73ba..05a2196ce 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -45,7 +45,7 @@ uint32_t MotorHomingRequestCallback(uint32_t deviceID, uint32_t ReadValue) MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT; responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, HomingToken[deviceID], true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size); - responseContainer.continuous = true; + responseContainer.continuous = false; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); @@ -141,7 +141,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) responseContainer.error = ERROR_CODE__INVALID_PROCESS_ID; responseContainer.errormessage = "Job Active or incorrect motor ID"; responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, requestContainer->token, true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size); - responseContainer.continuous = true; + responseContainer.continuous = false; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 7e46d9342..46abd923f 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -18,13 +18,8 @@ #include "heaters/heaters_ex.h" -//#include "third_party/fatfs/src/ffconf.h" -//#include "third_party/fatfs/src/diskio.h" -//#include "drivers/Flash_Memory/Flash_Memory.h" -//#include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/Flash_ram/FlashProgram.h" -#include "third_party/fatfs/src/ffconf.h" #include "Common/SWUpdate/FileSystem.h" #include "PMR/common/MessageContainer.pb-c.h" @@ -54,7 +49,7 @@ #include "Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h" #include <Drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h> #include "Modules/General/buttons.h" - +#include "Modules/Waste/Waste.h" #include "Drivers/I2C_Communication/Main_Board_EEPROM/Main_EEPROM.h" @@ -153,6 +148,10 @@ uint32_t HWConfigurationInit(void) ADC_MUX_Init(); GeneralHwReady = true; + + //I2C_NFC_Test(); + //RFID_Test(); + return status; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h index f7dbbb25f..646861bc7 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h @@ -34,6 +34,7 @@ typedef enum sttDISABLE, sttENABLE, sttJOGGING, + sttLONG_JOGGING, sttRDY, sttPRELOAD, @@ -44,10 +45,10 @@ typedef enum typedef struct Button { - char bttn_name[10]; //option - int bttn_status; // 0=RELEASE 1=PRESS - PBstat Action; // enum : offPB,shortPB,longPB,countPB,replongPB - PBcolor color; // enum : off, blue, blink, bithing + char bttn_name[10]; //option + PB_Status bttn_status; // 0=RELEASE 1=PRESS + PBstat Action; // enum : offPB,shortPB,longPB,countPB,replongPB + PBcolor color; // enum : off, blue, blink, bithing PBmachineState state; // enum : sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING uint32_t count; }button; diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index d7de5797d..4305fac0e 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -20,7 +20,6 @@ #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "modules/ids/ids_ex.h" -#include "third_party/fatfs/src/ffconf.h" #include "Common/SWUpdate/FileSystem.h" #include "StateMachines/Initialization/PowerIdle.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 564df6862..b023d592b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1182,7 +1182,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } if (readValue>(HeaterCmd[index].targettemperatue+500)) { - ReportWithPackageFilter(HeatersFilter, "DC OverHeating in progress",__FILE__,readValue,HeaterReady[index],RpError, HeaterAtTemp[index],0); + ReportWithPackageFilter(HeatersFilter, "DC OverHeating in progress",__FILE__,index,readValue,RpError, HeaterReady[index],0); } // check if the read value is within the proportional band diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index 2a1a8fa31..bdde05b43 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -17,7 +17,7 @@ #include "drivers/valves/valve.h" int SaveLeftRockerSpeed = 50, SaveRightRockerSpeed = 50; -#define CLEANING_DISPENSER_ID 6 + uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) { uint32_t status = OK; @@ -43,8 +43,8 @@ uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callbac uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback) { uint32_t status = OK; - status = IDS_Dispenser_Start_Motor_and_Open_Valve(CLEANING_DISPENSER_ID, dispenserSpeed, callback); - Report("IDS_Cleaning_Spray_Cleaning_Solution", __FILE__, __LINE__, CLEANING_DISPENSER_ID, RpWarning, dispenserSpeed, 0); + status = IDS_Dispenser_Start_Motor_and_Open_Valve(CLEANER_DISPENSER, dispenserSpeed, callback); + Report("IDS_Cleaning_Spray_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, dispenserSpeed, 0); return status; @@ -52,8 +52,8 @@ uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback) { uint32_t status = OK; - status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANING_DISPENSER_ID,callback); - Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANING_DISPENSER_ID, RpWarning, status, 0); + status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANER_DISPENSER,callback); + Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, status, 0); return status; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index ca9a15008..55ae7d879 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -593,7 +593,10 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } NumOfActiveDispensers = 0; - IDS_StopHomeDispenser(CLEANER_DISPENSER); + if (lubricant_speed > 0.1) + IDS_StopHomeDispenser(LUBRICANT_DISPENSER); + if ((EnableIntersegment == true)&&(IntersegmentLength>0)) + IDS_StopHomeDispenser(CLEANER_DISPENSER); for (i = 0; i < MAX_DYE_DISPENSERS; i++) { if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers @@ -607,11 +610,37 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } else { - if ((HomingActive[i] == false)&&(PrimingActive == false)) + /**/if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) + { + if ((HomingActive[i] == false)&&(PrimingActive == false)) + { + Report("Homing Inactive dispenser",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + IDS_HomeDispenser (i, 1000 , NULL); + } + else + { + Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + } + }/**/ + /*if ((HomingActive[i] == false)&&(PrimingActive == false)) { Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - } + Report("Homing Inactive dispenser",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + IDS_HomeDispenser (i, 1000 , NULL); + } + else + { + Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + } + }*/ + //if ((HomingActive[i] == false)&&(PrimingActive == false)) + //{ + // Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + // Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + //} + //ControlIdtoInactiveDispenserId[Dispenser_i] = AddControlCallback( IDS_Check_Pressure_Callback, eOneMinute,TemplateDataReadCBFunction ,0, 0, 0 ); + } } if (NumOfActiveDispensers) @@ -763,11 +792,13 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } else { - MotorStop(HW_Motor_Id, Hard_Hiz); - CurrentDispenserSpeed[Dispenser_i] = 0; - usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); - Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); - + if (DispenserUsedInJob[DispenserId] == true) + { + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[Dispenser_i] = 0; + usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); + Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); + } } } DispenserBuildTimeCounter = 0; @@ -855,6 +886,8 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); Report("End of Pre-segment Handling",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); //PreSegmentReady(Module_IDS,ModuleDone); SafeRemoveControlCallback(DispenserPreSegmentControlId,IDSPreSegmentStateCallbackRunner); + if (CurrentDispenserSpeed[CLEANER_DISPENSER]>0) + IDS_Cleaning_Stop_Cleaning_Solution (NULL); setRapidPressureRead(false); } if (EnableCleaning == true) @@ -1145,12 +1178,15 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) } if ((EnableIntersegment == true)&&(IntersegmentLength>0.1)&&(SegmentId>0)) { - MotorStop(HW_Motor_Id,Soft_Hiz); //26/03/19 test without valves - CurrentDispenserSpeed[DispenserId] = 0; - //MotorSetSpeed(HW_Motor_Id, 5); - //CurrentDispenserSpeed[Dispenser_i] = 5; - DispenserPreSegmentReady[DispenserId] = true; //27/03/19 check if job should be stopped - REPORT_MSG(DispenserId,"Dispenser stopped pre Segment"); + if (DispenserUsedInJob[DispenserId] == true) + { + MotorStop(HW_Motor_Id,Soft_Hiz); //26/03/19 test without valves + CurrentDispenserSpeed[DispenserId] = 0; + //MotorSetSpeed(HW_Motor_Id, 5); + //CurrentDispenserSpeed[Dispenser_i] = 5; + DispenserPreSegmentReady[DispenserId] = true; //27/03/19 check if job should be stopped + REPORT_MSG(DispenserId,"Dispenser stopped pre Segment"); + } } IDS_Valve_PresegmentReady(DispenserId,0); //27/03/19 to be removed when the presegment handler will be added } @@ -1226,8 +1262,11 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) { DispenserSegmentReady[DispenserId] = true; //IDS_Dispenser_Close_Valve_And_Stop_Motor(DispenserId,NULL);*/ - MotorStop(HW_Motor_Id, Hard_Hiz); - CurrentDispenserSpeed[DispenserId] = 0; + if (DispenserUsedInJob[DispenserId] == true) + { + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + } //Report("inActive dispenser stopped", __FILE__, __LINE__, DispenserId, RpWarning, segmentfirst_speed, 0); } } @@ -1276,6 +1315,17 @@ uint32_t IDSBrushStopRestartCallback(uint32_t IfIndex, uint32_t readValue) } return OK; } +#define VALVE_DELAY 1 +#ifdef VALVE_DELAY + +uint32_t IDSValveControlId = 0xFF; +uint32_t IDSSegmentStateSetValve(uint32_t IfIndex, uint32_t BusyFlag) +{ + SafeRemoveControlCallback(IDSValveControlId,IDSSegmentStateSetValve); + Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); + Report("IDSSegmentState set valve after 1 second",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0); +} +#endif //******************************************************************************************************************** uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) { @@ -1283,8 +1333,11 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) JobDispenser **Dispensers; int n_dispensers; +#ifdef VALVE_DELAY + IDSValveControlId = AddControlCallback("VALVE_DELAY",IDSSegmentStateSetValve, eOneSecond,TemplateDataReadCBFunction,0,0,0); +#else Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); - +#endif IDS_Cleaning_Stop_Cleaning_Solution(NULL); SegmentNumOfBrushStops = Segment->n_brushstops; BrushStopTime = Segment->length/SegmentNumOfBrushStops; //brushstop in meters @@ -1412,7 +1465,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) { Report("IDS_Valve_EndValveReady start homing",__FILE__,deviceID,(int)AutoHoming_Config,RpWarning,(int)AutoHoming_JobEnd_PowerOn_off,0); - if (deviceID!=LUBRICANT_DISPENSER) + //if (deviceID!=LUBRICANT_DISPENSER) IDS_HomeDispenser (deviceID, 1000 , NULL); } return OK; @@ -1455,8 +1508,8 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) } else { - RemoveControlCallback(ControlIdtoInactiveDispenserId[Dispenser_i], IDS_Check_Pressure_Callback ); - ControlIdtoInactiveDispenserId[Dispenser_i] = 0xFF; +// RemoveControlCallback(ControlIdtoInactiveDispenserId[Dispenser_i], IDS_Check_Pressure_Callback ); +// ControlIdtoInactiveDispenserId[Dispenser_i] = 0xFF; IDS_Valve_EndValveReady(Dispenser_i,false); } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 856812c12..852c19a1a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -67,6 +67,7 @@ uint8_t CallbackCounter = 0; uint8_t TimeoutsCounter = 0; + uint32_t UnloadingStart = 0; uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; uint32_t LoadingControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; @@ -184,8 +185,6 @@ { Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); //storeLoadArmParameters(); - MotorMove(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,LoadArmInfo.LoadArmBackLash ); - SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; ThreadLoadStateMachine(LoadStages); @@ -215,6 +214,8 @@ //move to exact location? // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); CallbackCounter = 0; + Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0); + Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); NumberOfDrierLoaderCycles=0; //storeLoadArmParameters(); @@ -614,7 +615,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(19); + SetOriginMotorSpeed(30); // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; @@ -670,14 +671,14 @@ 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); + UnloadingStart = msec_millisecondCounter; + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,UnloadingStart,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); LoadArmInfo.LoadArmBackLash = 5; - 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/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer - LoadArmInfo.LoadArmBackLash = 5; + //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = (int)dryerbufferlength; load.color = BLINK; return OK; @@ -840,7 +841,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } - if (index == POOLER_MOTOR) + /* if (index == POOLER_MOTOR) { if ((TranslatedReadValue)<(-1200)) { @@ -868,7 +869,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } - } + }*/ /* LoadCounter++; if ((LoadCounter % 5001) == 0) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 741fed7af..0d1656301 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -107,6 +107,8 @@ uint32_t InternalWindingConfigMessage(JobSpool* request) InternalWinderCfg.startoffsetpulses = request->startoffsetpulses; InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate; InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//request->rotationsperpassage; + if (request->rotationsperpassage > 6.1) + InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage; InternalWinderCfg.diameter = request->diameter; usnprintf(ScrewStr, 150, "WindingConfig start,offset,head,tail {, %d, %d, %d, %d, %d}",InternalWinderCfg.startoffsetpulses,(int)InternalWinderCfg.segmentoffsetpulses, (int)InternalWinderCfg.spoolbackingrate,(int)InternalWinderCfg.SpoolBottomBackingRate); @@ -279,7 +281,7 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; -double Rotations = 6.0; +double Rotations = 10.0; int flipflop = 0; uint32_t motspeed; float speedf; @@ -400,11 +402,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) }*/ //WinderReferenceSpeed = 1000; //ScrewNumberOfSteps = 1000; - screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; + //screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; // if (Rotations > 6.6)//7.0) // Rotations = 6.0; - RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; - tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + //RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; + //tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; //ROM_IntMasterDisable(); tempScrewSpeed = ScrewSpeed; @@ -468,7 +470,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/3); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; @@ -481,7 +482,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/20); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; } |
