From 03c479e2126007f539c2f569fa43c07cc6a6808d Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Wed, 17 Jun 2020 16:49:22 +0300 Subject: Add support for new motor driver parameter- P01configword --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index fb3b78752..760a0726b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -104,6 +104,8 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest) MotorsCfg[Motor_i].tfast = request->tfast ; MotorsCfg[Motor_i].tonmin = request->tonmin ; MotorsCfg[Motor_i].toffmin = request->toffmin ; + MotorsCfg[Motor_i].has_p01configword = (bool)(request->has_p01configword) ;//needed for backward compatibility + MotorsCfg[Motor_i].p01configword = request->p01configword ; status = MotorConfig( Motor_i, &MotorsCfg[Motor_i]); if ((Motor_i >= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)&&(Motor_i <= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8)) -- cgit v1.3.1 From a52e0e1b4f0b981af32427cb7b2044f5cedd9829 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 6 Jul 2020 16:52:05 +0300 Subject: Version 1.4.6.35 - Pack Mid alpha ============================ Arc head - activate arc heaters gradually stop FPGA Reinit after 20 trials Head cleaning - move actuators (with stub - 0xAD7) fix RML PID support head open prevent job - (with stub - 0xAD6) add stub to overrule cone missing - 0xAD8 --- Software/Embedded_SW/Embedded/.cproject | 2 +- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Head_Card/IO_Ports/Heaters/Head_Heaters.c | 88 ++++- .../WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c | 4 +- .../Embedded/Modules/Control/MillisecTask.c | 1 - .../Embedded_SW/Embedded/Modules/Control/control.c | 12 +- .../Embedded/Modules/General/GeneralHardware.c | 1 - .../Embedded_SW/Embedded/Modules/General/buttons.c | 28 -- Software/Embedded_SW/Embedded/Modules/IDS/IDS.h | 4 + .../Embedded/Modules/IDS/IDS_Cleaning.c | 81 ++++- Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h | 2 + .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 11 +- .../Embedded/Modules/Stubs_Handler/Progress.c | 24 ++ .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 1 - .../Embedded/Modules/Thread/ThreadLoad.c | 9 +- .../Embedded/Modules/Thread/Thread_Winder.c | 13 +- .../Embedded/Modules/Thread/Thread_ex.h | 2 +- .../Embedded/Modules/Thread/Thread_init.c | 2 - .../Embedded/Modules/Thread/Thread_print.c | 170 +++++----- .../Embedded/Software Release Notes.txt | 9 + .../stubs/technician view files/new head.tpf | 360 +++++++++++---------- 21 files changed, 505 insertions(+), 321 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject index 26bee6013..388976f56 100644 --- a/Software/Embedded_SW/Embedded/.cproject +++ b/Software/Embedded_SW/Embedded/.cproject @@ -441,7 +441,7 @@ - + diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 4b1fec423..beeb86c92 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,6,34}; +TangoVersion_t _gTangoVersion = {1,4,6,35}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Heaters/Head_Heaters.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Heaters/Head_Heaters.c index a5c9376d2..d73fbcdba 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Heaters/Head_Heaters.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Heaters/Head_Heaters.c @@ -13,6 +13,7 @@ bool HeaterMap[HEADCARD_HIT_MIXER+1] = {0}; +uint8_t OT_Heater_Index = 0;IN_Heater_Index = 0; uint32_t Activate_Head_Card_Heaters(HEADCARD_HEATERS_ENUM Head_Heater_ID) { uint32_t status= OK; @@ -40,15 +41,15 @@ uint32_t Deactivate_Head_Card_Heaters(HEADCARD_HEATERS_ENUM Head_Heater_ID) HeaterMap[Head_Heater_ID] &= ~(1 << Head_Heater_ID); if(Head_Heater_ID <= HEADCARD_UPPER_HIT_IN4) - { - Head_I2C_EXP1_0x40.ushort &= ~(1 << Head_Heater_ID); - } - else if(Head_Heater_ID <= HEADCARD_HIT_MIXER) - { - Head_I2C_EXP2_0x42.ushort &= ~(1 << (Head_Heater_ID - 16)); - } - else - status = ERROR; + { + Head_I2C_EXP1_0x40.ushort &= ~(1 << Head_Heater_ID); + } + else if(Head_Heater_ID <= HEADCARD_HIT_MIXER) + { + Head_I2C_EXP2_0x42.ushort &= ~(1 << (Head_Heater_ID - 16)); + } + else + status = ERROR; return status; } @@ -66,6 +67,38 @@ uint32_t Write_Head_Card_Heaters_Commands() Report(" Write_Head_Card_Heaters",__FILE__,__LINE__,255,RpWarning,0,0); if (status) ReadFailures++; + if ((IN_Heater_Index)&&(IN_Heater_Index<=4)) + { + switch (IN_Heater_Index) + { + case 2: + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN2 = true; + break; + case 3: + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 = true; + break; + case 4: + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 = true; + break; + } + IN_Heater_Index++; + } + if ((OT_Heater_Index)&&(OT_Heater_Index<=4)) + { + switch (OT_Heater_Index) + { + case 2: + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 = true; + break; + case 3: + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 = true; + break; + case 4: + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 = true; + break; + } + OT_Heater_Index++; + } return status; } @@ -137,34 +170,65 @@ uint32_t HeadCard_Control_Heaters(HEADCARD_HEATERS_ENUM Heater_ID, bool Pwr_Cmd) break; case HEADCARD_UPPER_HIT_IN1: Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN1 = Pwr_Cmd; + IN_Heater_Index = (Pwr_Cmd)?1:0; //status |= Head_Write_IO_Reg(0x40,HIGH); // break; // case HEADCARD_UPPER_HIT_IN2: + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN2 == Pwr_Cmd) Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN2 = Pwr_Cmd; + else + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN2 == true) + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN2 = false; //status |= Head_Write_IO_Reg(0x40,HIGH); // break; // case HEADCARD_UPPER_HIT_IN3: + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 == Pwr_Cmd) Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 = Pwr_Cmd; + else + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 == true) + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 = false; + //Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN3 = false; //status |= Head_Write_IO_Reg(0x40,HIGH); // break; // case HEADCARD_UPPER_HIT_IN4: + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 == Pwr_Cmd) Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 = Pwr_Cmd; + else + if (Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 == true) + Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 = false; + //Head_I2C_EXP1_0x40.bits.OUTPUT_ON_HTIN4 = false; //status |= Head_Write_IO_Reg(0x40,HIGH); break; case HEADCARD_UPPER_HIT_OUT1: Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT1 = Pwr_Cmd; + OT_Heater_Index = (Pwr_Cmd)?1:0; //status |= Head_Write_IO_Reg(0x42,LOW); // break; // case HEADCARD_UPPER_HIT_OUT2: - Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 = Pwr_Cmd; + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 == Pwr_Cmd) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 = Pwr_Cmd; + else + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 == true) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 = false; + //Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT2 = false; //status |= Head_Write_IO_Reg(0x42,LOW); // break; // case HEADCARD_UPPER_HIT_OUT3: - Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 = Pwr_Cmd; + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 == Pwr_Cmd) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 = Pwr_Cmd; + else + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 == true) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 = false; + //Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT3 = false; //status |= Head_Write_IO_Reg(0x42,LOW); // break; // case HEADCARD_UPPER_HIT_OUT4: - Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 = Pwr_Cmd; + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 == Pwr_Cmd) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 = Pwr_Cmd; + else + if (Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 == true) + Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 = false; + //Head_I2C_EXP2_0x42.bits.OUTPUT_ON_HTOT4 = false; //status |= Head_Write_IO_Reg(0x42,LOW); break; case HEADCARD_HIT_MIXER: diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c index 8618524d9..211d7cbef 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c @@ -635,9 +635,9 @@ uint32_t WHS_Pid_Testing_Func(double setParam,double measuredParam) calculated_speed = volt + 100; if (calculated_speed < (volt - 100)) calculated_speed = volt - 100;*/ - /*usnprintf(whs_str, 150, "WHS_Pid_Testing_Func meas %d avg %d set %d error %d integral %d blower %d", + usnprintf(whs_str, 150, "WHS_Pid_Testing_Func meas %d avg %d set %d error %d integral %d blower %d", (int)(measuredParam*100),(int)(avreageSampleValue*100),(int)(setParam*100),(int)(WHS_ControlData.m_calculatedError*100),(int)(WHS_ControlData.m_integral*100),(int)(calculated_speed)); - Report(whs_str, __FILE__,__LINE__, (int)(calculated_speed), RpMessage, (int)(volt), 0);*/ + Report(whs_str, __FILE__,__LINE__, (int)(calculated_speed), RpMessage, (int)(volt), 0); /*if (fabs(WHS_ControlData.m_calculatedError)>(WHS_ControlData.m_params.MAX/2)) { close_loop_time = 1; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 5f9c3130b..dc15202a6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -658,7 +658,6 @@ uint32_t MillisecLowLoop(uint32_t tick) #ifndef EVALUATION_BOARD Read_Buttons_Reg(); #endif - //Ink_Cart_Led(); /////////////////////////////////////////////////////////////////// diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 0f9848ba1..26fba0194 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -170,6 +170,7 @@ void ControlStop(void) ControlRestart = false; ADCAcquireStop(); } +int FPGA_ReInit_Count = 0; ///avoid too many reinitializations of motors as happens when FPGA is corrupted uint32_t ControlActivityLed( uint32_t Parameter1) { static bool flag = false; @@ -192,11 +193,14 @@ uint32_t ControlActivityLed( uint32_t Parameter1) SendJobProgress(0.0,0,false, "Hardware Failure Error"); AbortJob("FPGA Watchdog Error"); } - ReportWithPackageFilter(FPGAFilter, "FPGA Watchdog Error",__FILE__,__LINE__,0,RpError, 0,0); + if (FPGA_ReInit_Count++<20) + { + ReportWithPackageFilter(FPGAFilter, "FPGA Watchdog Error",__FILE__,__LINE__,0,RpError, 0,0); - ACTIVITY_GREEN_LED_ON; - FPGA_SetMotorsInit(); - Motor_ReconfigAllMotors(); + ACTIVITY_GREEN_LED_ON; + FPGA_SetMotorsInit(); + Motor_ReconfigAllMotors(); + } } } else diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 6d4d1c668..e2ade95c3 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -554,7 +554,6 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) } ControlStart(); AlarmHandlingStart(); - //ThreadInitialTestStub(request); GeneralHwReady = true; STATUS_RED_LED_OFF; return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index f81cfb88f..328ff3203 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -691,34 +691,6 @@ return OK; return OK; }*/ -void Ink_Cart_Led()//temporary for ITMA -{ - if(Is_Cartridge_Present(CART_1) == true) - { - Pannel_Leds( CART_1, MODE_ON); - } - else - { - Pannel_Leds( CART_1, MODE_OFF); - } - if(Is_Cartridge_Present(CART_2) == true) - { - Pannel_Leds( CART_2, MODE_ON); - } - else - { - Pannel_Leds( CART_2, MODE_OFF); - } - if(Is_Cartridge_Present(CART_3) == true) - { - Pannel_Leds( CART_3, MODE_ON); - } - else - { - Pannel_Leds( CART_3, MODE_OFF); - } -} - void test_avi() { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index 41e729b9b..647797b69 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -28,6 +28,9 @@ extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS]; extern bool HomingActive[MAX_SYSTEM_DISPENSERS]; extern bool PrimingActive[MAX_SYSTEM_DISPENSERS]; +extern uint32_t LeftRockerSpeed; +extern uint32_t RightRockerSpeed; + uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue); /*typedef struct @@ -45,6 +48,7 @@ void IDS_Dispenser_RefillEnded (char DispenserId,char MicroSteps); //uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback); +uint32_t IDS_Cleaning_Move_Actuators(void); uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed); uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callback); uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index bdde05b43..8f10a0e5d 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -13,11 +13,73 @@ #include "PMR/Hardware/Hardwaremotor.pb-c.h" #include "PMR/Hardware/HardwareDispenser.pb-c.h" #include "StateMachines/Printing/printingSTM.h" +#include + #include "drivers/motors/motor.h" #include "drivers/valves/valve.h" +#include "Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h" int SaveLeftRockerSpeed = 50, SaveRightRockerSpeed = 50; +typedef enum +{ + CleaningStageIdle, + CleaningStageActuatorUp = 1, + CleaningStageDelay1, + CleaningStageActuatorDown, + CleaningStageDelay2, +}CleaningStageEnum; + +/* + *Cleaning sequence: + + +t up – time actuator goes up +t delay1 – time actuator stays in position (up position – not limit switch) +Down to limit - actuator goes to lower limit switch +t delay2 – time actuator stays in lower limit switch position + +Values for start: +t up – 300 msec +t delay1 – 500 msec +t delay2 – 2 sec + + */ + +CleaningStageEnum CleaningStage = CleaningStageIdle; +int CleaningStageCounter = 0; +int Tup = 4,Tdelay1 = 9,Tdelay2 = 29; + +uint32_t IDS_Cleaning_Move_Actuators() +{ + if(Head_Type != HEAD_TYPE_SYLKO) + return OK; + if (CleaningStageCounter == 1) + { + Trigger_Head_Actuators_Control(ACTIN, LOW,true); + Report("IDS_Cleaning_Move_ActuatorUp", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tup) + { + Trigger_Head_Actuators_Disable(); + Report("IDS_Cleaning_Stop_Actuator", __FILE__, __LINE__, Tup, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tdelay1) + { + Trigger_Head_Actuators_Control(ACTIN, LOW,false); + Report("IDS_Cleaning_MoveDown", __FILE__, __LINE__, Tdelay1, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tdelay2) + { + CleaningStageCounter = 0; + Report("IDS_Cleaning_Stop_delay", __FILE__, __LINE__, Tdelay2, RpWarning, CleaningStageCounter, 0); + } + + + CleaningStageCounter++; + + return OK; +} uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) { uint32_t status = OK; @@ -34,17 +96,25 @@ uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callback) { uint32_t status = OK; - status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].directionthreadwize, SaveRightRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD], callback,timeout); - status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].directionthreadwize, SaveLeftRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH], callback,timeout); - Report("IDS_Cleaning_Center_And_Stop_Rockers", __FILE__, __LINE__, timeout, RpWarning, 123456, 0); + //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].directionthreadwize, SaveRightRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD], callback,timeout); + //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].directionthreadwize, SaveLeftRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH], callback,timeout); + Trigger_Head_Actuators_Disable(); + Trigger_Head_Actuators_Control(ACTIN, LOW,false); + CleaningStageCounter = 0; + CleaningStage = CleaningStageIdle; + Report("IDS_Cleaning_Center_And_Stop_Rockers actuator down", __FILE__, __LINE__, timeout, RpWarning, 123456, 0); return status; } uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback) { uint32_t status = OK; + Tup = LeftRockerSpeed/100; + Tdelay1 = LeftRockerSpeed%100; + Tdelay2 = RightRockerSpeed; 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); + Report("IDS_Cleaning parameters", __FILE__, Tup*100, Tdelay1*100, RpWarning, Tdelay2*100, 0); return status; @@ -54,6 +124,11 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback) uint32_t status = OK; status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANER_DISPENSER,callback); Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, status, 0); + if(Head_Type == HEAD_TYPE_SYLKO) + { + Trigger_Head_Actuators_Control(ACTIN, LOW,false); + Report("IDS_Cleaning_MoveDown cleaning stop", __FILE__, __LINE__, Tdelay1, RpWarning, CleaningStageCounter, 0); + } return status; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h index b3f21e187..831fa18cd 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h @@ -45,6 +45,8 @@ extern DispenserRunningData IDS_Dispenser_Data[MAX_SYSTEM_DISPENSERS]; //extern DispenserData IDSDispenserData; extern DispenserRunningData **dispenserdata; +extern bool ActuatorsCleaningSequence; + extern bool DispenserUsedInJob[MAX_SYSTEM_DISPENSERS]; extern int32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS]; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index a76453f95..b4442c996 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -51,6 +51,7 @@ HardwarePidControlType ThreadDispenserIdToControlId[MAX_SYSTEM_DISPENSERS] = { JobUploadStrategy uploadstrategy = JOB_UPLOAD_STRATEGY__Default; bool DispenserReady[MAX_SYSTEM_DISPENSERS] = {true}; bool IDS_Active = false; +bool ActuatorsCleaningSequence = true; bool Special_Dispensers = false; /******************** STRUCTURES AND ENUMs ********************************************/ @@ -78,7 +79,7 @@ int lInterSegmentLength = 0; uint32_t InterSegmentStartRocking = 0; uint32_t InterSegmentCenterRockers = 0; uint32_t LeftRockerSpeed = 20; - uint32_t RighttRockerSpeed = 20; + uint32_t RightRockerSpeed = 20; uint32_t CleaningDispenserSpeed = 40; uint32_t InterSegmentStartWFCFDispensers; uint32_t WFCF = 80; @@ -115,7 +116,7 @@ void IDS_Dispenser_SetPreSegmentWFCFValues(double dispenserpresegmentwfcf, doubl if ( ids_leftcleaningmotorspeed) LeftRockerSpeed = ids_leftcleaningmotorspeed; if ( ids_rightcleaningmotorspeed) - RighttRockerSpeed = ids_rightcleaningmotorspeed; + RightRockerSpeed = ids_rightcleaningmotorspeed; Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,CleaningDispenserSpeed,RpWarning,(int)LeftRockerSpeed,0); Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,InterSegmentStartSprayCleaner,RpWarning,(int)InterSegmentCenterRockers,0); @@ -1089,6 +1090,12 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); Report("Start cleaning rockers",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); //IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed); }*/ + if (( InterSegmentStartSprayCleaner )&& + ((InterSegmentStepsCount>InterSegmentStartSprayCleaner)&&(InterSegmentStepsCount<(lInterSegmentLength-InterSegmentCenterRockers) ))) + { + if (ActuatorsCleaningSequence) + IDS_Cleaning_Move_Actuators(); + } if (( InterSegmentCenterRockers)&&(InterSegmentCenterRockers == (lInterSegmentLength-InterSegmentStepsCount))) { Report("Stop spray and center rockers",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index cbdab01d1..fd9c5b404 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -500,6 +500,30 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } else + if(request->amount == 0xAD6) //Set skip open lids + { + LOG_ERROR(request->delay,"Set SkipOpenLids"); + SkipOpenLids = request->delay; + response.progress = SkipOpenLids; + response.has_progress = true; + } + else + if(request->amount == 0xAD7) //Set actuators cleaning sequence + { + LOG_ERROR(request->delay,"Set actuators cleaning sequence"); + ActuatorsCleaningSequence = request->delay; + response.progress = ActuatorsCleaningSequence; + response.has_progress = true; + } + else + if(request->amount == 0xAD8) //Set ignore cone missing + { + LOG_ERROR(request->delay,"Set ignore cone missing"); + IgnoreConeMissing = request->delay; + response.progress = IgnoreConeMissing; + response.has_progress = true; + } + else if((request->amount == 0x01) && ((request->delay &0x010000) == 0x010000)) //change mode powerset01 { response.progress = Power_Step_01_Mode(((request->delay &0x00FF00)>>8), request->delay &0x0000FF); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index d1d23598f..3a7045a6e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -76,7 +76,6 @@ extern int MotorSpeedSamplePointer[MAX_THREAD_MOTORS_NUM]; uint32_t InternalWinderConfigMessage(HardwareWinder* request); 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); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 2b65ca806..f5bc45d85 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -204,6 +204,7 @@ strcpy(LoadErrorMsg,"Thread_Load_Reduce_Heat failed"); LoadStatus = ERROR; TryAgain = true; + //ThreadLoadButton(LoadStages); } else { @@ -300,6 +301,7 @@ LoadStatus = ERROR; ThreadLoadingReport(); TryAgain = true; + //ThreadLoadButton(LoadStages); } else { @@ -544,6 +546,7 @@ LoadStatus = ERROR; ThreadLoadingReport(); TryAgain = true; + //ThreadLoadButton(LoadStages); } } @@ -647,6 +650,7 @@ Report("Total Feeder load",__FILE__,__LINE__,dryerbufferCentimeters,RpMessage,TotalLoadedLen,0); ThreadLoadingReport(); + //ThreadLoadButton(LoadStages); } return OK; } @@ -857,6 +861,7 @@ LoadStatus = ERROR; TryAgain = true; ThreadLoadingReport(); + //ThreadLoadButton(LoadStages); } return OK; } @@ -971,7 +976,7 @@ uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM ReadValue) { REPORT_MSG(ReadValue,"ThreadLoadStateMachine"); - ThreadLoaded(); + //ThreadLoaded(); ThreadLoadingReport(); if (LoadStages!=ReadValue) @@ -1089,7 +1094,7 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue) Report("Calling State machine",__FILE__,LoadStages,LoadStatus,RpMessage,SecondTry,0); ThreadLoadStateMachine(LoadStages); } - else + else if (SecondTry == true) { SecondTry = false; Report("Calling State machine",__FILE__,LoadStages,LoadStatus,RpMessage,SecondTry,0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 80ca05cb7..92b953db5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -54,7 +54,7 @@ double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone bool SCREW_TimerActivated = false; uint32_t ScrewControlId = 0xFF; - +bool IgnoreConeMissing = false; static bool KeepWindingCone = false; @@ -156,10 +156,13 @@ uint32_t Winder_Prepare(void *JobDetails) REPORT_MSG(LIMIT, "No cone in winder"); if (Is_PP_Machine()) { - JobEndReason = JOB_THREAD_BREAK; - PrepareReady(Module_Winder,ModuleFail); - AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true); - return ERROR; + if (IgnoreConeMissing == false) + { + JobEndReason = JOB_THREAD_BREAK; + PrepareReady(Module_Winder,ModuleFail); + AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true); + return ERROR; + } } } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 4081b53f2..4339c5312 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -24,6 +24,7 @@ typedef enum threadMotorsEnum extern double TotalProcessedLength; extern double PoolerTotalProcessedLength; extern int SecondFeederCorrection; +extern bool SkipOpenLids,IgnoreConeMissing; void ThreadSetBreakSensorLimit(int limit); @@ -37,7 +38,6 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId); uint32_t ThreadSegmentState(void *SegmentDetails, int SegmentId); uint32_t ThreadDistanceToSpoolState(void); uint32_t ThreadEndState(); -uint32_t ThreadInitialTestStub(); bool Set_Thread_Rockers_Bypass (int value); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 760a0726b..e1f887303 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -112,8 +112,6 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest) { IDS_Dispenser_Init(Motor_i-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); } -// if (Motor_i == MOTOR_RDRIVING) -// ThreadInitialTestStub(request); } return status; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index d762e507f..42a56ae8a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -423,7 +423,67 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) } return OK; } +uint16_t BreakSensorCounter = 0; +uint16_t BreakSensorLatchCounter = 0; +char TMessage[150]; +uint32_t checkBreakSensor(uint32_t index) +{ + if (BreakSensorenabled == true) + { + if (JobCounter > eOneSecond) + { + if (ReadBreakSensor()==ERROR) + { + BreakSensorCounter++; + BreakSensorLatchCounter++; + if (BreakSensorCounter>=BreakSensordebouncetimemilli) + { + //consider applying the debouce parameters later + usnprintf(TMessage, 60, "ReadBreakSensor Error"); + //BreakSensordebouncetimemilli + JobEndReason = JOB_THREAD_BREAK; + ThreadControlActive = false; + SendJobProgress(0.0,0,false, TMessage); + SendSegmentFail(); + //AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true); + //EndState(CurrentJob,"ReadBreakSensor Error" ); + ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); + return ERROR; + } //passed limit + }//ReadBreakSensor()==ERROR + else //reset counter - we are looking for consequent calls + { + if (BreakSensorCounter) + { + ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Spike",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); + } + 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" ); + ReportWithPackageFilter(ThreadFilter,"thread speed too low Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); + return ERROR; + } + } + + } + } + return OK; + +} int controlIndex = 0; bool keepdata = true; int32_t KeepReadValue = 0; @@ -477,10 +537,7 @@ void testDancersControl() } #endif int MotorFailedSample[MAX_THREAD_MOTORS_NUM] = {0,0,0,0,0}; -char TMessage[150]; //char time[150]; -uint16_t BreakSensorCounter = 0; -uint16_t BreakSensorLatchCounter = 0; bool FirstCalcInJob = true; uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { @@ -510,6 +567,11 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } index = IfIndex&0xFF; + if (index == POOLER_MOTOR) //move break sensor handling up to ensure handling even if tiing control is > 1 msec + { + if (checkBreakSensor(index) == ERROR) + return OK; + } if (MotorTiming[index]>1) { MotorTimer[index]++; @@ -571,61 +633,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) avreageSampleValue += MotorSamples[index][i]; avreageSampleValue = avreageSampleValue / (int)MotorsControl[index].pvinputfilterfactormode; - if (BreakSensorenabled == true) - { - if (index == POOLER_MOTOR) - { - if (JobCounter > eOneSecond) - { - if (ReadBreakSensor()==ERROR) - { - BreakSensorCounter++; - BreakSensorLatchCounter++; - if (BreakSensorCounter>=BreakSensordebouncetimemilli) - { - //consider applying the debouce parameters later - usnprintf(TMessage, 60, "ReadBreakSensor Error"); - //BreakSensordebouncetimemilli - JobEndReason = JOB_THREAD_BREAK; - ThreadControlActive = false; - SendJobProgress(0.0,0,false, TMessage); - SendSegmentFail(); - //AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true); - //EndState(CurrentJob,"ReadBreakSensor Error" ); - ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); - return OK; - } //passed limit - }//ReadBreakSensor()==ERROR - else //reset counter - we are looking for consequent calls - { - if (BreakSensorCounter) - { - ReportWithPackageFilter(ThreadFilter,"ReadBreakSensor Spike",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); - } - 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" ); - ReportWithPackageFilter(ThreadFilter,"thread speed too low Error",__FILE__,BreakSensorCounter,(int)index,RpError,(int)JobCounter,0); - return OK; - } - } - - } - } - } //Stop Execution if the dancer moves too much if ((abs(avreageSampleValue)> DancerStopActivityLimit[index])&&(JobCounter > eOneSecond)) @@ -783,15 +790,6 @@ double ThreadGetMotorCalculatedError(int DancerId) } //******************************************************************************************************************** -uint32_t ThreadInitialTestStub(HardwareMotor * request) -{ - - - //MotorsConfigMessage(request); - ThreadPrepareState(request); - ThreadPreSegmentState(request,0); - return OK; -} uint32_t HandleJobThreadControlParameters(ThreadParameters* ThreadParams) { if (ThreadParams == NULL) @@ -799,21 +797,21 @@ uint32_t HandleJobThreadControlParameters(ThreadParameters* ThreadParams) return OK; } if(ThreadParams->feederp) - MotorControlConfig[FEEDER_MOTOR].m_params.Kd = ThreadParams->feederp; + MotorControlConfig[FEEDER_MOTOR].m_params.Kp = ThreadParams->feederp; if(ThreadParams->feederi) MotorControlConfig[FEEDER_MOTOR].m_params.Ki = ThreadParams->feederi; if(ThreadParams->feederd) MotorControlConfig[FEEDER_MOTOR].m_params.Kd = ThreadParams->feederd; if(ThreadParams->pullerp) - MotorControlConfig[POOLER_MOTOR].m_params.Kd = ThreadParams->pullerp; + MotorControlConfig[POOLER_MOTOR].m_params.Kp = ThreadParams->pullerp; if(ThreadParams->pulleri) MotorControlConfig[POOLER_MOTOR].m_params.Ki = ThreadParams->pulleri; if(ThreadParams->pullerd) MotorControlConfig[POOLER_MOTOR].m_params.Kd = ThreadParams->pullerd; if(ThreadParams->winderp) - MotorControlConfig[WINDER_MOTOR].m_params.Kd = ThreadParams->winderp; + MotorControlConfig[WINDER_MOTOR].m_params.Kp = ThreadParams->winderp; if(ThreadParams->winderi) MotorControlConfig[WINDER_MOTOR].m_params.Ki = ThreadParams->winderi; if(ThreadParams->winderd) @@ -951,7 +949,8 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) return status; } //******************************************************************************************************************** - uint32_t ThreadPrepareState(void *JobDetails) +bool SkipOpenLids = true; +uint32_t ThreadPrepareState(void *JobDetails) { int Motor_i,i, HW_Motor_Id, Pid_Id; JobTicket* JobTicket = JobDetails; @@ -1016,22 +1015,30 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) //return ERROR; }*/ - if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) == LIMIT)&&(JoggingJobActive == false)) +// if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) == LIMIT)&&(JoggingJobActive == false)) + if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) != LIMIT)&&(JoggingJobActive == false)) { if(Head_Type != HEAD_TYPE_STAPLE_SPUN) { ReportWithPackageFilter(ThreadFilter,"Dyeing head is wide open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpError,LIMIT,0); - JobEndReason = JOB_LIDS_OPEN; - PrepareReady(Module_Thread,ModuleFail); - return ERROR; + if (SkipOpenLids == false) + { + JobEndReason = JOB_LIDS_OPEN; + PrepareReady(Module_Thread,ModuleFail); + return ERROR; + } } } - if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID]) == LIMIT)&&(JoggingJobActive == false)) +// if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID]) == LIMIT)&&(JoggingJobActive == false)) + if ((FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID]) != LIMIT)&&(JoggingJobActive == false)) { ReportWithPackageFilter(ThreadFilter,"Dryer lid is wide open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID,RpError,LIMIT,0); - JobEndReason = JOB_LIDS_OPEN; - PrepareReady(Module_Thread,ModuleFail); - return ERROR; + if (SkipOpenLids == false) + { + JobEndReason = JOB_LIDS_OPEN; + PrepareReady(Module_Thread,ModuleFail); + return ERROR; + } } //start thread control for all motors @@ -1057,6 +1064,8 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) MotorControlConfig[Motor_i].m_preError = 0; MotorControlConfig[Motor_i].m_SetParam = 0;//need to update SetParams on presegment stage + HandleJobThreadControlParameters(JobTicket->threadparameters); //OVERRIDES CONFIGURATION PARAMETERS!!! + temp_dt = MotorControlConfig[Motor_i].m_params.dt/0.001; MotorTiming[Motor_i] = (int)temp_dt; if (MotorTiming[Motor_i]) @@ -1068,7 +1077,7 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) for (i = 0;i < (int)MotorsControl[Motor_i].pvinputfilterfactormode; i++) { //if (Motor_i == DRYER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled - MotorSamples[Motor_i][i] = Control_Read_Dancer_Position(ThreadMotorIdToDancerId[Motor_i],0); //reset the samples value for control beginning + MotorSamples[Motor_i][i] = 0; // else if ((Motor_i == POOLER_MOTOR)||(Motor_i == FEEDER_MOTOR)) // MotorSamples[Motor_i][i] = DancersCfg[ThreadMotorIdToDancerId[Motor_i]].zeropoint; //MotorSpeedSamples[Motor_i][i] = 0; @@ -1148,7 +1157,6 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) if (Motor_i == ThreadMotorIdToMotorId[DRYER_MOTOR]) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled continue; } - HandleJobThreadControlParameters(JobTicket->threadparameters); //OVERRIDES CONFIGURATION PARAMETERS!!! #ifdef TEST_PID_THREAD testDancersControl(); diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index a090a9612..8857b69eb 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,3 +1,12 @@ +Embedded SW Release note - Version 1.4.6.35 - Pack Mid alpha +============================================================= +Arc head - activate arc heaters gradually +stop FPGA Reinit after 20 trials +Head cleaning - move actuators (with stub - 0xAD7) +fix RML PID support +head open prevent job - (with stub - 0xAD6) +add stub to overrule cone missing - 0xAD8 + Embedded SW Release note - Version 1.4.6.34 - Pack 2+ ============================================================= Validate IFS and cartridge location on manual waste handling - bug #3033 diff --git a/Software/Stubs Collection/stubs/technician view files/new head.tpf b/Software/Stubs Collection/stubs/technician view files/new head.tpf index 25215919f..2ae59d2ed 100644 --- a/Software/Stubs Collection/stubs/technician view files/new head.tpf +++ b/Software/Stubs Collection/stubs/technician view files/new head.tpf @@ -27,7 +27,7 @@ DryerAirHeater 0 - 69.85 + 176.1 false false true @@ -46,8 +46,8 @@ DryerMainHeater 0 - 92.97 - false + 208.58999999999998 + true false true @@ -65,8 +65,8 @@ DryerSecondaryHeater 0 - 92.94 - true + 209.10999999999999 + false false true @@ -84,7 +84,7 @@ HeaterZone3 0 - 39.55 + 96.71 false false true @@ -103,7 +103,7 @@ HeaterZone2 0 - 37.29 + 88.699999999999989 false false true @@ -122,7 +122,7 @@ HeaterZone1 0 - 34.27 + 76.08 false false true @@ -141,7 +141,7 @@ MixerHeater 0 - 54.669999999999995 + 78.37 false false true @@ -179,7 +179,7 @@ HeaterZone5 0 - 43.389999999999993 + 0 false false true @@ -289,7 +289,7 @@ HeaterZone7 0 - 50.449999999999996 + 6.59 false false true @@ -559,7 +559,7 @@ HeadCoverHeater1 0 - 283.75 + 174.69 false false true @@ -578,7 +578,7 @@ HeadCoverHeater2 0 - 283.75 + 174.95999999999998 false false true @@ -654,44 +654,44 @@ -1 - 38e5d1ac-40a5-4c5f-822c-51813cb15b7b - 31 - 144.3584070796461 - 310 - 315.12831858407088 + d2e09fbf-2ac8-4c32-a4f5-45e50e305098 + 1016 + 821.96460176991263 + 361 + 233.95575221238948 0 -14774017 0 - ce709f03-59be-410d-a928-e942c0c46ce3 - 2020-02-09T12:45:24.1272815Z - Process parameters 6 - 50 + 9b265a7c-cc48-4c5a-abed-dfa8c8e3099f + 2020-02-09T13:11:03.3185652Z + Process parameters 2 + 0 0 0 0 - 5000 - 5000 - 80 - 80 - 90 - 110 - 120 - 120 - 135 - 7 - 190 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 100 0 0 0 - 12 + 0 0 - 135 - 125 - 135 - 135 - 140 - 140 + 0 + 0 + 0 + 0 + 0 + 0 0 0 0 @@ -700,159 +700,166 @@ - Process Parameters Tables Group Guid + Name 0 - Name + Dyeing Speed 1 - Table Index + Min Ink Uptake 2 - Dyeing Speed + Max Ink Uptake 3 - Min Ink Uptake + Feeder Tension 4 - Max Ink Uptake + Puller Tension 5 - Feeder Tension + Winder Tension 6 - Puller Tension + Mixer Temp 7 - Winder Tension + Head Zone 1 Temp 8 - Mixer Temp + Head Zone 2 Temp 9 - Head Zone 1 Temp + Head Zone 3 Temp 10 - Head Zone 2 Temp + Head Zone 4 Temp 11 - Head Zone 3 Temp + Head Zone 5 Temp 12 - Head Zone 4 Temp + Head Zone 6 Temp 13 - Head Zone 5 Temp + Dryer Air Flow 14 - Head Zone 6 Temp + Dryer Zone 1 Temp 15 - Head Zone 7 Temp + Dryer Zone 2 Temp 16 - Head Zone 8 Temp + Dryer Zone 3 Temp 17 - Head Zone 9 Temp + Dryer Buffer Length 18 - Head Zone 10 Temp + Head Air Flow 19 - Head Zone 11 Temp + Process Parameters Tables Group Guid 20 - Head Zone 12 Temp + Table Index 21 - - St Sp Zone 1 Temp - 22 - - - St Sp Zone 2 Temp - 23 - - - Dryer Zone 1 Temp - 24 - - - Dryer Zone 2 Temp - 25 - - - Dryer Zone 3 Temp - 26 - - - Dryer Air Flow - 27 - - - Head Air Flow - 28 - - - Dryer Buffer Length - 29 - + + 11f4748e-ed30-48d6-a08a-afeaa0277e2e + 330 + 12.154867256637203 + 205 + 90.181415929203524 + 0 + 1778C1A7-AFB5-42F9-9E00-E80D30D9FC02 + -1 + 10 + 2 + + + dcf78507-ea09-4529-b635-ec1eeed31141 + 145 + 842.58849557522137 + 357 + 215.82743362831855 + 0 + FE0D0A56-5795-4C5A-8E09-939FBB35C441 + -14774017 + 1275 + 0 + 100 + true + 2 + + + 85762a06-25d4-457a-9974-7eab916d65c5 + 540 + 4.0486725663717493 + 205 + 90.181415929203524 + 0 + 055D0A38-09BD-490D-9852-12B06A4B22F2 + -1 + 10 + 0 + - d2e09fbf-2ac8-4c32-a4f5-45e50e305098 - 1016 - 821.96460176991263 - 361 - 233.95575221238948 + 36f69103-89b6-4076-b8f3-bf4a0806ba05 + 18.250000000000007 + 132.59405940594058 + 317.70833333333337 + 392.24752475247521 0 -14774017 0 - 9b265a7c-cc48-4c5a-abed-dfa8c8e3099f - 2020-02-09T13:11:03.3185652Z - Process parameters 2 - 0 + 0025b28d-1475-4af2-b50e-ecc344c3e43a + 2020-07-05T08:17:42.9870702Z + Process parameters 4 + 50 0 0 0 0 0 - 0 - 0 - 0 - 0 + 80 + 80 + 90 + 100 0 0 0 0 - 100 + 180 0 0 0 - 0 + 3 0 0 0 @@ -860,142 +867,147 @@ 0 0 0 - 0 - 0 - 0 - 0 + 180 + 180 + 180 + 180 0 - Name + Process Parameters Tables Group Guid 0 - Dyeing Speed + Name 1 - Min Ink Uptake + Table Index 2 - Max Ink Uptake + Dyeing Speed 3 - Feeder Tension + Min Ink Uptake 4 - Puller Tension + Max Ink Uptake 5 - Winder Tension + Feeder Tension 6 - Mixer Temp + Puller Tension 7 - Head Zone 1 Temp + Winder Tension 8 - Head Zone 2 Temp + Mixer Temp 9 - Head Zone 3 Temp + Head Zone 1 Temp 10 - Head Zone 4 Temp + Head Zone 2 Temp 11 - Head Zone 5 Temp + Head Zone 3 Temp 12 - Head Zone 6 Temp + Head Zone 4 Temp 13 - Dryer Air Flow + Head Zone 5 Temp 14 - Dryer Zone 1 Temp + Head Zone 6 Temp 15 - Dryer Zone 2 Temp + Head Zone 7 Temp 16 - Dryer Zone 3 Temp + Head Zone 8 Temp 17 - Dryer Buffer Length + Head Zone 9 Temp 18 - Head Air Flow + Head Zone 10 Temp 19 - Process Parameters Tables Group Guid + Head Zone 11 Temp 20 - Table Index + Head Zone 12 Temp 21 + + R Blower Flow + 22 + + + R Blower Temp + 23 + + + L Blower Flow + 24 + + + L Blower Temp + 25 + + + Dryer Zone 1 Temp + 26 + + + Dryer Zone 2 Temp + 27 + + + Dryer Zone 3 Temp + 28 + + + Dryer Air Flow + 29 + + + Head Air Flow + 30 + + + Dryer Buffer Length + 31 + + + Pressure Build Up + 32 + - - 11f4748e-ed30-48d6-a08a-afeaa0277e2e - 330 - 12.154867256637203 - 205 - 90.181415929203524 - 0 - 1778C1A7-AFB5-42F9-9E00-E80D30D9FC02 - -1 - 10 - 2 - - - dcf78507-ea09-4529-b635-ec1eeed31141 - 145 - 842.58849557522137 - 357 - 215.82743362831855 - 0 - FE0D0A56-5795-4C5A-8E09-939FBB35C441 - -14774017 - 1275 - 0 - 100 - true - 2 - - - 85762a06-25d4-457a-9974-7eab916d65c5 - 540 - 4.0486725663717493 - 205 - 90.181415929203524 - 0 - 055D0A38-09BD-490D-9852-12B06A4B22F2 - -1 - 10 - 0 - -- cgit v1.3.1 From 4afe631a74c19db1fe7d06d3ea7732decc69f82b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 26 Jul 2020 19:03:22 +0300 Subject: loading improved, actoator relocated. waste alarms --- .../I2C_Communication/Head_Card/IO_Ports/Head_IO.c | 35 ++++++++++---- .../Modules/Diagnostics/DiagnosticActions.c | 5 +- .../Embedded/Modules/IDS/IDS_Cleaning.c | 5 +- .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 3 ++ .../Embedded/Modules/Thread/ThreadLoad.c | 55 ++++++++++++++-------- .../Embedded/Modules/Thread/Thread_init.c | 2 +- .../Embedded/Modules/Waste/Waste_maint.c | 12 ++--- 7 files changed, 80 insertions(+), 37 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c index 691f1c455..1ac0e439b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c @@ -547,6 +547,12 @@ uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) / ACTUATORS Act_ID = (ACTUATORS)(IfIndex); + if (SafeRemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) + ActControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); + + Report("HeadCard_ActStubCallBackFunction",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)Act_ID,0); if(Act_ID == ACTIN)//0 { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTIN_ON = HIGH; @@ -563,6 +569,7 @@ uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) / uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)//ENABLE/DISABLE, DOWN/UP/DONTCARE { uint32_t status = OK; + Report("HeadCard_Actuators_Stub",__FILE__,Act_ID,(int)Enable,RpWarning,(int)Direction,0); if(Enable == true) { @@ -580,7 +587,8 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)/ } //100msec delay - (need short command - Active LOW ) - ActControlId = AddControlCallback("ctuatorControl", HeadCard_ActStubCallBackFunction, (eHundredMillisecond), TemplateDataReadCBFunction,Act_ID,0, 0 ); + if (ActControlId == 0xFF) + ActControlId = AddControlCallback("ctuatorControl", HeadCard_ActStubCallBackFunction, (eHundredMillisecond), TemplateDataReadCBFunction,Act_ID,0, 0 ); } else { @@ -594,6 +602,10 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)/ { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTOT_ON = HIGH; } + if (RemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) + ActControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); } status |= Head_Write_IO_Reg(0x42,HIGH); @@ -693,7 +705,7 @@ uint8_t Head_Test_IO() return status; } -#define ACTUATOR_RELOCATING_MOVEUP_TIME 160 +#define ACTUATOR_RELOCATING_MOVEUP_TIME 16//160 typedef enum { @@ -725,31 +737,38 @@ bool isActuatorOnLowestLocation(void) // Give indication if the actuator stopped uint32_t HeadCard_Actuators_Relocate_callback(uint32_t IfIndex, uint32_t BusyFlag) // use IfIndex for Act_ID { count_time++; + //ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); switch (ActuatorLocating) { case ActuatorIdle: break; case ActuatorMoveDown: - Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); - ActuatorLocating = ActuatorWait; - ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + if (count_time <=1) + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); + if (count_time > 10) + { + ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorWait; + } break; case ActuatorWait: if (isActuatorOnLowestLocation())//read the inputs in Hundred_msTick { - ActuatorLocating = ActuatorMoveUp; Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); moveuptime = count_time; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorMoveUp; } break; case ActuatorMoveUp: if (count_time>=(moveuptime+MovingUpTime)) { Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); - ActuatorLocating = ActuatorLocated; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorLocated; } + else + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); break; case ActuatorLocated: if (SafeRemoveControlCallback(ActuatorLocatingControl, HeadCard_Actuators_Relocate_callback )==OK) @@ -770,7 +789,7 @@ uint32_t HeadCard_Actuators_Relocate(void) ActuatorLocating = ActuatorMoveDown; count_time = 0; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); - ActuatorLocatingControl = AddControlCallback("Actuator Location", HeadCard_Actuators_Relocate_callback, eOneMillisecond, TemplateDataReadCBFunction,0,0, 0 ); + ActuatorLocatingControl = AddControlCallback("Actuator Location", HeadCard_Actuators_Relocate_callback, eTenMillisecond, TemplateDataReadCBFunction,0,0, 0 ); } return ActuatorLocatingControl; } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index 7bda97734..9e7ab1e56 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -232,7 +232,10 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) Pumps_Control(WASTECH_PUMP2, request->value); break; case INTERFACE_IOS__GPO_LED3: - Trigger_Head_Actuators_Control(ACTIN, LOW,request->value); + if (request->value == true) + Trigger_Head_Actuators_Control(ACTIN, LOW,request->value); + else + HeadCard_Actuators_Relocate(); break; case INTERFACE_IOS__GPO_LED4: Trigger_Head_Actuators_Control(ACTOT, LOW,request->value); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index 0be1e7ebe..c9e9afdde 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -101,8 +101,9 @@ uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callbac uint32_t status = OK; //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].directionthreadwize, SaveRightRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD], callback,timeout); //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].directionthreadwize, SaveLeftRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH], callback,timeout); - Trigger_Head_Actuators_Disable(); - Trigger_Head_Actuators_Control(ACTIN, LOW,false); + HeadCard_Actuators_Relocate(); + //Trigger_Head_Actuators_Disable(); + //Trigger_Head_Actuators_Control(ACTIN, LOW,false); CleaningStageCounter = 0; CleaningStage = CleaningStageIdle; Report("IDS_Cleaning_Center_And_Stop_Rockers actuator down", __FILE__, __LINE__, timeout, RpWarning, 123456, 0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 3a7045a6e..c912bca21 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -85,5 +85,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea void SetOriginMotorSpeed(float process_speed); +uint32_t ThreadPrepare_Tension (int DancerId, double tension); + + #endif //MODULES_THREAD_THREAD_H_ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 2c8db8b6c..f95420725 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -236,6 +236,7 @@ //storeLoadArmParameters(); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop); SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home + MotorAbortMovetoLimitSwitch(HARDWARE_MOTOR_TYPE__MOTO_SCREW); return OK; } @@ -461,23 +462,35 @@ uint32_t Thread_Load_Close_Dancers(void) //Send Dancer Motors To Preset Location, Check That The Dancers Are On The Thread { + uint32_t current = 0; REPORT_MSG(LoadStages, "Thread Load State Machine step Thread_Load_Close_Dancers"); CallbackCounter++; MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000); - CallbackCounter++; - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, 500); // MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); - MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, ((int)windertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); - status |= MCU_E2PromProgram(EEPROM_WINDER_TENSION_POSITION,(int)windertension); - if (Is_PP_Machine() == true) //PP machine - new LTFU + status |= MCU_E2PromRead(EEPROM_WINDER_TENSION_POSITION,¤t); + + ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__LeftDancer, windertension); +/* if (current!=windertension) { CallbackCounter++; - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, 500); - MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].directionthreadwize, ((int)pullertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].microstep), Thread_Load_HomingCallback,20000); - status |= MCU_E2PromProgram(EEPROM_PULLER_TENSION_POSITION,(int)pullertension); - } + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, 500); + MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, ((int)windertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); + status |= MCU_E2PromProgram(EEPROM_WINDER_TENSION_POSITION,(int)windertension); + }*/ + if (Is_PP_Machine() == true) //PP machine - new LTFU + { + ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__MiddleDancer, pullertension); + /*status |= MCU_E2PromRead(EEPROM_PULLER_TENSION_POSITION,¤t); + if (current!=pullertension) + { + CallbackCounter++; + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, 500); + MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].directionthreadwize, ((int)pullertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].microstep), Thread_Load_HomingCallback,20000); + status |= MCU_E2PromProgram(EEPROM_PULLER_TENSION_POSITION,(int)pullertension); + }*/ + } return OK; } uint32_t Thread_Load_Close_Lids(void) @@ -507,7 +520,8 @@ { Report("Thread_Load_Close_actuators",__FILE__,__LINE__,LOW,RpMessage,true,0); Trigger_Head_Actuators_Control(ACTOT, LOW,false); - Trigger_Head_Actuators_Control(ACTIN, LOW,false); + //Trigger_Head_Actuators_Control(ACTIN, LOW,false); + HeadCard_Actuators_Relocate(); } return OK; } @@ -515,6 +529,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step Thread_Load_Resume_Heating"); ActivateHeadMagnet(); + HeadCard_Actuators_Relocate(); if (HandleProcessParameters(&ProcessParametersRecover,false)!= OK) { @@ -624,6 +639,7 @@ { return OK; } + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles); if (numberOfCycles MotorControlConfig[index].m_ingnoreValue) + if (fabs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) { CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index e1f887303..39ff91558 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -145,7 +145,7 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) NormalizedErrorCoEfficient[Motor_i] = NormalizedErrorCoEfficient[Motor_i] / temp; // uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); - temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm*3/2); + temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm);//*3/2); DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 40e23e0b3..de95ddb03 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -397,12 +397,6 @@ void Waste_StateMachine(void) break; } - //check door - if (DoorState == OPEN) { - Report("Close cartridge cover", __FILE__, __LINE__, DoorState, RpMessage, 0, 0); - break; - } - // select cartridge SelectedCard = cartSELECT_CART(); if (SelectedCard == MaxWasteCartridges) { @@ -413,6 +407,12 @@ void Waste_StateMachine(void) AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } + //check door + //moved door handling down - I want to see the alarm even if the door is open + if (DoorState == OPEN) { + Report("Close cartridge cover", __FILE__, __LINE__, DoorState, RpMessage, 0, 0); + break; + } //check RFID? (TBD) //move to next state -- cgit v1.3.1 From d113295a432e33e6b7ccbcc948342d7f570d461c Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 2 Aug 2020 08:26:40 +0300 Subject: Version 1.4.6.36 and procedures --- .../I2C_Communication/Head_Card/IO_Ports/Head_IO.c | 22 ++++++++++----- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 4 +++ .../Embedded/Modules/Diagnostics/Diagnostics.c | 12 +++++++++ Software/Embedded_SW/Embedded/Modules/IDS/IDS.h | 4 +-- .../Embedded/Modules/IDS/IDS_Cleaning.c | 13 +++++---- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 13 ++++----- Software/Embedded_SW/Embedded/Modules/IFS/ifs.h | 2 +- .../Embedded/Modules/Thread/Thread_init.c | 4 +++ .../Embedded/Modules/Thread/Thread_print.c | 2 +- .../Embedded_SW/Embedded/Modules/Waste/Waste_ex.h | 1 + .../Embedded/Modules/Waste/Waste_maint.c | 14 ++++++---- .../StateMachines/Initialization/InitSequence.c | 1 + .../Embedded/StateMachines/Printing/JobSTM.c | 8 +++--- .../Procedures/ConnectionType.pproj | 1 + .../Procedures/Dancers calibration.pproj | 2 +- .../Procedures/EmbeddedParametersBuild.pproj | 2 +- .../Procedures/Selection Input.pproj | 1 + .../Procedures/WHS Loop Disable.pproj | 2 +- Software/Stubs Collection/Procedures/demo.pproj | 1 + Software/Stubs Collection/WHS_EEPROM.cs | 31 ---------------------- .../Stubs Collection/stubs/Set CleaningSequence.cs | 23 ++++++++++++++++ Software/Stubs Collection/stubs/WHS_EEPROM.cs | 31 ++++++++++++++++++++++ .../stubs/embeddedparametersbuild_w_cleaning.cs | 2 +- 23 files changed, 128 insertions(+), 68 deletions(-) create mode 100644 Software/Stubs Collection/Procedures/ConnectionType.pproj create mode 100644 Software/Stubs Collection/Procedures/Selection Input.pproj create mode 100644 Software/Stubs Collection/Procedures/demo.pproj delete mode 100644 Software/Stubs Collection/WHS_EEPROM.cs create mode 100644 Software/Stubs Collection/stubs/Set CleaningSequence.cs create mode 100644 Software/Stubs Collection/stubs/WHS_EEPROM.cs (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c index 1ac0e439b..c222521e7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c @@ -552,7 +552,7 @@ uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) / else Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); - Report("HeadCard_ActStubCallBackFunction",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)Act_ID,0); + //Report("HeadCard_ActStubCallBackFunction",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)Act_ID,0); if(Act_ID == ACTIN)//0 { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTIN_ON = HIGH; @@ -602,10 +602,13 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)/ { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTOT_ON = HIGH; } - if (RemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) - ActControlId = 0xFF; - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); + if (ActControlId != 0xFF) + { + if (RemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) + ActControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); + } } status |= Head_Write_IO_Reg(0x42,HIGH); @@ -737,7 +740,7 @@ bool isActuatorOnLowestLocation(void) // Give indication if the actuator stopped uint32_t HeadCard_Actuators_Relocate_callback(uint32_t IfIndex, uint32_t BusyFlag) // use IfIndex for Act_ID { count_time++; - //ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); switch (ActuatorLocating) { case ActuatorIdle: @@ -784,13 +787,18 @@ uint32_t HeadCard_Actuators_Relocate_callback(uint32_t IfIndex, uint32_t BusyFla } uint32_t HeadCard_Actuators_Relocate(void) { - if ((ActuatorLocating == ActuatorIdle)||(ActuatorLocating == ActuatorLocated)) + //if ((ActuatorLocating == ActuatorIdle)||(ActuatorLocating == ActuatorLocated)) { + Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); ActuatorLocating = ActuatorMoveDown; count_time = 0; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); ActuatorLocatingControl = AddControlCallback("Actuator Location", HeadCard_Actuators_Relocate_callback, eTenMillisecond, TemplateDataReadCBFunction,0,0, 0 ); } + /*else + { + ReportWithPackageFilter(ThreadFilter,"actuators relocation FAILED",__FILE__,__LINE__,ActuatorLocating,RpMessage,count_time,0); + }*/ return ActuatorLocatingControl; } diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index cc8ae5be8..07df07309 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -967,6 +967,10 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) } } } + if (Configured[Module_Waste]) + { + FoundReason = Waste_Prepare(); + } if ((AlarmState[Alarm_i].Status == true)&&(FoundReason == JOB_OK)) { if(AlarmItem[Alarm_i].Severity>=DEBUG_LOG_CATEGORY__Error) diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 1f5093601..0e91f4211 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -147,6 +147,7 @@ double dispenser8motorfrequency[DIAGNOSTICS_LIMIT+1]; Task_Handle Diagnostics_Task_Handle; Mailbox_Handle DiagnosticsMsgQ = NULL; +extern uint8_t Head_Fan_PWM_Command[2] ; bool blowervolatgedisplay = false; bool midtankDisplay = false; double diagvoltage = 0; @@ -262,6 +263,7 @@ uint8_t MotorCounterIndex[MAX_THREAD_MOTORS_NUM]= {0,0,0}; double MotorValue[MAX_THREAD_MOTORS_NUM][DIAGNOSTICS_LIMIT+1]; uint8_t SpeedCounterIndex= 0; double SpeedValue[DIAGNOSTICS_DANCER_LIMIT+1]; +double headblowervoltage1 = 0.0, headblowervoltage2 = 0.0; void DiagnosticLoadMotor(int MotorId, int frequency) { @@ -499,6 +501,16 @@ void CopyTemperaturesToMonitor(void) DiagnosticsMonitor.headblower1airflow = HeaterTemperature[HEATER_TYPE__HeaterZone5]; DiagnosticsMonitor.headblower2airflow = HeaterTemperature[HEATER_TYPE__HeaterZone7]; } + DiagnosticsMonitor.n_headblower1airflow = HeaterCounterIndex[HEATER_TYPE__HeaterZone5]; + DiagnosticsMonitor.n_headblower2airflow = HeaterCounterIndex[HEATER_TYPE__HeaterZone7]; + DiagnosticsMonitor.headblower1airflow = HeaterTemperature[HEATER_TYPE__HeaterZone5]; + DiagnosticsMonitor.headblower2airflow = HeaterTemperature[HEATER_TYPE__HeaterZone7]; + headblowervoltage1 =(double )Head_Fan_PWM_Command[HEAD_FAN_RIGHT]; + headblowervoltage2 =(double )Head_Fan_PWM_Command[HEAD_FAN_LEFT]; + DiagnosticsMonitor.headblowervoltage1 = &headblowervoltage1; + DiagnosticsMonitor.headblowervoltage2 = &headblowervoltage2; + DiagnosticsMonitor.n_headblowervoltage1 = 1; + DiagnosticsMonitor.n_headblowervoltage2 = 1; DiagnosticsMonitor.dryerzone1temperature = HeaterTemperature[HEATER_TYPE__DryerAirHeater]; DiagnosticsMonitor.dryerzone2temperature = diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index 647797b69..a48e0df0c 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -49,8 +49,8 @@ void IDS_Dispenser_RefillEnded (char DispenserId,char MicroSteps); //uint32_t IDS_Dispenser_Build_Pressure(int DispenserId, callback_fptr callback); uint32_t IDS_Cleaning_Move_Actuators(void); -uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed); -uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callback); +//uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed); +//uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callback); uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback); uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index c9e9afdde..c6be46bca 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -83,7 +83,7 @@ uint32_t IDS_Cleaning_Move_Actuators() return OK; } -uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) +/*uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) { uint32_t status = OK; SaveLeftRockerSpeed = LeftRockerSpeed; @@ -109,7 +109,7 @@ uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callbac Report("IDS_Cleaning_Center_And_Stop_Rockers actuator down", __FILE__, __LINE__, timeout, RpWarning, 123456, 0); return status; -} +}*/ uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback) { uint32_t status = OK; @@ -128,11 +128,10 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback) uint32_t status = OK; status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANER_DISPENSER,callback); Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, status, 0); - if(Head_Type == HEAD_TYPE_SYLKO) - { - Trigger_Head_Actuators_Control(ACTIN, LOW,false); - Report("IDS_Cleaning_MoveDown cleaning stop", __FILE__, __LINE__, Tdelay1, RpWarning, CleaningStageCounter, 0); - } + HeadCard_Actuators_Relocate(); + CleaningStageCounter = 0; + CleaningStage = CleaningStageIdle; + Report("IDS_Cleaning_Stop_Cleaning_Solution actuator relocate", __FILE__, __LINE__, CleaningStage, RpWarning, CleaningStageCounter, 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 311f16a19..c8e3d267e 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -583,7 +583,7 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; MotorStop(HW_Motor_Id, Hard_Hiz); CurrentDispenserSpeed[CLEANER_DISPENSER] = 0; - Report("IDS stop cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); + //Report("IDS stop cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); } if ((NumofReadyDispensers)&&(DispenserBuildTimeCounter%1000 == 0)) @@ -1605,7 +1605,8 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) #else Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); #endif - IDS_Cleaning_Stop_Cleaning_Solution(NULL); + if (CurrentDispenserSpeed[CLEANER_DISPENSER]>0) + IDS_Cleaning_Stop_Cleaning_Solution(NULL); SegmentNumOfBrushStops = Segment->n_brushstops; BrushStopTime = Segment->length*1000/(double)SegmentNumOfBrushStops; //brushstop in meters //brushstop in millisecond BrushStopTime = ((BrushStopTime*100)/dyeingspeed);//brushstop in seconds @@ -1632,7 +1633,6 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) if (DispenserPreSegmentControlId != 0xFF) { Report("IDS presegment not yet ended!!",__FILE__,DispenserPreSegmentControlId,(int)InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); - //IDS_Cleaning_Stop_Cleaning_Solution (NULL); RemoveControlCallback(DispenserPreSegmentControlId, IDSPreSegmentStateCallbackRunner ); DispenserPreSegmentControlId = 0xFF; } @@ -1751,8 +1751,8 @@ 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) - IDS_HomeDispenser (deviceID, 1000 , NULL); + if (deviceID!=LUBRICANT_DISPENSER) + IDS_HomeDispenser (deviceID, 1000 , NULL); } return OK; } @@ -1826,6 +1826,7 @@ uint32_t IDS_StopLubrication(void) Lubricant_2Way_Valve (STOP); IDS_Dispenser_Close_Valve_And_Stop_Motor(LUBRICANT_DISPENSER,IDS_Valve_EndValveReady); CurrentDispenserSpeed[LUBRICANT_DISPENSER] = 0; - REPORT_MSG (lubricant_speed, "IDS_StopLubrication"); + IDS_HomeDispenser (LUBRICANT_DISPENSER, 1000 , NULL); + REPORT_MSG (lubricant_speed, "IDS_StopLubrication and home dispenser"); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h index 55d712412..1edc03264 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h @@ -12,7 +12,7 @@ #define MODULES_IFS_IFS_H_ #define CARTRIDGE_INK_TIMEOUT 420 -#define MidTank_Pressure_EMPTY 0.5 +#define MidTank_Pressure_EMPTY 0.3 #define CARTRIDGE_CAPATICY 1500 typedef enum{ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 39ff91558..bbb3e4040 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -146,6 +146,10 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) // uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm);//*3/2); + if (Motor_i == WINDER_MOTOR) + { + temp = temp*3/2; + } DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index c67619e20..f403eeeab 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -723,7 +723,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { if (calculated_speed>(CurrentControlledSpeed[index]+100)) { - ReportWithPackageFilter(ThreadFilter,"limit acceleration",__FILE__,calculated_speed,CurrentControlledSpeed[index],RpError,CurrentControlledSpeed[index]+100,0); + ReportWithPackageFilter(ThreadFilter,"limit acceleration",__FILE__,calculated_speed,CurrentControlledSpeed[index],RpError,index,0); calculated_speed=CurrentControlledSpeed[index]+100; } CurrentControlledSpeed[index] = calculated_speed; diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h index af4bd5e08..ee9f668db 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h @@ -44,6 +44,7 @@ bool WHS_IsContainerFull(); bool WHS_WasteCartridgeLowerPresent(); bool WHS_WasteCartridgeMiddlePresent(); bool WHS_IsEmptying(); +uint32_t Waste_Prepare(void); #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index d87ebd1a2..c0e51a143 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -500,27 +500,31 @@ void Waste_StateMachine(void) break; } } -void Waste_Prepare(void) +uint32_t Waste_Prepare(void) { //check if the waste is ready to run - waste level not above overflow level and no cartridge in the slots if (wasteLevel > wasteLevelOverflow) { Report("cannot start a job with waste tank overflow", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); JobEndReason = JOB_SAFETY_CRITICAL_ALARM; + usnprintf(AlarmReasonStr, 100, "cannot start a job with waste tank overflow"); AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_OVERFLOW, true); - PrepareReady(Module_Waste,ModuleFail); - return; + //PrepareReady(Module_Waste,ModuleFail); + return JOB_SAFETY_CRITICAL_ALARM; } if ((WHS_IsEmptying())||(NoCartAvailable())) { - PrepareReady(Module_Waste,ModuleDone); + //PrepareReady(Module_Waste,ModuleDone); + return JOB_OK; } else { Report("cannot start a job with cartridges in the IFS", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); JobEndReason = JOB_OTHER_ALARM; AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, true); - PrepareReady(Module_Waste,ModuleFail); + usnprintf(AlarmReasonStr, 100, "cannot start a job with cartridges in the IFS"); + //PrepareReady(Module_Waste,ModuleFail); + return JOB_OTHER_ALARM; } return; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 1dd81d011..30e43fe99 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -590,6 +590,7 @@ void InitSequenceSetStartHeating(bool StartHeating) uint32_t InitSequenceStartHeating(void) { SetMachineReadyForHeating(true); + HeadCard_Actuators_Relocate(); //SetMachineStatus(MACHINE_STATE__Ready); //prevent job while waiting for the cooler if (InitialHeating) diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 106d515ad..33face713 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -207,10 +207,10 @@ static ReturnCode PrepareState(void *JobDetails) { PrepareWaiting[Module_Thread] = ModuleWaiting; } - if (Configured[Module_Waste]) + /*if (Configured[Module_Waste]) { PrepareWaiting[Module_Waste] = ModuleWaiting; - } + }*/ if (Configured[Module_Winder]) { PrepareWaiting[Module_Winder] = ModuleWaiting; @@ -243,8 +243,8 @@ static ReturnCode PrepareState(void *JobDetails) SendJobProgress(0.0, 0, false, "Winder prepare failed !!!!"); } } - if (Configured[Module_Waste]) - Waste_Prepare(); + //if (Configured[Module_Waste]) + // Waste_Prepare(); return retcode; } diff --git a/Software/Stubs Collection/Procedures/ConnectionType.pproj b/Software/Stubs Collection/Procedures/ConnectionType.pproj new file mode 100644 index 000000000..9f87f5e00 --- /dev/null +++ b/Software/Stubs Collection/Procedures/ConnectionType.pproj @@ -0,0 +1 @@ +{"$id":"1","Name":"untitled","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Name":"Program.csx","IsEntryPoint":true,"Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\t\t\r\n //Connection check example.\r\n \r\n if (context.IsConnected) //Check if there is an active machine connection.\r\n {\r\n \tif (context.ConnectionType == MachineConnectionTypes.Wifi) //Check enumeration of the active connection type.\r\n \t{\r\n \t\tcontext.WriteLine(\"The machine is connected via WiFi\");\t\r\n \t}\r\n }\r\n\r\n }\r\n}"},{"$id":"4","Name":"Service.csx","IsEntryPoint":false,"Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}"}]},"Inputs":{"$id":"5","$values":[]},"ReferenceAssemblies":{"$id":"6","$values":[{"$id":"7","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"8","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"9","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"11","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"12","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"18","$values":[]},"ID":"d6aaf6ec-2a05-4edb-b150-fef4487acd80","ApartmentState":"STA"} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/Dancers calibration.pproj b/Software/Stubs Collection/Procedures/Dancers calibration.pproj index e906c6329..42ce82244 100644 --- a/Software/Stubs Collection/Procedures/Dancers calibration.pproj +++ b/Software/Stubs Collection/Procedures/Dancers calibration.pproj @@ -1 +1 @@ -{"$id":"1","Name":"Dancers calibration","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n\t\tvar response1 = context.ShowQuestion(\"Please Enter Password:\");\r\n\t\tif (response1. \"Aa123456\")\r\n\t\t{\r\n\t\t\tcontext.WriteLine(response1);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tcontext.RequestTimeout = 2000;\r\n\t\t\t//for (int i = 0; i < 100; i++)\r\n\t\t\t{\r\n\t\t\t\tvar response = context.Send(\"StubDancerPositionRequest\" ,0);\r\n\t\t\t\tThread.Sleep(1000);\r\n\t\t\t\t response = context.Send(\"StubDancerPositionRequest\" ,1);\r\n\t\t\t\tThread.Sleep(1000);\r\n\t\t\t\t response = context.Send(\"StubDancerPositionRequest\" ,2);\r\n\t\t\t\tThread.Sleep(1000);\r\n\t\t\t}\r\n\t }\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[]},"ReferenceAssemblies":{"$id":"6","$values":[{"$id":"7","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"8","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"9","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"11","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"12","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"ApartmentState":"MTA"} \ No newline at end of file +{"$id":"1","Name":"Dancers calibration","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n\t\tstring response1 = context.GetInput(\"ValidationPassword\");\r\n List list = new List();\r\n\t\tif (response1 == \"Aa123456\")\r\n\t\t{\r\n\t\t\tcontext.WriteLine(response1);\r\n\t\t\t\r\n\t\t\t\tStubDancerPositionResponse response = context.Send(\"StubDancerPositionRequest\" ,0);\r\n\t\t\t\tThread.Sleep(100);\r\n\t\t\t\tlist.Add (response.Position);\r\n\t\t\t\t response = context.Send(\"StubDancerPositionRequest\" ,1);\r\n\t\t\t\tThread.Sleep(100);\r\n\t\t\t\tThread.Sleep(100);\r\n\t\t\t\t response = context.Send(\"StubDancerPositionRequest\" ,2);\r\n\t\t\t\tThread.Sleep(100);\r\n\t\t\t\tThread.Sleep(100);\r\n\r\n context.AddResult(ResultType.Passed, \"Array Result\", list);\r\n\r\n\t }\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[{"$id":"6","Type":"Default","SelectionInputs":{"$id":"7","$values":[]},"DisplayName":"Validation Password","Description":"Validation Password","Key":"ValidationPassword","Value":"0"}]},"ReferenceAssemblies":{"$id":"8","$values":[{"$id":"9","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"11","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"12","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"17","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"18","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"19","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"20","$values":[]},"ID":"23b690b1-bd08-45ba-807b-3faa244ed8c3","ApartmentState":"MTA"} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/EmbeddedParametersBuild.pproj b/Software/Stubs Collection/Procedures/EmbeddedParametersBuild.pproj index 0b1371bbb..baaa990cc 100644 --- a/Software/Stubs Collection/Procedures/EmbeddedParametersBuild.pproj +++ b/Software/Stubs Collection/Procedures/EmbeddedParametersBuild.pproj @@ -1 +1 @@ -{"$id":"1","Name":"EmbeddedParametersBuild","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.IO;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.PMR.EmbeddedParameters;\r\nusing Tango.PMR.IO;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n context.AddResult(ResultType.Passed, \"My Value Name\", \"Test for this value has passed.\");\r\n\t\tConfigurationParameters configurationParameters = new ConfigurationParameters();\r\n\r\n\t\tconfigurationParameters.BreakSensorLimit = 10;\r\n\r\n\t\t//how many samples to collect in diagnostics before sending\r\n\t\tconfigurationParameters.DiagnosticCollectionLimit = 3;\r\n\r\n\t\t//how many consecutive readout before declaring DC over/underheat alarm\r\n\t\tconfigurationParameters.OverHeatCountLimit = 3;\r\n\t\tconfigurationParameters.UnderHeatCountLimit = 3;\r\n\r\n\t\t// time of motor activity before opening the valve or after closing the valve, in milliseconds\r\n\t\tconfigurationParameters.CloseValveTimeout = 20;\r\n\t\tconfigurationParameters.OpenValveTimeout = 20;\r\n\r\n\t\t//backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters)\r\n\t\tconfigurationParameters.InitialDispenserPressure = 0.25; \r\n\t\tconfigurationParameters.InitialDispenserTimeout = 60000; //20 seconds\r\n\t\tconfigurationParameters.InitialDispenserTimeLag = 100;\r\n\r\n\t\t//job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed\r\n\t\tconfigurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000\r\n\t\tconfigurationParameters.DispenserBuildPressureLimit = 0.85; \r\n\t\tconfigurationParameters.DispenserBuildPressureTimeout = 180000;\r\n\t\tconfigurationParameters.DispenserBuildPressureLag = 100;\r\n\r\n\t\t//temperature band 1000 = 100% - thresholds for job start around target temprature - AC\r\n\t\tconfigurationParameters.ACHeatersLowerOperationLimit = 995;\r\n\t\tconfigurationParameters.ACHeatersUpperOperationLimit = 1005;\r\n\r\n\t\t//temperature band 1000 = 100% - thresholds for job start around target temprature - DC\r\n\t\tconfigurationParameters.DCHeatersLowerOperationLimit = 978;\r\n\t\tconfigurationParameters.DCHeatersUpperOperationLimit = 1005;\r\n\r\n\t\t// mid tank reading offset to add to the readout (OBSOLETE!)\r\n\t\tconfigurationParameters.MidTankPressureCorrection = 0.0;\r\n\r\n\t\t//waste factor for intersegment pressure building\r\n\t\tconfigurationParameters.DispenserPresegmentWFCF = 40;\r\n\t\t//how much time to start the WFCF process (pressure buildup) before segment start\r\n\t\tconfigurationParameters.IDSPreSegmentWFCFTimeBeforeSegment = 12000;\r\n\r\n\t\t//flag: start heaters according to saved process parameters upon init?\r\n\t\tconfigurationParameters.StartHeatingOnInitSequence = true;\r\n\r\n\t\t// current test for the heaters - alarm thresholds\r\n\t\tconfigurationParameters.CurrentAlarmLowLimit = 0.78;\r\n\t\tconfigurationParameters.CurrentAlarmHighLimit = 1.07;\r\n\r\n\t\t//currently not in use\r\n\t\tconfigurationParameters.IDSSegmentRefillTimeout = 5000;\r\n\t\tconfigurationParameters.IDSPreSegmentBuildupTime = 5000;\r\n\t\t//cleaning!!!!!!!!!!\r\n\t\tconfigurationParameters.IDSCleaningSpeed = 800;\r\n\t\tconfigurationParameters.IDSCleaningStopBeforeSegmentTime = 10000; //end of presegemnt\r\n\t\tconfigurationParameters.IDSCleaningStartSprayPreSegmentTime =2000; //beginning of presegment\r\n\r\n\t\tint Tup = 6,Tdelay1 = 26,Tdelay2 = 65;//300 milli up, stay 1 sec, stay down 2 sec\r\n\t\t// Tup = LeftRockerSpeed/100;\r\n\t\t// Tdelay1 = LeftRockerSpeed%100;\r\n\t\t// Tdelay2 = RightRockerSpeed;\r\n\t\tint LeftRockerSpeed = Tup*100+Tdelay1;\r\n\t\tint RightRockerSpeed = Tdelay2;\r\n\r\n\t\tconfigurationParameters.IDSLeftCleaningMotorSpeed = LeftRockerSpeed;\r\n\t\tconfigurationParameters.IDSRightCleaningMotorSpeed = RightRockerSpeed;\r\n\r\n\t\tconfigurationParameters.SwitchToIdleTimeinSeconds = 3600;\r\n\t\tconfigurationParameters.IdleDrierTemperature = 80;\r\n\t\tconfigurationParameters.IdleHeadTemperature = 80;\r\n\t\tconfigurationParameters.IdleMixerTemperature = 0;\r\n\t\tconfigurationParameters.PowerOffTemperatureLimit = 60;\r\n\r\n\t\t//general parameters, ORDER MUST BE PRESERVED!!!!\r\n\t\t//check the dispensers hard limit alarms\r\n\t\t/*1*/\r\n\t\tDouble checkHardLimitAlarms = new Double();\r\n\r\n\t\tcheckHardLimitAlarms = 1.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkHardLimitAlarms);\r\n\r\n\t\t/*2*/\r\n\t\tDouble checkCurrentAlarms = new Double();\r\n\t\tcheckCurrentAlarms = 0.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkCurrentAlarms);\r\n\t\t//check the tamper alarms\r\n\r\n\t\t/*3*/\r\n\t\tDouble checkTamperAlarms = new Double();\r\n\t\tcheckTamperAlarms = 1.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkTamperAlarms);\r\n\r\n\t\t/*4*/\r\n\t\tDouble checkMotorAlarms = new Double();\r\n\t\tcheckMotorAlarms = 1.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkMotorAlarms);\r\n\r\n\t\t/*5*/\r\n\t\tDouble WinderBackToBaseTime = new Double();\r\n\t\tWinderBackToBaseTime = 820.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(WinderBackToBaseTime);\r\n\r\n\t\t/*6*/\r\n\t\tDouble DispenserInitialPressureSpeed = new Double();\r\n\t\tDispenserInitialPressureSpeed = 1050.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(DispenserInitialPressureSpeed);\r\n\r\n\t\t/*7*/\r\n\t\tDouble SetDiagnosticMode = new Double();\r\n\t\tSetDiagnosticMode = 3.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(SetDiagnosticMode);\r\n\r\n\t\t/*8*/\r\n\t\tDouble SetAutoFill = new Double();\r\n\t\tSetAutoFill = 3.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(SetAutoFill);\r\n\r\n\t\tFile.WriteAllBytes(\"C:/temp/EmbParam.cfg\",configurationParameters.ToBytes());\r\n\r\n\t\tbyte[] fileBytes = File.ReadAllBytes(\"C:/temp/EmbParam.cfg\");\r\n\r\n\r\n\t\tvar config = ConfigurationParameters.Parser.ParseFrom(fileBytes);\r\n\r\n\t\tcontext.Write( config);\r\n\t\tThread.Sleep(1000);\r\n\r\n\r\n\t\tcontext.Write(\"\\n\\n Deleting old file\");\r\n\r\n\t\tDeleteRequest deleteRequest = new DeleteRequest();\r\n\t\tdeleteRequest.Path = \"SYSINFO//EmbParam.cfg\";\r\n\t\tdeleteRequest.Attribute = Tango.PMR.IO.FileAttribute.Unspecified;\r\n\t\tDeleteResponse response5 = context.Send(deleteRequest);\r\n\r\n\r\n\t\tThread.Sleep(1000);\r\n\t\tcontext.Write(\"\\n\\n Loading new file file\");\r\n\r\n\t\tFileUploadRequest fileUploadRequest = new FileUploadRequest();\r\n\t\tfileUploadRequest.Path = \"SYSINFO//EmbParam.cfg\";\r\n\t\tfileUploadRequest.Length = (int)fileBytes.Length;\r\n\t\tFileUploadResponse response2 = context.Send(fileUploadRequest);\r\n\t\tThread.Sleep(1000);\r\n\t\tlong chunk_size = response2.MaxChunkLength;\r\n\r\n\t\tFileStream fs = new FileStream(\"C:/temp/EmbParam.cfg\",FileMode.Open);\r\n\r\n\t\twhile (fs.Position < fs.Length)\r\n\t\t{\r\n\t\t\t\tcontext.Write(\"Position \"+ fs.Position+ \" Length \"+ fs.Length +\"\\n\\n\");\r\n\t\t\t\tFileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest();\r\n\t\t\t\tfileChunkUploadRequest.UploadID = response2.UploadID;\r\n\t\t\t\tbyte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)];\r\n\t\t\t\tfs.Read(chunk,0,chunk.Length);\r\n\t\t\t\tfileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk);\t\r\n\t\t\t\tvar response3 = context.Send(fileChunkUploadRequest);\r\n\t\t\t\tThread.Sleep(2000);\r\n\r\n\t\t}\r\n\r\n\t\t// activating the new file\r\n\t\tProgressRequest progressRequest = new ProgressRequest();\r\n\t\tprogressRequest.Amount = 0xCD;\r\n\t\tprogressRequest.Delay = 0xCD;\r\n\t\tvar response1 = context.Send(progressRequest);\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[]},"ReferenceAssemblies":{"$id":"6","$values":[{"$id":"7","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"8","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"9","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"11","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"12","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"ApartmentState":"MTA"} \ No newline at end of file +{"$id":"1","Name":"EmbeddedParametersBuild","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.IO;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.PMR.EmbeddedParameters;\r\nusing Tango.PMR.IO;\r\nusing Tango.FSE.Procedures;\r\n\r\n\r\npublic class Cleaning\r\n{\r\n\t[Description(\"Actuator Going up time\")]\r\n\tpublic int Tup;\r\n\t[Description(\"Actuator Wait up time\")]\r\n\tpublic int Tdelay1;\r\n\t[Description(\"Actuator Wait Down time\")]\r\n\tpublic int Tdelay2;\r\n}\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n context.AddResult(ResultType.Passed, \"My Value Name\", \"Test for this value has passed.\");\r\n\t\tConfigurationParameters configurationParameters = new ConfigurationParameters();\r\n\r\n\t\tconfigurationParameters.BreakSensorLimit = 10;\r\n\r\n\t\t//how many samples to collect in diagnostics before sending\r\n\t\tconfigurationParameters.DiagnosticCollectionLimit = 3;\r\n\r\n\t\t//how many consecutive readout before declaring DC over/underheat alarm\r\n\t\tconfigurationParameters.OverHeatCountLimit = 3;\r\n\t\tconfigurationParameters.UnderHeatCountLimit = 3;\r\n\r\n\t\t// time of motor activity before opening the valve or after closing the valve, in milliseconds\r\n\t\tconfigurationParameters.CloseValveTimeout = 20;\r\n\t\tconfigurationParameters.OpenValveTimeout = 20;\r\n\r\n\t\t//backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters)\r\n\t\tconfigurationParameters.InitialDispenserPressure = 0.25; \r\n\t\tconfigurationParameters.InitialDispenserTimeout = 60000; //20 seconds\r\n\t\tconfigurationParameters.InitialDispenserTimeLag = 100;\r\n\r\n\t\t//job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed\r\n\t\tconfigurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000\r\n\t\tconfigurationParameters.DispenserBuildPressureLimit = 0.85; \r\n\t\tconfigurationParameters.DispenserBuildPressureTimeout = 180000;\r\n\t\tconfigurationParameters.DispenserBuildPressureLag = 100;\r\n\r\n\t\t//temperature band 1000 = 100% - thresholds for job start around target temprature - AC\r\n\t\tconfigurationParameters.ACHeatersLowerOperationLimit = 995;\r\n\t\tconfigurationParameters.ACHeatersUpperOperationLimit = 1005;\r\n\r\n\t\t//temperature band 1000 = 100% - thresholds for job start around target temprature - DC\r\n\t\tconfigurationParameters.DCHeatersLowerOperationLimit = 978;\r\n\t\tconfigurationParameters.DCHeatersUpperOperationLimit = 1005;\r\n\r\n\t\t// mid tank reading offset to add to the readout (OBSOLETE!)\r\n\t\tconfigurationParameters.MidTankPressureCorrection = 0.0;\r\n\r\n\t\t//waste factor for intersegment pressure building\r\n\t\tconfigurationParameters.DispenserPresegmentWFCF = context.GetInput(\"WCF_Value\");\r\n\r\n\t\t//how much time to start the WFCF process (pressure buildup) before segment start\r\n\t\tconfigurationParameters.IDSPreSegmentWFCFTimeBeforeSegment = 12000;\r\n\r\n\t\t//flag: start heaters according to saved process parameters upon init?\r\n\t\tconfigurationParameters.StartHeatingOnInitSequence = context.GetInput(\"InitialHeating\");\r\n\r\n\t\t// current test for the heaters - alarm thresholds\r\n\t\tconfigurationParameters.CurrentAlarmLowLimit = 0.78;\r\n\t\tconfigurationParameters.CurrentAlarmHighLimit = 1.07;\r\n\r\n\t\t//currently not in use\r\n\t\tconfigurationParameters.IDSSegmentRefillTimeout = 5000;\r\n\t\tconfigurationParameters.IDSPreSegmentBuildupTime = 5000;\r\n\t\t//cleaning!!!!!!!!!!\r\n\t\tconfigurationParameters.IDSCleaningSpeed = 800;\r\n\t\tconfigurationParameters.IDSCleaningStopBeforeSegmentTime = 10000; //end of presegemnt\r\n\t\tconfigurationParameters.IDSCleaningStartSprayPreSegmentTime =2000; //beginning of presegment\r\n\r\n Cleaning Clean = new Cleaning();\r\n\t\tClean.Tup = 10;\r\n\t\tClean.Tdelay1 = 98;\r\n\t\tClean.Tdelay2 = 198;//300 milli up, stay 1 sec, stay down 2 sec\r\n Clean =\tcontext.RequestUserInputFor(Clean,\"Cleaning Input Required\",\"Please fill in the form\");\r\n\r\n\t\t// Tup = LeftRockerSpeed/100;\r\n\t\t// Tdelay1 = LeftRockerSpeed%100;\r\n\t\t// Tdelay2 = RightRockerSpeed;\r\n\t\tint LeftRockerSpeed = Clean.Tup*100+Clean.Tdelay1;\r\n\t\tint RightRockerSpeed = Clean.Tdelay2;\r\n\r\n\t\tconfigurationParameters.IDSLeftCleaningMotorSpeed = LeftRockerSpeed;\r\n\t\tconfigurationParameters.IDSRightCleaningMotorSpeed = RightRockerSpeed;\r\n\r\n\t\tconfigurationParameters.SwitchToIdleTimeinSeconds = 3600;\r\n\t\tconfigurationParameters.IdleDrierTemperature = 80;\r\n\t\tconfigurationParameters.IdleHeadTemperature = 80;\r\n\t\tconfigurationParameters.IdleMixerTemperature = 0;\r\n\t\tconfigurationParameters.PowerOffTemperatureLimit = 60;\r\n\r\n\t\t//general parameters, ORDER MUST BE PRESERVED!!!!\r\n\t\t//check the dispensers hard limit alarms\r\n\t\t/*1*/\r\n\r\n\t\tconfigurationParameters\t= context.RequestUserInputFor(configurationParameters,\"ConfigurationParameters Input Required\",\"Please fill in the form\");\r\n\r\n\t\tDouble checkHardLimitAlarms = new Double();\r\n\r\n\t\tcheckHardLimitAlarms = 1.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkHardLimitAlarms);\r\n\r\n\t\t/*2*/\r\n\t\tDouble checkCurrentAlarms = new Double();\r\n\t\tcheckCurrentAlarms = 0.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkCurrentAlarms);\r\n\t\t//check the tamper alarms\r\n\r\n\t\t/*3*/\r\n\t\tDouble checkTamperAlarms = new Double();\r\n\t\tcheckTamperAlarms = context.GetInput(\"CheckTampers\");\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkTamperAlarms);\r\n\r\n\t\t/*4*/\r\n\t\tDouble checkMotorAlarms = new Double();\r\n\t\tcheckMotorAlarms = 1.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(checkMotorAlarms);\r\n\r\n\t\t/*5*/\r\n\t\tDouble WinderBackToBaseTime = new Double();\r\n\t\tWinderBackToBaseTime = 820.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(WinderBackToBaseTime);\r\n\t\t/*6*/\r\n\t\tDouble DispenserInitialPressureSpeed = new Double();\r\n\t\tDispenserInitialPressureSpeed = 1050.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(DispenserInitialPressureSpeed);\r\n\r\n\t\t/*7*/\r\n\t\tDouble SetDiagnosticMode = new Double();\r\n\t\tSetDiagnosticMode = 3.0;\r\n\t\tconfigurationParameters.GeneralParameters.Add(SetDiagnosticMode);\r\n\r\n\t\t/*8*/\r\n\t\tDouble SetAutoFill = new Double();\r\n\t\tSetAutoFill = context.GetInput(\"AutoFillMode\");\r\n\t\tconfigurationParameters.GeneralParameters.Add(SetAutoFill);\r\n\t\tFile.WriteAllBytes(\"C:/temp/EmbParam.cfg\",configurationParameters.ToBytes());\r\n\r\n\t\tbyte[] fileBytes = File.ReadAllBytes(\"C:/temp/EmbParam.cfg\");\r\n\r\n\r\n\t\tvar config = ConfigurationParameters.Parser.ParseFrom(fileBytes);\r\n\r\n\t\tcontext.Write( config);\r\n\t\tThread.Sleep(1000);\r\n\r\n\t\r\n\t\tcontext.Write(\"\\n\\n Deleting old file\");\r\n\r\n\t\tDeleteRequest deleteRequest = new DeleteRequest();\r\n\t\tdeleteRequest.Path = \"SYSINFO//EmbParam.cfg\";\r\n\t\tdeleteRequest.Attribute = Tango.PMR.IO.FileAttribute.Unspecified;\r\n\t\tDeleteResponse response5 = context.Send(deleteRequest);\r\n\r\n\r\n\t\tThread.Sleep(1000);\r\n\t\tcontext.Write(\"\\n\\n Loading new file file\");\r\n\r\n\t\tFileUploadRequest fileUploadRequest = new FileUploadRequest();\r\n\t\tfileUploadRequest.Path = \"SYSINFO//EmbParam.cfg\";\r\n\t\tfileUploadRequest.Length = (int)fileBytes.Length;\r\n\t\tFileUploadResponse response2 = context.Send(fileUploadRequest);\r\n\t\tThread.Sleep(1000);\r\n\t\tlong chunk_size = response2.MaxChunkLength;\r\n\r\n\t\tFileStream fs = new FileStream(\"C:/temp/EmbParam.cfg\",FileMode.Open);\r\n\r\n\t\twhile (fs.Position < fs.Length)\r\n\t\t{\r\n\t\t\t\tcontext.Write(\"Position \"+ fs.Position+ \" Length \"+ fs.Length +\"\\n\\n\");\r\n\t\t\t\tFileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest();\r\n\t\t\t\tfileChunkUploadRequest.UploadID = response2.UploadID;\r\n\t\t\t\tbyte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)];\r\n\t\t\t\tfs.Read(chunk,0,chunk.Length);\r\n\t\t\t\tfileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk);\t\r\n\t\t\t\tvar response3 = context.Send(fileChunkUploadRequest);\r\n\t\t\t\tThread.Sleep(2000);\r\n\r\n\t\t}\r\n\r\n\t\t// activating the new file\r\n\t\tProgressRequest progressRequest = new ProgressRequest();\r\n\t\tprogressRequest.Amount = 0xCD;\r\n\t\tprogressRequest.Delay = 0xCD;\r\n\t\tvar response1 = context.Send(progressRequest);\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[{"$id":"6","Type":"Default","SelectionInputs":{"$id":"7","$values":[]},"DisplayName":"Check Tamper / Fan alarms","Description":"Check Tamper / Fan alarms","Key":"CheckTampers","Value":"1.0"},{"$id":"8","Type":"Default","SelectionInputs":{"$id":"9","$values":[]},"DisplayName":"Initial Heating on startup","Description":"Initial Heating on startup","Key":"InitialHeating","Value":"true"},{"$id":"10","Type":"Default","SelectionInputs":{"$id":"11","$values":[]},"DisplayName":"WCF Value","Description":"WCF Value","Key":"WCF_Value","Value":"40"},{"$id":"12","Type":"Default","SelectionInputs":{"$id":"13","$values":[]},"DisplayName":"AutoFill Mode","Description":"Controls the AutoFill Mode","Key":"AutoFillMode","Value":"3.0"}]},"ReferenceAssemblies":{"$id":"14","$values":[{"$id":"15","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"16","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"18","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"19","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"20","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"21","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"22","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"23","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"24","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"25","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"26","$values":[]},"ID":"2bd29884-5eb9-4d27-be4e-6cfa31dc9f66","ApartmentState":"MTA"} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/Selection Input.pproj b/Software/Stubs Collection/Procedures/Selection Input.pproj new file mode 100644 index 000000000..dfe8b2553 --- /dev/null +++ b/Software/Stubs Collection/Procedures/Selection Input.pproj @@ -0,0 +1 @@ +{"$id":"1","Name":"Selection Input","Description":"Selection Input Demonstration","Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n context.AddResult(ResultType.Passed, \"Selection\", context.GetInput(\"select\"));\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[{"$id":"6","Key":"select","Type":"Selection","DisplayName":"Parameter 1","Description":"Controls the 1 parameter.","Value":"Value1","SelectionInputs":{"$id":"7","$values":[{"$id":"8","Name":"Value 1 Name","Value":"Value1"},{"$id":"9","Name":"Value 2 Name","Value":"Value2"}]}},{"$id":"10","Key":"param2","Type":"Default","DisplayName":"Parameter 2","Description":"Controls the 2 parameter.","Value":"0","SelectionInputs":{"$id":"11","$values":[]}}]},"ReferenceAssemblies":{"$id":"12","$values":[{"$id":"13","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"14","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"15","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"16","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"17","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"18","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"19","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"20","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"21","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"22","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"23","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"24","$values":[]},"ID":"9c8ea90a-47ea-45d8-a5b6-06da13e8ddde","ApartmentState":"STA"} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/WHS Loop Disable.pproj b/Software/Stubs Collection/Procedures/WHS Loop Disable.pproj index 046c188a1..f279b5f09 100644 --- a/Software/Stubs Collection/Procedures/WHS Loop Disable.pproj +++ b/Software/Stubs Collection/Procedures/WHS Loop Disable.pproj @@ -1 +1 @@ -{"$id":"1","Name":"WHS Loop Disable","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n\t\tint ControlLoopEnable = 0x1000;\r\n\t\tint ControlLoopDisable = 0x0000;\r\n\t\t\r\n\t\tProgressRequest progressRequest = new ProgressRequest();\r\n\t\tprogressRequest.Amount = 0x3e8;\r\n\t\tprogressRequest.Delay = ControlLoopDisable+2700;\r\n\r\n\tvar response = context.Send(progressRequest);\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[]},"ReferenceAssemblies":{"$id":"6","$values":[{"$id":"7","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"8","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"9","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"11","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"12","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"ApartmentState":"MTA"} \ No newline at end of file +{"$id":"1","Name":"WHS Loop Disable","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n\t\tint ControlLoopEnable = context.GetInput(\"WasteControlLoop\");\r\n\t\t\r\n\t\tProgressRequest progressRequest = new ProgressRequest();\r\n\t\tprogressRequest.Amount = 0x3e8;\r\n\t\tprogressRequest.Delay = ControlLoopEnable*0x1000+2700;\r\n\r\n\tvar response = context.Send(progressRequest);\r\n\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[{"$id":"6","Type":"Default","SelectionInputs":{"$id":"7","$values":[]},"DisplayName":"Waste Control Loop Enabled","Description":"Waste Control Loop Enabled","Key":"WasteControlLoop","Value":"1"}]},"ReferenceAssemblies":{"$id":"8","$values":[{"$id":"9","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"10","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"11","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"12","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"13","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"17","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"18","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"19","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"20","$values":[]},"ID":"eb9234b2-2aa0-4bf2-bfe4-dcc8de49bda6","ApartmentState":"MTA"} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/demo.pproj b/Software/Stubs Collection/Procedures/demo.pproj new file mode 100644 index 000000000..b5be39462 --- /dev/null +++ b/Software/Stubs Collection/Procedures/demo.pproj @@ -0,0 +1 @@ +{"$id":"1","Name":"demo","Description":"Demo project for developers.","Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Program\r\n{\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\r\n context.WriteLine(\"Calculating...\");\r\n context.Sleep(2000);\r\n\r\n double a = context.GetInput(\"n1\");\r\n double b = context.GetInput(\"n2\");\r\n\r\n\r\n double d = context.RequestUserInputFor(20, \"Additional Number\", \"Please provide another value\");\r\n \r\n Person pp = context.RequestUserInputFor(\"Person Input Required\",\"Please fill in the form\");\r\n \r\n if (pp.Name == \"Roy\")\r\n {\r\n \tif (context.ShowWarningQuestion(\"The name Roy is invalid are you sure?\"))\r\n \t{\r\n \t\tcontext.Fail(\"Name Roy is invalid!\");\r\n \t}\r\n }\r\n \r\n\r\n double c = a + b + d;\r\n\r\n\r\n\r\n context.AddResult(ResultType.Passed, \"Calc Result\", c);\r\n context.AddResult(ResultType.Warning, \"Other Value\", \"Some Value\");\r\n\r\n List list = new List();\r\n List persons = new List();\r\n\r\n for (int i = 0; i < 100; i++)\r\n {\r\n list.Add(i);\r\n\r\n Person p = new Person();\r\n p.Age = i;\r\n p.Name = \"Roy \" + i;\r\n persons.Add(p);\r\n }\r\n\r\n double sum = list.Sum();\r\n\r\n context.AddResult(ResultType.Passed, \"Array Result\", list);\r\n context.AddGraphResult(ResultType.Passed, \"Graph Result\", list);\r\n\r\n context.AddResult(ResultType.Passed, \"Persons\", persons);\r\n\r\n Bitmap bitmap = context.CreateBitmap(400, 200);\r\n Graphics g = context.GetDrawingContext(bitmap);\r\n\r\n g.Clear(Color.Blue);\r\n g.FillRectangle(Brushes.Red, 10, 10, 50, 50);\r\n\r\n context.AddBitmapResult(ResultType.Passed, \"Bitmap Demo\", bitmap);\r\n\r\n g.Dispose();\r\n\r\n List dancerValues = new List();\r\n\r\n context.WriteLine(\"Collecting dancer angle...\");\r\n\r\n for (int i = 0; i < 100; i++)\r\n {\r\n DiagnosticsPackage package = context.GetDiagnosticsPackage(true);\r\n double dancerAngle = package.GetMonitorLastValue(TechMonitors.Dancer2Angle);\r\n\r\n dancerValues.Add(dancerAngle);\r\n\r\n context.UpdateProgress(\"Collecting dancer position...\", false, i, 50);\r\n }\r\n\r\n context.AddGraphResult(ResultType.Passed, \"Dancer Angle\", dancerValues);\r\n }\r\n}","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n\tpublic const String WORD = \"123\";\r\n\tpublic const int NUM = 1;\r\n}","Name":"Service.csx","IsEntryPoint":false},{"$id":"5","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Person\r\n{\r\n\tpublic int Age;\r\n\t[Description(\"First Name\")]\r\n\tpublic String Name;\r\n}","Name":"Person.csx","IsEntryPoint":false}]},"Inputs":{"$id":"6","$values":[{"$id":"7","DisplayName":"Number A","Description":"First number for calc","Key":"n1","Value":"10"},{"$id":"8","DisplayName":"Number B","Description":"Second number for calc","Key":"n2","Value":"15"}]},"ReferenceAssemblies":{"$id":"9","$values":[{"$id":"10","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"11","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"12","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"13","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"14","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"15","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"16","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"17","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"18","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"19","File":"C:\\DATA\\Development\\Tango\\Software\\Visual_Studio\\Build\\FSE\\Debug\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"20","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Dialogs":{"$id":"21","$values":[]},"ID":"4d95f6b1-ee07-4bc8-85af-18bc12326f29","ApartmentState":"STA"} \ No newline at end of file diff --git a/Software/Stubs Collection/WHS_EEPROM.cs b/Software/Stubs Collection/WHS_EEPROM.cs deleted file mode 100644 index b5c7af2b1..000000000 --- a/Software/Stubs Collection/WHS_EEPROM.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Text; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -public void OnExecute(StubManager stubManager) -{ - - -StubWhsEEpromRequest stubWhsEEpromRequest = new StubWhsEEpromRequest(); -stubWhsEEpromRequest.BurnRequest = false; // false - read, true - write - -StubWhsEEpromData stubWhsEEpromData = new StubWhsEEpromData(); -stubWhsEEpromData.Header = 1; -stubWhsEEpromData.TableLength = 2; -stubWhsEEpromData.Tableversion = 3; -stubWhsEEpromData.Orifice1Flow = 1067 * 8.7433; //mv * 8.7433 convert from mv to ml (1067 * 8.7433 = 9,329.1011) -stubWhsEEpromData.CheckSum = 5; - -stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; - -var response = stubManager.Run(stubWhsEEpromRequest); - -} \ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Set CleaningSequence.cs b/Software/Stubs Collection/stubs/Set CleaningSequence.cs new file mode 100644 index 000000000..a73134e7b --- /dev/null +++ b/Software/Stubs Collection/stubs/Set CleaningSequence.cs @@ -0,0 +1,23 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.PMR.Stubs; +using Tango.Stubs; + +public void OnExecute(StubManager stubManager) +{ + + +ProgressRequest progressRequest = new ProgressRequest(); +progressRequest.Amount = 0xAD7; +progressRequest.Delay = 0; //disable + +var response = stubManager.Run(progressRequest); + +} \ No newline at end of file diff --git a/Software/Stubs Collection/stubs/WHS_EEPROM.cs b/Software/Stubs Collection/stubs/WHS_EEPROM.cs new file mode 100644 index 000000000..b5c7af2b1 --- /dev/null +++ b/Software/Stubs Collection/stubs/WHS_EEPROM.cs @@ -0,0 +1,31 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.PMR.Stubs; +using Tango.Stubs; + +public void OnExecute(StubManager stubManager) +{ + + +StubWhsEEpromRequest stubWhsEEpromRequest = new StubWhsEEpromRequest(); +stubWhsEEpromRequest.BurnRequest = false; // false - read, true - write + +StubWhsEEpromData stubWhsEEpromData = new StubWhsEEpromData(); +stubWhsEEpromData.Header = 1; +stubWhsEEpromData.TableLength = 2; +stubWhsEEpromData.Tableversion = 3; +stubWhsEEpromData.Orifice1Flow = 1067 * 8.7433; //mv * 8.7433 convert from mv to ml (1067 * 8.7433 = 9,329.1011) +stubWhsEEpromData.CheckSum = 5; + +stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; + +var response = stubManager.Run(stubWhsEEpromRequest); + +} \ No newline at end of file diff --git a/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs b/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs index eaf15b1f6..3b3768310 100644 --- a/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs @@ -76,7 +76,7 @@ configurationParameters.IDSCleaningSpeed = 800; configurationParameters.IDSCleaningStopBeforeSegmentTime = 10000; //end of presegemnt configurationParameters.IDSCleaningStartSprayPreSegmentTime =2000; //beginning of presegment -int Tup = 6,Tdelay1 = 26,Tdelay2 = 65;//300 milli up, stay 1 sec, stay down 2 sec +int Tup = 8,Tdelay1 = 98,Tdelay2 = 198; //350nsec up, 1 second delay, 2 seconds before up again // Tup = LeftRockerSpeed/100; // Tdelay1 = LeftRockerSpeed%100; // Tdelay2 = RightRockerSpeed; -- cgit v1.3.1 From 0c038093d83f8e266f09f489cd93dda3dbc6ab3f Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 27 Aug 2020 16:08:47 +0300 Subject: 4 winders test; keep alive embedded==>management. procedures. --- .../Embedded/Communication/Connection.c | 46 +- .../Embedded/Communication/Connection.h | 1 + .../Embedded_SW/Embedded/Communication/Container.c | 6 +- .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 18 +- .../Embedded/Drivers/SSI_Comm/SSI_Comm.h | 4 +- .../Embedded/Drivers/flash_ram/MCU_E2Prom.h | 2 + .../Embedded/Modules/Control/MillisecTask.c | 9 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 24 + .../Embedded/Modules/General/GeneralHardware.c | 6 + .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 4 +- Software/Embedded_SW/Embedded/Modules/IFS/ifs.h | 1 + .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 2 +- .../Embedded/Modules/Thread/Thread_Winder.c | 22 +- .../Embedded/Modules/Thread/Thread_ex.h | 7 +- .../Embedded/Modules/Thread/Thread_init.c | 64 +- .../Embedded/Modules/Thread/Thread_print.c | 126 ++- .../Embedded/Modules/Waste/Waste_maint.c | 2 +- .../Procedures/Mid tank calibration.pproj | 478 ++++++++- .../Stubs Collection/Procedures/Priming1.pproj | 1015 ++++++++++++++++++++ .../WHS_waste_Tank_Calibration_Save_V0.pproj | 107 +++ 20 files changed, 1879 insertions(+), 65 deletions(-) create mode 100644 Software/Stubs Collection/Procedures/Priming1.pproj create mode 100644 Software/Stubs Collection/Procedures/WHS_waste_Tank_Calibration_Save_V0.pproj (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index aa0db0ea9..c7077124c 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -139,7 +139,7 @@ void DisconnectionRequest(MessageContainer* requestContainer) int KeepAliveOneSecondCounter = 0; #define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 10 bool KeepAliveActive = false; -bool keepalivetest = false; +bool keepalivetest = true; void KeepAliveRequestFunc(MessageContainer* requestContainer) { MessageContainer responseContainer; @@ -158,12 +158,50 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer) SendChars((char*)container_buffer, container_size); //keep_alive_request__free_unpacked(request,NULL); } + +int KARequestId = 0x01010101; +char KARequestToken[36+1]; +void KeepAliveResponseFunc(MessageContainer* requestContainer) +{ + //KeepAliveRequest* request = + KeepAliveResponse *response = keep_alive_response__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + if (strcmp(requestContainer->token,KARequestToken)==0) + { + if (keepalivetest == false) + KeepAliveOneSecondCounter = 0; + KeepAliveActive = true; + //Report("keepalive response received",__FILE__,__LINE__,KARequestId,RpWarning,msec_millisecondCounter, 0); + } + keep_alive_response__free_unpacked(response,NULL); +} + +void KeepAliveRequest1Second(void) +{ + MessageContainer responseContainer; + + KeepAliveResponse request = KEEP_ALIVE_REQUEST__INIT; + + strcpy(KARequestToken,"Happy days are coming to us, soon"); + memcpy(&KARequestToken[32],&KARequestId,sizeof(KARequestId)); + KARequestId++; + //Report("keepalive request sent",__FILE__,__LINE__,KARequestId,RpWarning,msec_millisecondCounter, 0); + + if (keepalivetest == false) + KeepAliveOneSecondCounter = 0; + //KeepAliveActive = true; + responseContainer = createContainer(MESSAGE_TYPE__KeepAliveRequest, KARequestToken, true, &request, &keep_alive_request__pack, &keep_alive_request__get_packed_size); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); +} void KeepAliveOneSecondCall(void) { - if (KeepAliveActive == false) - return; if (FileUploadGetState()==false) return; + KeepAliveRequest1Second(); + if (KeepAliveActive == false) + return; KeepAliveOneSecondCounter++; if (KeepAliveOneSecondCounter > (KEEPALIVE_COMMUNICATION_ABORT_LIMIT/2)) @@ -181,7 +219,7 @@ void KeepAliveOneSecondCall(void) JobStopReporting(); //AlarmHandlingStop(); //CommunicationMailboxFlush(); - keepalivetest = false; + //keepalivetest = false; //USBCDCD_init(); USBCDCD_Reinit(); //UART_ResetBuffers(); diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.h b/Software/Embedded_SW/Embedded/Communication/Connection.h index 8089cd82f..c0a31344f 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.h +++ b/Software/Embedded_SW/Embedded/Communication/Connection.h @@ -12,6 +12,7 @@ void ConnectionRequest(MessageContainer* requestContainer); void DisconnectionRequest(MessageContainer* requestContainer); void KeepAliveRequestFunc(MessageContainer* requestContainer); +void KeepAliveResponseFunc(MessageContainer* requestContainer); void KeepAliveOneSecondCall(void); extern int KeepAliveOneSecondCounter; diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index 64f06a8c5..b14efbd55 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -42,6 +42,7 @@ #include "Modules/General/process.h" #include "Modules/Thread/Thread_ex.h" #include "Modules/Ids/Ids_ex.h" +#include "Modules/Ifs/Ifs.h" #include "Common/SWUpdate/FileSystem.h" #include "Common/SWUpdate/FirmwareUpgrade.h" @@ -142,7 +143,7 @@ void receive_callback(char* buffer, size_t length) if (requestContainer == NULL) return; #ifndef DISPESER_TEST - if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter + if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveResponse)) //user action resets the idle counter { ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); } @@ -411,6 +412,9 @@ void receive_callback(char* buffer, size_t length) case MESSAGE_TYPE__KeepAliveRequest: KeepAliveRequestFunc(requestContainer); break; + case MESSAGE_TYPE__KeepAliveResponse: + KeepAliveResponseFunc(requestContainer); + break; case MESSAGE_TYPE__FileUploadRequest: FileUploadRequestFunc(requestContainer); break; diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c index fda349f69..9c5c52bb9 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -335,13 +335,13 @@ void FPGA_GetBusy() F1MOTNBUSY1 F1_MOT_NBUSY1; F1MOTNBUSY2 F1_MOT_NBUSY2; F2MOTNBUSY1 F2_MOT_NBUSY1; - //F3MOTNBUSY1 F3_MOT_NBUSY1; - for spare motors + F3MOTNBUSY1 F3_MOT_NBUSY1; //- for spare motors F1SPIBUSY1 F1_SPI_BUSY1; F1SPIBUSY2 F1_SPI_BUSY2; F2SPIBUSY1 F2_SPI_BUSY1; F2SPIBUSY2 F2_SPI_BUSY2; - //F3SPIBUSY1 F3_SPI_BUSY1; - for spare motors + F3SPIBUSY1 F3_SPI_BUSY1;// - for spare motors //Read NBUSY from FPGA unsigned short readValue = 0; @@ -351,14 +351,15 @@ void FPGA_GetBusy() F1_MOT_NBUSY2.ushort = (uint16_t) ~((unsigned int) readValue); readValue = F2_Moto_Driver_NBUSY1_D; F2_MOT_NBUSY1.ushort = (uint16_t) ~((unsigned int) readValue); - //F3_MOT_NBUSY1.ushort = F3_Moto_Driver_NBUSY1_D; - for spare motors + readValue = F3_Moto_Driver_NBUSY1_D; + F3_MOT_NBUSY1.ushort = (uint16_t) ~((unsigned int) readValue);; // - for spare motors //Read SPI BUSY from FPGA F1_SPI_BUSY1.ushort = F1_SPI_Busy1_D; F1_SPI_BUSY2.ushort = F1_SPI_Busy2_D; F2_SPI_BUSY1.ushort = F2_SPI_Busy1_D; F2_SPI_BUSY2.ushort = F2_SPI_Busy2_D; - //F3_SPI_BUSY1.ushort = F3_SPI_Busy1_D; - for spare motors + F3_SPI_BUSY1.ushort = F3_SPI_Busy1_D; // - for spare motors MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].Busy = (F1_MOT_NBUSY1.bits.F1_MOTO_DH_CLEANHEAD_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_DH_CLEANHEAD_A1_SDI_busy; MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].Busy = (F1_MOT_NBUSY1.bits.F1_MOTO_DH_CLEANMECH_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_DH_CLEANMECH_A1_SDI_busy; @@ -381,10 +382,17 @@ void FPGA_GetBusy() MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].Busy = (F1_MOT_NBUSY1.bits.F1_MOTO_LDRIVING_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_LDRIVING_A1_SDI_busy; MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].Busy = (F1_MOT_NBUSY1.bits.F1_MOTO_LLOADING_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_LLOADING_A1_SDI_busy; MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_LPIVOT1].Busy = (F1_MOT_NBUSY1.bits.F1_MOTO_LPIVOT1_A1_NBUSY) | F1_SPI_BUSY2.bits.F1_MOTO_LPIVOT1_A1_SDI_busy; - MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].Busy = (F1_MOT_NBUSY2.bits.F1_MOTO_RDANCER_A1_NBUSY) | F1_SPI_BUSY2.bits.F1_MOTO_RDANCER_A1_SDI_busy; + MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].Busy = (F1_MOT_NBUSY2.bits.F1_MOTO_RDANCER_A1_NBUSY) & F1_SPI_BUSY2.bits.F1_MOTO_RDANCER_A1_SDI_busy; MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].Busy = (F1_MOT_NBUSY2.bits.F1_MOTO_RDRIVING_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_RDRIVING_A1_SDI_busy; MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].Busy = (F1_MOT_NBUSY2.bits.F1_MOTO_RLOADING_A1_NBUSY) | F1_SPI_BUSY1.bits.F1_MOTO_RLOADING_A1_SDI_busy; + MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_SPARE1_1].Busy = (F3_MOT_NBUSY1.bits.F3_MOTO_SPARE1_1_A1_NBUSY) | F3_SPI_BUSY1.bits.F3_MOTO_SPARE1_1_A1_SDI_busy; + MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_SPARE1_2].Busy = (F3_MOT_NBUSY1.bits.F3_MOTO_SPARE1_2_A1_NBUSY) | F3_SPI_BUSY1.bits.F3_MOTO_SPARE1_2_A1_SDI_busy; + MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_SPARE2_1].Busy = (F3_MOT_NBUSY1.bits.F3_MOTO_SPARE2_1_A1_NBUSY) | F3_SPI_BUSY1.bits.F3_MOTO_SPARE2_1_A1_SDI_busy; + MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_SPARE2_2].Busy = (F3_MOT_NBUSY1.bits.F3_MOTO_SPARE2_2_A1_NBUSY) | F3_SPI_BUSY1.bits.F3_MOTO_SPARE2_2_A1_SDI_busy; + + + TempSensorResponse[TEMP_SENSE_ANALOG_MIXCHIP_TEMP].Busy = F2_SPI_BUSY1.bits.F2_ANALOG_MIXCHIP_TEMP_1_BUSY; TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP1].Busy = F2_SPI_BUSY1.bits.F2_ANALOG_DYEINGH_TEMP1_1_BUSY; TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP2].Busy = F2_SPI_BUSY1.bits.F2_ANALOG_DYEINGH_TEMP2_1_BUSY; diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h index f726baeb4..79239835f 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h @@ -27,8 +27,8 @@ typedef enum Dancers4Winders { - HARDWARE_DANCER_0 = 0, - HARDWARE_DANCER_1 = 1, + HARDWARE_DANCER_0 = 0, //winder + HARDWARE_DANCER_1 = 1, // puller HARDWARE_DANCER_2 = 2, HARDWARE_DANCER_3 = 3, HARDWARE_DANCER_4 = 4, diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h index bbbc49c7d..3331241cb 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h @@ -42,6 +42,8 @@ typedef enum { EEPROM_PULLER_TENSION_POSITION, EEPROM_WINDER_TENSION_POSITION, EEPROM_INIT_FAILURE_COUNTER, + EEPROM_STORAGE_DANCER_3, + EEPROM_STORAGE_DANCER_4, MAX_EEPROM_STORAGE }EEPROM_STORAGE_USAGE_ENUM; #define MAX_SERIAL_NUM_LEN 5 //5*4 bytes diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 327b5d19b..55148e655 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -496,9 +496,17 @@ uint32_t MillisecLoop(uint32_t tick) #ifdef test_RTFU_dancer test_dancer_responce_RTFU(); #else +#ifdef FOUR_WINDERS + Dancer_Data[HARDWARE_DANCER_0] = Read_Dancer_Position(HARDWARE_DANCER_0); + Dancer_Data[HARDWARE_DANCER_1] = Read_Dancer_Position(HARDWARE_DANCER_1); + Dancer_Data[HARDWARE_DANCER_2] = Read_Dancer_Position(HARDWARE_DANCER_2); + Dancer_Data[HARDWARE_DANCER_3] = Read_Dancer_Position(HARDWARE_DANCER_3); + Dancer_Data[HARDWARE_DANCER_4] = Read_Dancer_Position(HARDWARE_DANCER_4); +#else Dancer_Data[FEEDER_DANCER] = Read_Dancer_Position(FEEDER_DANCER); Dancer_Data[POOLER_DANCER] = Read_Dancer_Position(POOLER_DANCER); Dancer_Data[WINDER_DANCER] = Read_Dancer_Position(WINDER_DANCER); +#endif #endif #endif @@ -732,7 +740,6 @@ uint32_t MillisecLowLoop(uint32_t tick) //static int Counter = 0; MachineUpdateResponseFunc(); //KeepAliveOneSecondCall(); - //TemperatureListString(Lenstr); //ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)Counter++,RpWarning,(int) msec_millisecondCounter,0); for (Sensor_i = StartPT100;Sensor_i < MAX_HEAD_CARD_TEMP_SENS_ID;Sensor_i++) diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index a76142b00..05987ee7f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -17,6 +17,7 @@ #include "drivers/Motors/Motor.h" #include "drivers/Heater/TemperatureSensor.h" #include "drivers/SSI_Comm/Dancer/Dancer.h" +#include #include "drivers/FPGA/FPGA_SPI_Comm.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "drivers/FPGA/FPGA.h" @@ -407,6 +408,9 @@ void DiagnosticLoadDancerError(int DancerId, double value) // DancerErrorCounterIndex[DancerId] = 0; } +#ifdef FOUR_WINDERS + double dancer2,dancer3,dancer4; +#endif void CopyTemperaturesToMonitor(void) { DiagnosticsMonitor.mixertemperature = @@ -511,6 +515,18 @@ void CopyTemperaturesToMonitor(void) DiagnosticsMonitor.headblowervoltage2 = &headblowervoltage2; DiagnosticsMonitor.n_headblowervoltage1 = 1; DiagnosticsMonitor.n_headblowervoltage2 = 1; +#ifdef FOUR_WINDERS +// double dancer2,dancer3,dancer4; + dancer2 = Control_Read_Dancer_Position(HARDWARE_DANCER_2,0); + dancer3 = Control_Read_Dancer_Position(HARDWARE_DANCER_3,0); + dancer4 = Control_Read_Dancer_Position(HARDWARE_DANCER_4,0); + DiagnosticsMonitor.n_headblower1airflow = 1; + DiagnosticsMonitor.n_headblower2airflow = 1; + DiagnosticsMonitor.headblower1airflow = &dancer4; + DiagnosticsMonitor.headblower2airflow = &dancer3; + DiagnosticsMonitor.headblowervoltage1 = &dancer2; + DiagnosticsMonitor.n_headblowervoltage1 = 1; +#endif DiagnosticsMonitor.dryerzone1temperature = HeaterTemperature[HEATER_TYPE__DryerAirHeater]; DiagnosticsMonitor.dryerzone2temperature = @@ -975,11 +991,19 @@ void Diagnostic100msecCollection(void) { //if (JobIsActive()) { +#ifdef FOUR_WINDERS + DiagnosticLoadMotor(FEEDER_MOTOR, ThreadGetMotorSpeed (WINDER_2_MOTOR)); + DiagnosticLoadMotor(DRYER_MOTOR, ThreadGetMotorSpeed (WINDER_3_MOTOR)); + DiagnosticLoadMotor(POOLER_MOTOR, ThreadGetMotorSpeed (WINDER_4_MOTOR)); + DiagnosticLoadMotor(WINDER_MOTOR, ThreadGetMotorSpeed (WINDER_MOTOR)); + DiagnosticLoadMotor(SCREW_MOTOR, ThreadGetMotorSpeed (SCREW_MOTOR)); +#else DiagnosticLoadMotor(FEEDER_MOTOR, ThreadGetMotorSpeed (FEEDER_MOTOR)); DiagnosticLoadMotor(DRYER_MOTOR, ThreadGetMotorSpeed (DRYER_MOTOR)); DiagnosticLoadMotor(POOLER_MOTOR, ThreadGetMotorSpeed (POOLER_MOTOR)); DiagnosticLoadMotor(WINDER_MOTOR, ThreadGetMotorSpeed (WINDER_MOTOR)); DiagnosticLoadMotor(SCREW_MOTOR, ThreadGetMotorSpeed (SCREW_MOTOR)); +#endif } for (i=0;i +#include "drivers/FPGA/Full_Vme/FPGA_Programming_Up.h" #include "StateMachines/Printing/PrintingSTM.h" #include "StateMachines/Initialization/InitSequence.h" @@ -431,6 +432,11 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) LOG_ERROR(1,"JobIsActive"); return ERROR; } + if (FPGABurningActive == true) + { + LOG_ERROR(1,"FPGABurningActive"); + return ERROR; + } if (watchdogCriticalAlarm == true) { LOG_ERROR(1,"Critical Alarm cleared - Watchdog de-activated"); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 9c82cb1bf..c0ccefde1 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -1118,8 +1118,8 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); if (CurrentDispenserSpeed[CLEANER_DISPENSER]>0) IDS_Cleaning_Stop_Cleaning_Solution (NULL); setRapidPressureRead(false); - if (JobEndSequence == true) - DistanceToSpoolReady(Module_IDS,ModuleDone); + //if (JobEndSequence == true) + // DistanceToSpoolReady(Module_IDS,ModuleDone); } if (EnableCleaning == true) { diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h index 1edc03264..0f95fb2e2 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h @@ -27,5 +27,6 @@ void ResponseDemo(int MidtankId); bool IFS_MidTankFilling(void); MidTank_t IFS_MidTankIsActive(void); bool IFS_CartridgeLowerPresent(); +bool CartridgeValidationResponseFunc(MessageContainer* requestContainer); #endif /* MODULES_IFS_IFS_H_ */ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 1f2da8dc0..13032f49d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -54,7 +54,7 @@ typedef struct #define MAX_THREAD_FEED_MOTORS (WINDER_MOTOR+1) -#define MAX_SYSTEM_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1) +#define MAX_SYSTEM_DANCERS NUM_OF_ROTENC extern TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM]; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 1ce27115d..852389001 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -347,10 +347,14 @@ int flipflop = 0; uint32_t motspeed; float speedf; int WinderCalculation = 0; +int MotorOrder[4] = {HARDWARE_MOTOR_TYPE__MOTO_SCREW,SCREW_2_Motor,SCREW_3_Motor,SCREW_4_Motor}; + + uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { //uint32_t Steps; double temp,tempScrewSpeed; + int i,tempmot; //double screw_horizontal_speed = 0; //double RotationsPerSecond; if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) @@ -369,6 +373,14 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; +#ifdef FOUR_WINDERS + tempmot = MotorOrder[0]; + MotorOrder[0] = MotorOrder[1]; + MotorOrder[1] = MotorOrder[2]; + MotorOrder[2] = MotorOrder[3]; + MotorOrder[3] = tempmot; + //Report("order change" ,__FILE__,MotorOrder[0],MotorOrder[1],RpWarning,MotorOrder[2], 0); +#endif if (SampleWinding) return OK; //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; @@ -707,11 +719,13 @@ void ScrewTimerInterrupt(int ARG0) MotorSetDirection (SCREW_3_Motor, ScrewCurrentDirection); MotorSetDirection (SCREW_4_Motor, ScrewCurrentDirection); #endif - MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); #ifdef FOUR_WINDERS - MotorSetSpeedDirect (SCREW_2_Motor, ScrewSpeed); - MotorSetSpeedDirect (SCREW_3_Motor, ScrewSpeed); - MotorSetSpeedDirect (SCREW_4_Motor, ScrewSpeed); + MotorSetSpeedDirect(MotorOrder[0],ScrewSpeed); + MotorSetSpeedDirect (MotorOrder[1], ScrewSpeed); + MotorSetSpeedDirect (MotorOrder[2], ScrewSpeed); + MotorSetSpeedDirect (MotorOrder[3], ScrewSpeed); +#else + MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); #endif #ifdef READ_SCREW_ENCODER Read_Screw_Encoder(); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 4339c5312..c3f181b52 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -9,7 +9,7 @@ #define WINDER_DANCER HARDWARE_DANCER_TYPE__LeftDancer #define POOLER_DANCER HARDWARE_DANCER_TYPE__MiddleDancer #define FEEDER_DANCER HARDWARE_DANCER_TYPE__RightDancer -#define NUM_OF_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1) +#define NUM_OF_DANCERS NUM_OF_ROTENC //} DANCER_ENUM; typedef enum threadMotorsEnum { @@ -17,6 +17,11 @@ typedef enum threadMotorsEnum DRYER_MOTOR, POOLER_MOTOR, WINDER_MOTOR, +#ifdef FOUR_WINDERS + WINDER_2_MOTOR, + WINDER_3_MOTOR, + WINDER_4_MOTOR, +#endif SCREW_MOTOR, MAX_THREAD_MOTORS_NUM }threadMotorsEnum; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index bbb3e4040..1920db03a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -151,6 +151,39 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) temp = temp*3/2; } DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); +#ifdef FOUR_WINDERS + if (Motor_i == WINDER_MOTOR) + { + int j,winderMotorId; + for (j=0;j<3;j++) + { + winderMotorId = j+WINDER_2_MOTOR; + memcpy (&MotorsControl[winderMotorId],request,sizeof(HardwarePidControl)); + if (MotorsControl[winderMotorId].pvinputfilterfactormode > MAX_CONTROL_SAMPLES) + MotorsControl[winderMotorId].pvinputfilterfactormode = MAX_CONTROL_SAMPLES; + #ifdef TEST_LONGER_PID_THREAD + MotorsControl[Motor_i].pvinputfilterfactormode = 10; //test longer control + #endif + for (i = 0;i < (int)MotorsControl[winderMotorId].pvinputfilterfactormode; i++) + { + MotorSamples[winderMotorId][i] = 0; //reset the samples value for control beginning + MotorSpeedSamples[winderMotorId][i] = 0; + } + NormalizedErrorCoEfficient[winderMotorId] = (2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); + temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); + temp=(NORMAL_COEF_DIVIDER*(temp-1)*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm); + NormalizedErrorCoEfficient[winderMotorId] = NormalizedErrorCoEfficient[winderMotorId] / temp; + // uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; + temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); + temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm);//*3/2); + if (Motor_i == WINDER_MOTOR) + { + temp = temp*3/2; + } + DancerStopActivityLimit[winderMotorId] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); + } + } +#endif return OK; } char DancerConfigPath[50] = "0://SysInfo//DancCfg.cfg"; @@ -159,31 +192,37 @@ uint32_t StoreDancerConfigMessage() { uint32_t status = OK; // FRESULT Fresult = FR_OK; - HardwareConfiguration DancerConfig; + //HardwareConfiguration DancerConfig; HardwareDancer Dancers[MAX_SYSTEM_DANCERS]; // uint8_t* response_buffer; // size_t response_size = 0; int Dancer_i; - hardware_configuration__init(&DancerConfig); - DancerConfig.dancers = (HardwareDancer**)my_malloc(sizeof(HardwareDancer*)*MAX_SYSTEM_DANCERS); + //hardware_configuration__init(&DancerConfig); + //DancerConfig.dancers = (HardwareDancer**)my_malloc(sizeof(HardwareDancer*)*MAX_SYSTEM_DANCERS); for (Dancer_i = 0; Dancer_i < MAX_SYSTEM_DANCERS; Dancer_i++) { hardware_dancer__init(&Dancers[Dancer_i]); - DancerConfig.dancers[Dancer_i] = &Dancers[Dancer_i]; + //DancerConfig.dancers[Dancer_i] = &Dancers[Dancer_i]; Dancers[Dancer_i].has_zeropoint = true; Dancers[Dancer_i].hardwaredancertype = Dancer_i; Dancers[Dancer_i].has_hardwaredancertype = true; - DancerConfig.dancers[Dancer_i]->zeropoint=Control_Read_Dancer_Position(Dancer_i,0); - DancerConfig.n_dancers++; - DancersCfg[Dancer_i].zeropoint = DancerConfig.dancers[Dancer_i]->zeropoint; + Dancers[Dancer_i].zeropoint=Control_Read_Dancer_Position(Dancer_i,0); + //DancerConfig.n_dancers++; + DancersCfg[Dancer_i].zeropoint = Dancers[Dancer_i].zeropoint; + DancersCfg[Dancer_i].zeropoint = Control_Read_Dancer_Position(Dancer_i,0); } status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_0,DancersCfg[0].zeropoint); status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_1,DancersCfg[1].zeropoint); status |= 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); -/* +#ifdef FOUR_WINDERS + status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_3,DancersCfg[HARDWARE_DANCER_3].zeropoint); + status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_4,DancersCfg[HARDWARE_DANCER_4].zeropoint); + Report("~~~~~~Store eeprom 1",__FILE__,__LINE__,(int)DancersCfg[HARDWARE_DANCER_3].zeropoint,RpWarning,(int)DancersCfg[HARDWARE_DANCER_4].zeropoint,0); +#endif + /* response_buffer = my_malloc(hardware_configuration__get_packed_size(&DancerConfig)); if (response_buffer) { @@ -208,11 +247,18 @@ uint32_t LoadDancerConfigMessage() 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); - +#ifdef FOUR_WINDERS + MCU_E2PromRead(EEPROM_STORAGE_DANCER_3,&DancersCfg[3].zeropoint); + MCU_E2PromRead(EEPROM_STORAGE_DANCER_4,&DancersCfg[4].zeropoint); +#endif status |= Report("Dancer 0 Store data eeprom ",__FILE__,__LINE__,0,RpWarning,(int)DancersCfg[0].zeropoint,0); status |= Report("Dancer 1 Store data eeprom ",__FILE__,__LINE__,1,RpWarning,(int)DancersCfg[1].zeropoint,0); status |= Report("Dancer 2 Store data eeprom ",__FILE__,__LINE__,2,RpWarning,(int)DancersCfg[2].zeropoint,0); +#ifdef FOUR_WINDERS + status |= Report("Dancer 3 Store data eeprom ",__FILE__,__LINE__,3,RpWarning,(int)DancersCfg[3].zeropoint,0); + status |= Report("Dancer 4 Store data eeprom ",__FILE__,__LINE__,4,RpWarning,(int)DancersCfg[4].zeropoint,0); +#endif return status; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 79832120b..7ec0ed5e5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -46,13 +46,15 @@ double CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM] = {0}; -TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; #ifdef FOUR_WINDERS -Dancers_4_Winders ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {FEEDER_DANCER,NUM_OF_DANCERS,POOLER_DANCER,WINDER_DANCER,NUM_OF_DANCERS}; +TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,Winder_2_Motor,Winder_3_Motor,Winder_4_Motor,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; +Dancers_4_Winders ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {NUM_OF_DANCERS,NUM_OF_DANCERS,HARDWARE_DANCER_1,HARDWARE_DANCER_0,HARDWARE_DANCER_4,HARDWARE_DANCER_3,HARDWARE_DANCER_2,NUM_OF_DANCERS}; +uint32_t ControlIdtoMotorId [MAX_THREAD_MOTORS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; #else +TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {FEEDER_DANCER,NUM_OF_DANCERS,POOLER_DANCER,WINDER_DANCER,NUM_OF_DANCERS}; -#endif uint32_t ControlIdtoMotorId [MAX_THREAD_MOTORS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF}; +#endif uint32_t SpeedControlId=0xFF; uint32_t PoolerSpeedControlId=0xFF; @@ -432,7 +434,10 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) uint16_t BreakSensorCounter = 0; uint16_t BreakSensorLatchCounter = 0; char TMessage[150]; - +#ifdef FOUR_WINDERS +char ATMessage[MAX_THREAD_MOTORS_NUM][150]; +int c = 0; +#endif uint32_t checkBreakSensor(uint32_t index) { if (BreakSensorenabled == true) @@ -550,7 +555,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) //#define MAX_CONTROL_SAMPLES 6 //extern uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; //extern int MotorSamplePointer[MAX_THREAD_MOTORS_NUM]; - //read value is the dancer angle int i,index=MAX_THREAD_MOTORS_NUM; int len; @@ -621,6 +625,29 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) //pooler dancer is right sided: data is opposite TranslatedReadValue = (-1*TranslatedReadValue); } +#ifdef FOUR_WINDERS + if (index == WINDER_MOTOR) + { + c++; + } + if (index == WINDER_2_MOTOR) + { + c++; + } + if (index == WINDER_3_MOTOR) + { + c++; + } + if (index == WINDER_4_MOTOR) + { + c++; + } + if ((index == WINDER_2_MOTOR)||(index == WINDER_3_MOTOR)) + { + //pooler dancer is right sided: data is opposite + TranslatedReadValue = (-1*TranslatedReadValue); + } +#endif if (index == POOLER_MOTOR) { //pooler dancer is right sided: data is opposite @@ -650,6 +677,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) ThreadControlActive = false; //MotorGetStatusFromFPGA(ThreadMotorIdToMotorId[index]); JobEndReason = JOB_WINDER_DANCER_FAIL+DancerId; +#ifdef FOUR_WINDERS + if (DancerId>HARDWARE_DANCER_2) + JobEndReason = JOB_WINDER_DANCER_FAIL+HARDWARE_DANCER_0; +#endif SendJobProgress(0.0,0,false, TMessage); //EndState(CurrentJob,TMessage ); SendSegmentFail(); @@ -702,24 +733,26 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*`/ }*/ calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; - if (index != WINDER_MOTOR) + if (index < WINDER_MOTOR) calculated_speed = calculated_speed*InitialDryerSpeed/OriginalMotorSpd_2PPS[DRYER_MOTOR]; //calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*CurrentControlledSpeed[index]; - if (0)//(JobCounter % 1000 == 0) - //if (JobCounter < 100)//(FirstCalcInJob == true) + //if (0)//(JobCounter % 1000 == 0) +#ifdef FOUR_WINDERS + if (JobCounter % 500 < 4)//(FirstCalcInJob == true) { - if (index == FEEDER_MOTOR) + if (index >= WINDER_MOTOR) { // FirstCalcInJob = false; - len = usnprintf(TMessage, 150, "read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d", + len = usnprintf(ATMessage[index], 150, "index %d read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d",index, TranslatedReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000), (int)(MotorControlConfig[index].m_integral*1000000000),(int)((MotorControlConfig[index].m_mesuredParam*MotorControlConfig[index].m_params.dt)*1000000000), (int)(MotorControlConfig[index].m_calculatedError*1000),(int)calculated_speed, (int)(InitialDryerSpeed*100/OriginalMotorSpd_2PPS[DRYER_MOTOR])); - ReportWithPackageFilter(ThreadFilter,TMessage,__FILE__,MotorSamplePointer[index],JobCounter,RpError,ReadValue,0); + ReportWithPackageFilter(ThreadFilter,ATMessage[index],__FILE__,MotorSamplePointer[index],JobCounter,RpError,ReadValue,0); } + JobCounter++; } - +#endif #ifndef TEST_PID_THREAD if (fabs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) #else @@ -735,14 +768,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*/ CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); -#ifdef FOUR_WINDERS - if (index == WINDER_MOTOR) - { - MotorSetSpeed(Winder_2_Motor, calculated_speed); - MotorSetSpeed(Winder_3_Motor, calculated_speed); - MotorSetSpeed(Winder_4_Motor, calculated_speed); - } -#endif } else { @@ -832,11 +857,32 @@ uint32_t HandleJobThreadControlParameters(ThreadParameters* ThreadParams) MotorControlConfig[POOLER_MOTOR].m_params.Kd = ThreadParams->pullerd; if(ThreadParams->winderp) + { MotorControlConfig[WINDER_MOTOR].m_params.Kp = ThreadParams->winderp; +#ifdef FOUR_WINDERS + MotorControlConfig[WINDER_2_MOTOR].m_params.Kp = ThreadParams->winderp; + MotorControlConfig[WINDER_3_MOTOR].m_params.Kp = ThreadParams->winderp; + MotorControlConfig[WINDER_4_MOTOR].m_params.Kp = ThreadParams->winderp; +#endif + } if(ThreadParams->winderi) + { MotorControlConfig[WINDER_MOTOR].m_params.Ki = ThreadParams->winderi; +#ifdef FOUR_WINDERS + MotorControlConfig[WINDER_2_MOTOR].m_params.Ki = ThreadParams->winderi; + MotorControlConfig[WINDER_3_MOTOR].m_params.Ki = ThreadParams->winderi; + MotorControlConfig[WINDER_4_MOTOR].m_params.Ki = ThreadParams->winderi; +#endif + } if(ThreadParams->winderd) + { MotorControlConfig[WINDER_MOTOR].m_params.Kd = ThreadParams->winderd; +#ifdef FOUR_WINDERS + MotorControlConfig[WINDER_2_MOTOR].m_params.Kd = ThreadParams->winderd; + MotorControlConfig[WINDER_3_MOTOR].m_params.Kd = ThreadParams->winderd; + MotorControlConfig[WINDER_4_MOTOR].m_params.Kd = ThreadParams->winderd; +#endif + } ReportWithPackageFilter(ThreadFilter,"Rockers activity",__FILE__,__LINE__,(int)Thread_Rockers_Bypass,RpWarning,(int)ThreadParams->bypassrockers,0); if(ThreadParams->bypassrockers) Thread_Rockers_Bypass = true; @@ -1032,13 +1078,14 @@ uint32_t ThreadPrepareState(void *JobDetails) IntersegmentLength = JobTicket->intersegmentlength; PrepareWaitCount = 0; +#ifndef FOUR_WINDERS status = ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__LeftDancer, windertension); ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_Tension Winder",__FILE__,HARDWARE_DANCER_TYPE__LeftDancer,PrepareWaitCount,RpWarning,(int)windertension,0); status = ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__MiddleDancer, pullertension); ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_Tension Puller",__FILE__,HARDWARE_DANCER_TYPE__MiddleDancer,PrepareWaitCount,RpWarning,(int)pullertension,0); status = ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__RightDancer, feedertension); ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_Tension Feeder",__FILE__,HARDWARE_DANCER_TYPE__RightDancer,PrepareWaitCount,RpWarning,(int)feedertension,0); - +#endif FirstCalcInJob = true; if(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].speedmaster == false) { @@ -1098,6 +1145,11 @@ uint32_t ThreadPrepareState(void *JobDetails) { HW_Motor_Id = ThreadMotorIdToMotorId[Motor_i]; Pid_Id = Motor_i;/*ThreadMotorIdToControlId[Motor_i];*/ +#ifdef FOUR_WINDERS + if (Motor_i == WINDER_2_MOTOR) Pid_Id = WINDER_MOTOR; + if (Motor_i == WINDER_3_MOTOR) Pid_Id = WINDER_MOTOR; + if (Motor_i == WINDER_4_MOTOR) Pid_Id = WINDER_MOTOR; +#endif MotorControlConfig[Motor_i].m_params.MAX = 1; MotorControlConfig[Motor_i].m_params.MIN = MotorsControl[Pid_Id].outputproportionalpowerlimit*-1; MotorControlConfig[Motor_i].m_params.Kd = MotorsControl[Pid_Id].derivativetime; @@ -1116,7 +1168,6 @@ uint32_t ThreadPrepareState(void *JobDetails) MotorControlConfig[Motor_i].m_preError = 0; MotorControlConfig[Motor_i].m_SetParam = 0;//need to update SetParams on presegment stage - HandleJobThreadControlParameters(JobTicket->threadparameters); //OVERRIDES CONFIGURATION PARAMETERS!!! temp_dt = MotorControlConfig[Motor_i].m_params.dt/0.001; MotorTiming[Motor_i] = (int)temp_dt; @@ -1208,9 +1259,26 @@ uint32_t ThreadPrepareState(void *JobDetails) } #ifndef TEST_PID_THREAD ControlIdtoMotorId[Motor_i] = AddControlCallback(NULL,ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i); +#endif + } +#ifdef FOUR_WINDERS + if ((Motor_i == WINDER_2_MOTOR)||(Motor_i == WINDER_3_MOTOR)||(Motor_i == WINDER_4_MOTOR)) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled + { + ReportWithPackageFilter(ThreadFilter,"Winder 2/3/4 Control",__FILE__,Motor_i,MotorControlConfig[WINDER_MOTOR].m_params.Kp,RpWarning,MotorControlConfig[WINDER_MOTOR].m_params.Ki,0); + if (ControlIdtoMotorId[Motor_i] != 0xFF) + { + if(RemoveControlCallback(ControlIdtoMotorId[Motor_i],ThreadControlCBFunction)!=OK) + ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)Motor_i,RpError,(int)PoolerSpeedControlId,0); + CurrentControlledSpeed[Motor_i] = 0; + ControlIdtoMotorId[Motor_i] = 0xFF; + } +#ifndef TEST_PID_THREAD + ControlIdtoMotorId[Motor_i] = AddControlCallback(NULL,ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i); +#endif #endif } } + HandleJobThreadControlParameters(JobTicket->threadparameters); //OVERRIDES CONFIGURATION PARAMETERS!!! #ifdef TEST_PID_THREAD testDancersControl(); @@ -1274,7 +1342,7 @@ uint32_t UpdatePidDuringRun(HardwarePidControl *request) void SetOriginMotorSpeed(float process_speed) { int Motor_i, HW_Motor_Id; - for (Motor_i = 0; Motor_i <= WINDER_MOTOR; Motor_i++) + for (Motor_i = 0; Motor_i < SCREW_MOTOR; Motor_i++) { HW_Motor_Id = ThreadMotorIdToMotorId[Motor_i]; //(Speed*uStep*PPR)/((2*PI*motor_Radius) @@ -1509,7 +1577,7 @@ char Endstr[150]; PoolerSpeedControlId = 0xFF; } - for ( Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++) + for ( Motor_i = 0;Motor_i < SCREW_MOTOR;Motor_i++) { if (ControlIdtoMotorId[Motor_i] != 0xFF) { @@ -1522,17 +1590,9 @@ char Endstr[150]; } Task_sleep(100); - for ( Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++) + for ( Motor_i = 0;Motor_i < SCREW_MOTOR;Motor_i++) { MotorStop(ThreadMotorIdToMotorId[Motor_i],Hard_Hiz); -#ifdef FOUR_WINDERS - if (Motor_i == WINDER_MOTOR) - { - MotorStop(Winder_2_Motor, Hard_Hiz); - MotorStop(Winder_3_Motor, Hard_Hiz); - MotorStop(Winder_4_Motor, Hard_Hiz); - } -#endif } MotorStop(HARDWARE_MOTOR_TYPE__MOTO_RLOADING,Hard_Hiz); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 222b618d2..7c29a909b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -76,7 +76,7 @@ void cartCART_EXTRACTED(WasteCartridgeEnum CartId) //{called from polling functi } WasteCartridgeEnum cartSELECT_CART(void) //{ if there is no SELECTED cartridge select the first cartridge in IN state. If there is none, return -1} { - Report("Cartridges select cart", __FILE__, __LINE__, CartState[WasteCartridge_middle], RpMessage, CartState[WasteCartridge_lower], 0); + //Report("Cartridges select cart", __FILE__, __LINE__, CartState[WasteCartridge_middle], RpMessage, CartState[WasteCartridge_lower], 0); if ((CartState[WasteCartridge_middle] == CartridgeStateSELECTED)||(CartState[WasteCartridge_middle] == CartridgeStateACTIVE)) return WasteCartridge_middle; if ((CartState[WasteCartridge_lower] == CartridgeStateSELECTED)||(CartState[WasteCartridge_lower] == CartridgeStateACTIVE)) diff --git a/Software/Stubs Collection/Procedures/Mid tank calibration.pproj b/Software/Stubs Collection/Procedures/Mid tank calibration.pproj index 0bb05e75b..655bbd099 100644 --- a/Software/Stubs Collection/Procedures/Mid tank calibration.pproj +++ b/Software/Stubs Collection/Procedures/Mid tank calibration.pproj @@ -1 +1,477 @@ -{"$id":"1","Inputs":{"$id":"2","$values":[{"$id":"3","Type":"Default","SelectionInputs":{"$id":"4","$values":[]},"DisplayName":"Check Tamper / Fan alarms","Description":"Check Tamper / Fan alarms","Key":"CheckTampers","Value":"1.0"},{"$id":"5","Type":"Default","SelectionInputs":{"$id":"6","$values":[]},"DisplayName":"Initial Heating on startup","Description":"Initial Heating on startup","Key":"InitialHeating","Value":"true"},{"$id":"7","Type":"Default","SelectionInputs":{"$id":"8","$values":[]},"DisplayName":"WCF Value","Description":"WCF Value","Key":"WCF_Value","Value":"40"},{"$id":"9","Type":"Default","SelectionInputs":{"$id":"10","$values":[]},"DisplayName":"AutoFill Mode","Description":"Controls the AutoFill Mode","Key":"AutoFillMode","Value":"3.0"}]},"Variables":{"$id":"11","$values":[]},"Resources":{"$id":"12","$values":[]},"Dialogs":{"$id":"13","$values":[]},"ID":"2bd29884-5eb9-4d27-be4e-6cfa31dc9f66","Name":"Mid tank calibration","Description":"This procedure lets the FSE to define values for cleaning, tamper alarms, initial heating, WCF value and automatic dispenser filling.","ApartmentState":"MTA","ReferenceAssemblies":{"$id":"14","$values":[{"$id":"15","File":"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll","HintType":"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"16","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll","HintType":"System.Linq.Enumerable, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"17","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Windows.Forms\\v4.0_4.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll","HintType":"System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"},{"$id":"18","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Procedures.dll","HintType":"Tango.FSE.Procedures.ProcedureProject, Tango.FSE.Procedures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"19","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.FSE.Common.dll","HintType":"Tango.FSE.Common.Diagnostics.IDiagnosticsProvider, Tango.FSE.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"20","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.BL.dll","HintType":"Tango.BL.Enumerations.TechMonitors, Tango.BL, Version=2.0.36.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"21","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.PMR.dll","HintType":"Tango.PMR.Common.MessageType, Tango.PMR, Version=2.0.40.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"22","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Transport.dll","HintType":"Tango.Transport.ITransporter, Tango.Transport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},{"$id":"23","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Tango.Integration.dll","HintType":"Tango.Integration.Operation.IMachineOperator, Tango.Integration, Version=2.0.31.1608, Culture=neutral, PublicKeyToken=null"},{"$id":"24","File":"C:\\Program Files (x86)\\Twine Solutions LTD\\Tango FSE\\Google.Protobuf.dll","HintType":"Google.Protobuf.IMessage, Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604"},{"$id":"25","File":"C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Drawing\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Drawing.dll","HintType":"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}]},"Scripts":{"$id":"26","$values":[{"$id":"27","Name":"Program.csx","IsEntryPoint":true,"Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Entities;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.PMR.EmbeddedParameters;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\n\r\npublic class Program\r\n{\r\n\r\nprivate IProcedureContext context;\r\n\r\n\t//----------------------\r\n\tconst double \tSlop=0.92;\r\n\tconst double\tMIN_SLOP=0.7;\r\n\tconst double\tMAX_SLOP=1.4;\r\n\tconst double\tERROR_SLOP=-1;\r\n\tconst double\tMIN_50cc_on_volt=2.3;\r\n\tconst double\tMAX_50cc_on_volt=3.2;\r\n\tconst double\tERROR_50cc_on_volt=-1;\r\n\tdouble CartSizeLiter = 1.0;\r\n\t\r\n\tint [] Convert_Midtank_No = new Int32 [8] {1,3,5,7,2,4,6,8};\r\n\tuint [,] ADC_Add_Chnl = new uint [8,2]\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x44,0x20},\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x44,0x08},\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x46,0x80},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x46,0x20},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x44,0x10},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x44,0x04},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x46,0x40},\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{0x46,0x10},\r\n\t\t\t\t\t\t\t\t\t\t\t};\r\n\t\r\n\t\r\n\tconst Int32\tF3_VALVE_OUT\t=\t0x600008E2\t;\r\n\tstring Machine_SN\t;\r\n\tprivate const string FILE_PATH = @\"C:\\MidTankLog\\\";\r\n\tstring File_name;\r\n\tdouble [,] voltage_array = new double[9,9];\r\n\tstring [] Parameter = new string[5] {\"\\t\",\"Empty [V]\",\"100cc [V]\",\"800cc [V]\",\" b [L/V] \"};\r\n\t\tdouble Full_Cartridge=1;\t// 1 litter less 100 cc\r\n\t\r\n\t//----------------------\r\n\tconst Int32 I2C_ID = 2;\r\n\t//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46\r\n\t//----------------------\r\n\t\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n\tthis.context = context;\r\n\t\r\n\tInt32 midtankno = 0;\r\n\tdouble Full_Point=0;\t\t\t//on Voltage\r\n\tdouble resualt;\r\n\tdouble Sum=0 ;\r\n\tdouble Old_Sum=0 ;\r\n\t\r\n\r\n\tif (!Directory.Exists(FILE_PATH))\r\n\t\t{\r\n\t\t\tDirectory.CreateDirectory(FILE_PATH);\r\n\t\t}\t\t\t\r\n\r\n\r\n \t//Machine_SN = context.GetInput(\"Midtank_SN\");\r\n var response = context.RequestUserInputFor(\"Mid Tank Serial Number\", \"Enter Midtank S/N:\");\r\n\tcontext.Write(\"\\n\");\r\n\tMachine_SN = response;\r\n\tcontext.WriteLine(Machine_SN);\r\n\tFile_name= FILE_PATH +Machine_SN + DateTime.Now.ToString(\"MM_dd_yyyy_HH_mm_ss\")+\".csv\";\r\n\tcontext.Write(File_name);\r\n \tcontext.WriteToFile(File_name,\"MidTank S/N:,\" + Machine_SN); \r\n\t\r\n\t\r\n\r\n\t//midtankno = context.GetInput(\"MidTankId\");\r\n\tvar response1 = context.RequestUserInputFor(\"Mid Tank Number\", \"Enter Midtank number to calibrate (1-8):\");\r\n\tcontext.WriteLine(response1);\r\n\tmidtankno = Int32.Parse(response1);\r\n \tcontext.AppendToFile(File_name,\"MidTank Number:\\t\" + response1);\r\n\r\n\r\n\tvar response2 = context.RequestUserInputFor(\"Cartridge size\", \"Enter enter cartridge size in ml (1000/700/500):\");\r\n\tcontext.WriteLine(response2);\r\n\tint Cart_size = response2;\r\n \tcontext.AppendToFile(File_name,\"Cartrideg size:\\t\" + response2);\r\n\r\n\r\n string box_msg = \"Please Insert cartridge with\" +Cart_size+\"cc (Lubbricant add 500cc only) \";\r\n// string box_title = \"Midatnk empty\";\r\n// context.ShowInfo(box_msg, box_title);\r\n\tcontext.ShowInfo(box_msg);\r\n\r\n\t//int CartInserted = 0;\r\n\t//while (CartInserted == 0)\r\n\t//\tCartInserted = context.GetInput(\"insertCartridge\");\r\n\t\r\n\tCartSizeLiter = Cart_size/1000;\r\n\t\r\n\topen_valve(midtankno,1,1)\t\t;\t//open Air valve\r\n\topen_valve(midtankno,0,1)\t\t;\t//open Ink valve\r\n\tInt32 i=0; \r\n\twhile (i<60*15)\t\t\t\t\t//check for 15 minitus \r\n\t{\r\n\t\tSum=0;\r\n\t\tfor (Int32 j=0;j<30;j++)\r\n\t\t{\r\n\t\t\tresualt=read_pressure_sensor(midtankno);\r\n\t\t\tcontext.AppendToFile(File_name,resualt+\",mV\");\r\n\t\t\tSum=Sum+resualt;\r\n\t\t\tThread.Sleep(1000);\r\n\t\t}\r\n\t\ti=i+1;\r\n\t\tif (Sum>Old_Sum)\r\n\t\t\tOld_Sum=Sum-Old_Sum;\r\n\t\telse\r\n\t\t\tOld_Sum=Old_Sum-Sum;\r\n\t\t\t\r\n\t\tif ( Old_Sum <0.02)\t\r\n\t\t\ti=60*15;\t\t//end \r\n\t\tOld_Sum=Sum;\r\n\t}\r\n\tFull_Point=Sum/30;\r\n\t\r\n\tbox_msg = \"Send file\" + File_name +\"to Mati\"; \r\n\tcontext.ShowInfo(box_msg);\r\n\t\r\n\t\r\n\t//\tcontext.Send(\"StubFpgaWriteRegRequest\" ,F3_VALVE_OUT, 0x000f);\t\t// open all valve air of midtank and close all ink of midtank\r\n\t//\tThread.Sleep(500);\r\n\t//\tcontext.Send(\"StubFpgaWriteRegRequest\" ,F3_VALVE_OUT, 0x00ff);\t\t// open all valve air of midtank and close all ink of midtank\r\n\t//\tThread.Sleep(500);\r\n\t//\tcontext.Send(\"StubFpgaWriteRegRequest\" ,F3_VALVE_OUT, 0x0fff);\t\t// open all valve air of midtank and close all ink of midtank\r\n\t//\tThread.Sleep(500);\r\n\t//\tcontext.Send(\"stubFpgaWriteRegRequest\" ,F3_VALVE_OUT, 0xffff);\t\t// open all valve air and ink of midtank\r\n\t//\r\n\t//\tThread.Sleep(2500);\r\n\r\n\t//\tThread.Sleep(1000);\t\r\n\t\t\r\n\t//\tread_pressure_sensor(1);\r\n \t\t\r\n\t//\tbox_msg =\"Insert 100cc of appropriate ink/lube to each midtank\\n\\t1.black ink\\n\\t2. Magenta ink\\n\\t3. Transparent ink\\n\\t4. Cleaner\\n\\t5. Cyan ink\\n\\t6. Yellow ink\\n\\t7. Spot color\\n\\t8. Lubricant/n\";\r\n // context.ShowInfo(box_msg);\r\n//\r\n\t//\tread_pressure_sensor(2);\r\n\r\n\t\t\t\t\t//\tvoltage_array[3,2]=2.5;\r\n\t\t\r\n//\t\tbox_msg = \"Add another 700cc for ink and TI \\nFor Lubbricant add 500cc only.\"; \r\n//\t\tcontext.ShowInfo(box_msg);\r\n//\t\tread_pressure_sensor(3);\r\n//\t\t\t\tcontext.Send(\"stubFpgaWriteRegRequest\" ,F3_VALVE_OUT, 0x0000);\t\t// close all valve air and ink of midtank\r\n\t\t\t\t\t\t\t\t\t//\t\t\tvoltage_array[3,3]=4.5;\r\n\tclose_valve(midtankno,1,1)\t\t;\t//close Air valve\r\n\tclose_valve(midtankno,0,1)\t\t;\t//close Ink valve\r\n\r\n//\t\tcalc_slop();\r\n//\t\tprint_table();\r\n\t\t\r\n//\t\tinsert_slop_t_eeprom(Full_Point, midtankno);\r\n\t\tinsert_slop_t_eeprom(Full_Point, midtankno);\r\n\t\tbox_msg =\"Turn Power Off and On to finish the calibration.\";\r\n context.ShowInfo(box_msg);\r\n\t\r\n\t}\r\n\r\nint calc_slop()\r\n\t{\r\n\tcontext.Write(\"\\n \");\r\n\t\t\r\n\tdouble delta;\r\n\tfor (uint i=1;i<9;i++)\r\n\t\t{\r\n\t\t\tdelta=voltage_array[i,3]-voltage_array[i,2];\r\n\t\t\r\n\t\t\tcontext.Write(\"\\nMidtank No:\"+i +\"=\"+delta);\r\n//\t\t\tif (i==8)\r\n\t\t\t\tdelta=CartSizeLiter/delta;\t\t\t\t\t\t\t\t\t\t\t\t//0.5 litter on lubricant\t\t\t\r\n//\t\t\telse \r\n//\t\t\t\tdelta=CartSizeLiter/delta;\t\t\t\t\t\t\t\t\t\t\t\t//0.7 litter\r\n\t\t\t\t\r\n\t\t\tif ((deltaMAX_SLOP)) \r\n\t\t\t{\r\n\t\t\t\tvoltage_array[i,4]=ERROR_SLOP;\r\n\t\t//\t\tcontext.Write(\"123\");\r\n\t\t\t}\r\n\t\telse if\t((voltage_array[i,2]MAX_50cc_on_volt ))\r\n\t\t\t\t\tvoltage_array[i,4]=ERROR_SLOP;\r\n\t\telse\r\n\t\tvoltage_array[i,4]=delta;\r\n\t\t}\r\n\treturn 1;\r\n\t}\r\n\r\n\r\n\tint\tinsert_slop_t_eeprom( double FullPoint,Int32 midtankno)\r\n{\r\n//\tcontext.Write(\"\\n \");\r\n\r\n\tMidTankDataSetupRequest midTankDataSetupRequest = new MidTankDataSetupRequest();\r\n\r\n\r\n//\tfor (uint i=1;i<9;i++)\r\n//\t{\r\n//\t\tif (voltage_array[i,4]!= ERROR_SLOP)\r\n//\t\t{\r\n\t\tMidTankData midTankData = new MidTankData();\r\n\t\tmidTankData.MidTankId = Convert.ToUInt32 (midtankno-1);\r\n\t\tmidTankData.InitialOffsetA =FullPoint - (Full_Cartridge-0.1)/Slop;\r\n\t\tmidTankData.SlopeB = Slop;\r\n\t\t\r\n\t\tcontext.Write(\"\\nMidtank No:\" + midtankno + \"=\\tVoltage Zero is =\"+(FullPoint - (Full_Cartridge-0.1)/Slop)+\"\\tSlop=\"+ Slop);\r\n\t\tcontext.AppendToFile(File_name,\"\\nMidtank No:\" + midtankno + \"=\\tVoltage Zero is =\"+(FullPoint - (Full_Cartridge-0.1)/Slop)+\"\\tSlop=\"+ Slop);\r\n\r\n\t\t\r\n\t\tmidTankDataSetupRequest.MidTankInfo.Add(midTankData);\r\n\t\r\n\t//\t}\r\nvar response = context.Send(midTankDataSetupRequest);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t//}\r\n\r\n\r\nreturn\t1;\r\n}\r\n\r\n//\r\n//\r\n//int\t\tprint_table()\r\n//\t\t{\r\n//\r\n//\t\tfor (uint i=0;i<5;i++)\r\n//\t\t\t{\r\n//\t\t\t\tcontext.AppendToFile(File_name,Parameter[i]+\"\\t\"+voltage_array[1,i]+\"\\t\"+voltage_array[2,i]+\"\\t\"+voltage_array[3,i]+\"\\t\"+voltage_array[4,i]+\"\\t\"+voltage_array[5,i]+\"\\t\"+voltage_array[6,i]+\"\\t\"+voltage_array[7,i]+\"\\t\"+voltage_array[8,i]) ;\r\n// } \r\n// \r\n//\t\r\n//\t\t\treturn 1;\r\n//\r\n//\t\t}\r\n\r\n//start mat\r\n\r\nint adc_configuration(uint I2C_Slave_Add,uint channel ) \r\n\t{\r\n\tStubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();\r\n\tstubI2CWriteBytesRequest.I2CId = I2C_ID;\r\n\tstubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;\r\n\t\r\n\tUInt32 uInt32 = new UInt32();\r\n\tstubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 0 to write\r\n\tstubI2CWriteBytesRequest.BytesTWrite.Add(channel);//Byte 1 to Write, must be 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02 or 0x01 for different channels\r\n\tstubI2CWriteBytesRequest.BytesTWrite.Add(0x80);//Byte 2 to Write\r\n\t\r\n\tvar response = context.Send(stubI2CWriteBytesRequest);\r\n\t\r\n\treturn 1;\r\n\t}\r\n\r\n\r\nint adc_set_for_read_ch(uint I2C_Slave_Add) \r\n\t{\r\n\tStubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();\r\n\tstubI2CWriteBytesRequest.I2CId = I2C_ID;\r\n\tstubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;\r\n\t\r\n\tUInt32 uInt32 = new UInt32();\r\n\tstubI2CWriteBytesRequest.BytesTWrite.Add(0x01);//Byte 0 to write\r\n\r\n\tvar response = context.Send(stubI2CWriteBytesRequest);\r\n\t\r\n\treturn 1;\r\n\t}\r\n\r\n\r\n\r\n\r\ndouble adc_read_ch(uint I2C_Slave_Add) \r\n\t{\r\n\tStubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();\r\n\tstubI2CReadBytesRequest.I2CId = I2C_ID;\r\n\tstubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add;\r\n\tstubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read\r\n\r\n\tvar response1 = context.Send(stubI2CReadBytesRequest);\r\n\tuint temph=0;\r\n\tuint templ=0;\r\n\tuint temp;\r\n\tdouble calc;\r\n\tdouble calc1;\r\n\tdouble calc2;\r\n\t\t\ttemph=response1.ReadBytes[0];\r\n\t\t\ttempl=response1.ReadBytes[1];\r\n\t\t\ttemp = (temph << 8) | templ;\r\n\t\t\ttemp=temp & 0x0fff;\r\n\t\t\t\t\r\n\t\t\tcalc = (double)temp *2.5 / 4096.0;\r\n//\t\t\tcontext.Write(\"ADC [volts]:\\t\");\r\n//\t\t\tcontext.Write(calc+\"\\t\");\r\n\t\t\r\n\t\t\tcalc1 = (1.96- calc) * 4.64 + 1.96;\r\n\t\t\tcontext.Write(\"Vsensor [volts]:\\t\");\r\n\t\t\tcontext.Write(calc1 + \"\\n\");\r\n\r\n\t//\t\tvoltage_array[table_index_x,table_index_y]=calc1;\r\n\t\r\n\treturn calc1;\r\n\t}\r\n\r\ndouble\t\tread_pressure_sensor(Int32 i )\r\n\t{\r\ndouble resualt =0 ;\r\n\t\t switch (i)\r\n {\r\n case 1:\r\n\t\t\tadc_configuration(0x44,0x20);\t\t//a2d_address 0x44 channel channel 2\r\n\t\t\tadc_set_for_read_ch(0x44);\r\n\t\t\tresualt=adc_read_ch(0x44);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 2:\r\n\t\t\tadc_configuration(0x44,0x08);\t\t//a2d_address 0x44 channel channel 4\r\n\t\t\tadc_set_for_read_ch(0x44);\r\n\t\t\tresualt=adc_read_ch(0x44);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 3:\r\n\t\t\tadc_configuration(0x46,0x80);\t\t//a2d_address 0x46 channel channel 0\r\n\t\t\tadc_set_for_read_ch(0x46);\r\n\t\t\tresualt=adc_read_ch(0x46);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 4:\r\n\t\t\tadc_configuration(0x46,0x20);\t\t//a2d_address 0x46 channel channel 2\r\n\t\t\tadc_set_for_read_ch(0x46);\r\n\t\t\tresualt=adc_read_ch(0x46);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 5:\r\n\t\t\tadc_configuration(0x44,0x10);\t\t//a2d_address 0x44 channel channel 3\r\n\t\t\tadc_set_for_read_ch(0x44);\r\n\t\t\tresualt=adc_read_ch(0x44);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 6:\r\n\t\t\tadc_configuration(0x44,0x04);\t\t//a2d_address 0x44 channel channel 5\r\n\t\t\tadc_set_for_read_ch(0x44);\r\n\t\t\tresualt=adc_read_ch(0x44);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 7:\r\n\t\t\tadc_configuration(0x46,0x40);\t\t//a2d_address 0x46 channel channel 1\r\n\t\t\tadc_set_for_read_ch(0x46);\r\n\t\t\tresualt=adc_read_ch(0x46);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase 8:\r\n\t\t\tadc_configuration(0x46,0x10);\t\t//a2d_address 0x46 channel channel 3\r\n\t\t\tadc_set_for_read_ch(0x46);\r\n\t\t\tresualt=adc_read_ch(0x46);\r\n\t\tbreak;\r\n\t\t\r\n default:\r\n context.Write(\"Error\");\r\n\r\n break;\r\n\t }\t\r\n\t\t\r\n\t\treturn resualt;\r\n\t}\t\r\n\r\n\r\n//--------------------------------\r\nint open_valve (int valve_nm,int valve_type,int check_valve)\t\t//valve_type=0 is Air ,1 is Ink ; check_valve=1 send feedbak\r\n{\r\n\tint temp1=Convert_Midtank_No[valve_nm-1]\t;\r\n\r\n\tstring temp;\r\n\tSetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 1);\t\r\n\t\r\n\t\tif (check_valve!=0)\r\n\t\t{\r\n\t\t\ttemp=\"Air\";\r\n\t\t\tif (valve_type==1)\r\n\t\t\ttemp=\"Ink\";\r\n\t\t\t\t\r\n\t\t\tif(!context.ShowWarningQuestion(\"Did \" + temp + \"Valve of Midtank \" + valve_nm +\" open?\"))\r\n\t\t\t\t{\r\n//\t\t\t\t\tUnits_status[(valve_nm-1)*3+valve_type,1]=\"Fail\";\r\n\t\t\t\t\tcontext.Write(temp +\"Valve\\tFail\\n\");\t\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\telse \r\n\t\t\t\t{\r\n//\t\t\t\t\tUnits_status[(valve_nm-1)*3+valve_type,1]=\"Pass\";\r\n\t\t\t\t\tcontext.Write(temp +\"Valve\\tOpen\\n\");\t\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn 1;\r\n\r\n}\r\n//--------------------------------\t\r\nint close_valve (int valve_nm,int valve_type,int check_valve)\r\n{\r\n\tint temp1=Convert_Midtank_No[valve_nm-1];\t\r\n\r\n\tstring temp;\r\n\tSetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 0);\r\n\tif (check_valve!=0)\r\n\t\t{\r\n\t\t\ttemp=\"Air\";\r\n\t\t\tif (valve_type==1)\r\n\t\t\ttemp=\"Ink\";\r\n\t\t\t\t\r\n\t\t\tif(!context.ShowWarningQuestion(\"Did \" + temp +\" Valve of Midtank \" + valve_nm +\" close?\"))\r\n\t\t\t\t{\r\n//\t\t\t\t\tUnits_status[(valve_nm-1)*3+valve_type,1]=\"Fail\";\r\n\t\t\t\t\tcontext.Write(temp +\"Valve\\tFail\\n\");\t\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\telse \r\n\t\t\t\t{\r\n//\t\t\t\t\tUnits_status[(valve_nm-1)*3+valve_type,1]=\"Pass\";\r\n\t\t\t\t\tcontext.Write(temp +\"Valve\\tclose\\n\");\t\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\t\t\t\r\n\t\t}\r\n\treturn 1;\r\n\r\n}\r\n\r\npublic Int32 SetBit(Int32 Adr, Int32 BitNo, Int32 Bit)\r\n{\r\n\tInt32 BitMask;\r\n\tvar RetVal = Fpga_Read_Reg(Adr);\r\n\tInt32 RV = (Int32) RetVal.Value;\r\n\t\r\n\tif (Bit == 0x1) \r\n\t{\r\n\t\tBitMask = 0x1 << BitNo;\r\n\t\tRV = RV | BitMask;\r\n\t\tFpga_Write_Reg( Adr, RV );\r\n\t}\r\n\telse if (Bit == 0x0)\r\n\t{\r\n\t\tBitMask = ~(0x1 << BitNo);\r\n\t\tRV = RV & BitMask;\r\n\t\tFpga_Write_Reg(Adr, RV );\t\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint Fpga_Write_Reg(Int32 Addr, Int32 Data)\r\n{\r\n\tvar response = context.Send(\"StubFpgaWriteRegRequest\" ,Addr, Data);\r\n\t\r\n\treturn 1;\r\n}\r\n\r\n\r\n\r\nStubFpgaReadRegResponse Fpga_Read_Reg(Int32 Addr)\r\n{\r\n var response = context.Send(\"StubFpgaReadRegRequest\" ,Addr);\r\n\tresponse.Value = response.Value & 0xffff;\r\n\t\r\n\treturn response;\r\n}\r\n}"},{"$id":"28","Name":"Service.csx","IsEntryPoint":false,"Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}"}]}} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Drawing; +using Google.Protobuf; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.PMR.Stubs; +using Tango.PMR.Diagnostics; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.Diagnostics; +using Tango.FSE.Procedures; +using System.IO; +using System.Windows.Forms; +using Tango.PMR.EmbeddedParameters; + +public class Program +{ +const double MIN_SLOP=0.7; +const double MAX_SLOP=1.4; +const double ERROR_SLOP=-1; +const double MIN_50cc_on_volt=2.3; +const double MAX_50cc_on_volt=3.2; +const double ERROR_50cc_on_volt=-1; + +int [] Convert_Midtank_No = new Int32 [8] {1,3,5,7,2,4,6,8}; +uint [,] ADC_Add_Chnl = new uint [8,2] { + {0x44,0x20}, + {0x44,0x08}, + {0x46,0x80}, + {0x46,0x20}, + {0x44,0x10}, + {0x44,0x04}, + {0x46,0x40}, + {0x46,0x10}, + }; + + +const Int32 F3_VALVE_OUT = 0x600008E2 ; +string Machine_SN ; +private const string FILE_PATH = @"C:\MidTankLog\"; +string File_name; +double Full_Cartridge=1000; // on CC +double Slop=0.92; +//---------------------- +const Int32 I2C_ID = 2; +//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46 +//---------------------- + + +private IProcedureContext context; + + + + + public void OnExecute(IProcedureContext context) + { + + + Int32 Timout ; + Int32 Interval; + Int32 midtankno = 0; + double Full_Point=0; //on Voltage + double resualt; + double Sum=0 ; + double Old_Sum=0 ; + double Start_Point=0; + + + if (!Directory.Exists(FILE_PATH)) + { + Directory.CreateDirectory(FILE_PATH); + } + + + + var response =context.RequestUserInputFor("Enter Midtank S/N: ", ""); + context.Write("\n"); + Machine_SN = response; + context.WriteLine(Machine_SN); + File_name= FILE_PATH +Machine_SN + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss")+".csv"; + context.Write(File_name); + context.WriteToFile(File_name,"MidTank S/N:," + Machine_SN); + + + var response1 =context.RequestUserInputFor("Enter Midtank number to calibrate (1-8):", ""); + context.WriteLine(response1); + midtankno = Int32.Parse(response1); + context.AppendToFile(File_name,"MidTank Number:\t" + response1); + if (midtankno==8) + { + Slop=1; + Timout=60; //60 minutes + Interval=60; //60 second + } + else + { + Slop=0.92; + Timout=10*2; //10 minutes + Interval=30; //30 second + + } + var response10 =context.RequestUserInputFor("Enter Cartridge Valume on CC (500-1500):", ""); + context.WriteLine(response10); + Full_Cartridge = double.Parse(response10); + context.AppendToFile(File_name,"Cartridge Valume:\t" + response10); + context.AppendToFile(File_name,"Slop value:\t" + Slop); + + + DialogResult result = MessageBox.Show("Are you sure to calibrate Midtank No: "+ midtankno + " with "+ Full_Cartridge +" CC" , "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.Yes) + { + + + + string box_msg = "Please Insert cartridge "; + + MessageBox.Show(box_msg); + + open_valve(midtankno,1,1) ; //open Air valve + open_valve(midtankno,0,1) ; //open Ink valve + Int32 i=0; + while (iOld_Sum) + Old_Sum=Sum-Old_Sum; + else + Old_Sum=Old_Sum-Sum; + + + if ((check_valve(midtankno,1) != 0) && (check_valve(midtankno,0) != 0)) + { + i++; + if ( Old_Sum <0.02) + i=Timout+1; //end + Old_Sum=Sum; + } + else + { + open_valve(midtankno,1,0) ; //open Air valve + open_valve(midtankno,0,0) ; //open Ink valve + Old_Sum=0; + + } + } + Full_Point=Sum/Interval; + + + close_valve(midtankno,1,1) ; //close Air valve + close_valve(midtankno,0,1) ; //close Ink valve + + + if (insert_slop_t_eeprom(Full_Point, midtankno,Start_Point)==0) + { + box_msg ="Turn Power Off and On to finish the calibration."; + MessageBox.Show(box_msg); + + + context.AddResult(ResultType.Passed, "Test passed", "Test passed."); + + } + else + { + box_msg ="Calibration error"; + MessageBox.Show(box_msg); + + + context.AddResult(ResultType.Failed, "Test Fail", "Test Fail."); + + } + } + +} + + + int insert_slop_t_eeprom( double FullPoint,Int32 midtankno, double StartPoint) +{ +// context.Write("\n "); + + StartPoint=FullPoint-StartPoint; + StartPoint=StartPoint/Full_Cartridge; + if ((StartPoint>0.7 ) && (StartPoint>1.3 )) + { + MidTankDataSetupRequest midTankDataSetupRequest = new MidTankDataSetupRequest(); + + MidTankData midTankData = new MidTankData(); + midTankData.MidTankId = Convert.ToUInt32 (midtankno-1); + midTankData.InitialOffsetA =FullPoint - (Full_Cartridge/1000-0.1)/Slop; + midTankData.SlopeB = Slop; + + context.Write("\nMidtank No:" + midtankno + "=\tVoltage Zero is ="+(FullPoint - (Full_Cartridge/1000-0.1)/Slop)+"\tSlop="+ Slop); + context.AppendToFile(File_name,"\nMidtank No:" + midtankno + "=\tVoltage Zero is ="+(FullPoint - (Full_Cartridge/1000-0.1)/Slop)+"\tSlop="+ Slop); + + + midTankDataSetupRequest.MidTankInfo.Add(midTankData); + + + var response =context.Send(midTankDataSetupRequest); + + return 0; + } + else + context.Write("\nError"); + context.AppendToFile(File_name,"\n Slop Error"); + return 1; + + + } + + + +int adc_configuration(uint I2C_Slave_Add,uint channel ) + { + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; + + UInt32 uInt32 = new UInt32(); + stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 0 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(channel);//Byte 1 to Write, must be 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02 or 0x01 for different channels + stubI2CWriteBytesRequest.BytesTWrite.Add(0x80);//Byte 2 to Write + + var response =context.Send(stubI2CWriteBytesRequest); + + return 1; + } + + +int adc_set_for_read_ch(uint I2C_Slave_Add) + { + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; + + UInt32 uInt32 = new UInt32(); + stubI2CWriteBytesRequest.BytesTWrite.Add(0x01);//Byte 0 to write + + var response =context.Send(stubI2CWriteBytesRequest); + + return 1; + } + + + + +double adc_read_ch(uint I2C_Slave_Add) + { + StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); + stubI2CReadBytesRequest.I2CId = I2C_ID; + stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add; + stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read + + var response1 =context.Send(stubI2CReadBytesRequest); + uint temph=0; + uint templ=0; + uint temp; + double calc; + double calc1; + double calc2; + temph=response1.ReadBytes[0]; + templ=response1.ReadBytes[1]; + temp = (temph << 8) | templ; + temp=temp & 0x0fff; + + calc = (double)temp *2.5 / 4096.0; + + calc1 = (1.96- calc) * 4.64 + 1.96; + context.Write("Vsensor [volts]:\t"); + context.Write(calc1 + "\n"); + + + return calc1; + } + +double read_pressure_sensor(Int32 i ) + { +double resualt =0 ; + switch (i) + { + case 1: + adc_configuration(0x44,0x20); //a2d_address 0x44 channel channel 2 + adc_set_for_read_ch(0x44); + resualt=adc_read_ch(0x44); + break; + + case 2: + adc_configuration(0x44,0x08); //a2d_address 0x44 channel channel 4 + adc_set_for_read_ch(0x44); + resualt=adc_read_ch(0x44); + break; + + case 3: + adc_configuration(0x46,0x80); //a2d_address 0x46 channel channel 0 + adc_set_for_read_ch(0x46); + resualt=adc_read_ch(0x46); + break; + + case 4: + adc_configuration(0x46,0x20); //a2d_address 0x46 channel channel 2 + adc_set_for_read_ch(0x46); + resualt=adc_read_ch(0x46); + break; + + case 5: + adc_configuration(0x44,0x10); //a2d_address 0x44 channel channel 3 + adc_set_for_read_ch(0x44); + resualt=adc_read_ch(0x44); + break; + + case 6: + adc_configuration(0x44,0x04); //a2d_address 0x44 channel channel 5 + adc_set_for_read_ch(0x44); + resualt=adc_read_ch(0x44); + break; + + case 7: + adc_configuration(0x46,0x40); //a2d_address 0x46 channel channel 1 + adc_set_for_read_ch(0x46); + resualt=adc_read_ch(0x46); + break; + + case 8: + adc_configuration(0x46,0x10); //a2d_address 0x46 channel channel 3 + adc_set_for_read_ch(0x46); + resualt=adc_read_ch(0x46); + break; + + default: + context.Write("Error"); + + break; + } + + return resualt; + } + + +//-------------------------------- +int open_valve (int valve_nm,int valve_type,int check_valve) //valve_type=0 is Air ,1 is Ink ; check_valve=1 send feedbak +{ + int temp1=Convert_Midtank_No[valve_nm-1] ; + + string temp; + SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 1); + + if (check_valve!=0) + { + temp="Air"; + if (valve_type==1) + temp="Ink"; + + DialogResult result = MessageBox.Show("Did " + temp + "Valve of Midtank " + valve_nm +" open?", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.No) + { +// Units_status[(valve_nm-1)*3+valve_type,1]="Fail"; + context.Write(temp +"Valve\tFail\n"); + return 0; + } + else + { +// Units_status[(valve_nm-1)*3+valve_type,1]="Pass"; + context.Write(temp +"Valve\tOpen\n"); + return 1; + } + + } + return 1; + +} +//-------------------------------- +int close_valve (int valve_nm,int valve_type,int check_valve) +{ + int temp1=Convert_Midtank_No[valve_nm-1]; + + string temp; + SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 0); + if (check_valve!=0) + { + temp="Air"; + if (valve_type==1) + temp="Ink"; + + DialogResult result = MessageBox.Show("Did " + temp +" Valve of Midtank " + valve_nm +" close?", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.No) + { +// Units_status[(valve_nm-1)*3+valve_type,1]="Fail"; + context.Write(temp +"Valve\tFail\n"); + return 0; + } + else + { +// Units_status[(valve_nm-1)*3+valve_type,1]="Pass"; + context.Write(temp +"Valve\tclose\n"); + return 1; + } + } + return 1; + +} + +public Int32 SetBit(Int32 Adr, Int32 BitNo, Int32 Bit) +{ + Int32 BitMask; + Int32 RetVal; + RetVal = Fpga_Read_Reg(Adr); + Int32 RV = RetVal ; + + if (Bit == 0x1) + { + BitMask = 0x1 << BitNo; + RV = RV | BitMask; + Fpga_Write_Reg( Adr, RV ); + } + else if (Bit == 0x0) + { + BitMask = ~(0x1 << BitNo); + RV = RV & BitMask; + Fpga_Write_Reg(Adr, RV ); + } + return 1; +} + +int Fpga_Write_Reg(Int32 Addr, Int32 Data) +{ + var response =context.Send("StubFpgaWriteRegRequest" ,Addr, Data); + + return 1; +} + + +Int32 check_valve (Int32 valve_nm,int valve_type) +{ + Int32 temp1=Convert_Midtank_No[valve_nm-1]; + + var response =context.Send("StubFpgaReadRegRequest" ,F3_VALVE_OUT); + Int32 RV =(Int32) response.Value & 0xffff ; + RV = RV & ( 0x1 << (((valve_type+1)*8)- temp1)); + return RV; + +} + + +Int32 Fpga_Read_Reg(Int32 Addr) +{ + +context.Write("123"); + + var response =context.Send("StubFpgaReadRegRequest" ,Addr); + context.Write("456"); + + Int32 RV= (Int32) response.Value & 0xffff; + context.Write("789"); + + return RV; +} + + + +} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/Priming1.pproj b/Software/Stubs Collection/Procedures/Priming1.pproj new file mode 100644 index 000000000..adfed3f3e --- /dev/null +++ b/Software/Stubs Collection/Procedures/Priming1.pproj @@ -0,0 +1,1015 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Drawing; +using Google.Protobuf; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.PMR.Stubs; +using Tango.PMR.Diagnostics; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.Diagnostics; +using Tango.FSE.Procedures; +using System.IO; +using System.Diagnostics; +using System.Windows.Forms; + + +public class Program +{ + + +private IProcedureContext context; + +//---------------------Start Command ---------------- +const Int32 CMD_RUN = 0; //Run on Pulse Per Secound .positive run Up and negative run Down b +const Int32 CMD_STOP= 1; //0;Hard stop(Defualt);1-Soft stop;2-Hard Hiz;3-Soft Hiz +const Int32 CMD_VALVE= 2; //0-to Midtank ,1-to head +const Int32 CMD_DLY = 3; //delay in Seconds . +const Int32 CMD_TIME= 4; //Print Time . +const Int32 CMD_PRESS= 5; //return from Delay loop when pressure is high (on mBAR) . +const Int32 CMD_LOOP_NM=6; //NUMBER OF counter +const Int32 CMD_LOOP= 7; //jump up(+) or down(-) command u +const Int32 CMD_MTV_OPEN = 8; //0 Air ; 1 Ink +const Int32 CMD_MTV_CLOSE= 9; //0 Air ; 1 Ink +const Int32 CMD_LBL= 10; //label for user +const Int32 CMD_SMP= 11; //sample rate ,defualt 100msec (1); for 1 second is 10. +const Int32 CMD_PRESL= 12; //return from Delay loop when pressure is low (on mBAR) . + +const Int32 CMD_END = 13; //end loop . + + +Int32[] BuildUp_Table = new int [] +{ + CMD_VALVE,1, + CMD_PRESL,200, + CMD_DLY,200, + + CMD_LOOP_NM,3, + + CMD_VALVE,0, + CMD_DLY,1, + CMD_VALVE,1, + CMD_DLY,1, + CMD_LOOP,-4, + + CMD_VALVE,0, + CMD_RUN,1068, + CMD_PRESS,1000, //mbar --> 1000 = 100% work, 4000 = 200% work, 350 = 20% work + CMD_DLY,150, + CMD_LBL,1, + CMD_PRESS,2000, //mbar --> 2000 = 100% work, 4000 = 200% work, 350 = 20% work + CMD_DLY,60, + CMD_LBL,2, + CMD_PRESS,3000, + CMD_DLY,60, // to limit + CMD_STOP,0, + CMD_VALVE,1, + CMD_END,3, +}; + + +Int32[] Up_Table = new int [] +{ + CMD_VALVE,1, + CMD_PRESL,200, + CMD_DLY,200, + + CMD_PRESS,3000, //mbar --> 1000 = 100% work, 4000 = 200% work, 350 = 20% work + CMD_RUN,534, // 100% + CMD_DLY,120, + CMD_STOP,0, + CMD_END,3, +}; +Int32 Dispenser_sample_rate= 1; + + string path = @"C:\Dispenser_setup\Log\"; +//---------------------- +const UInt32 I2C_ID = 4; //MCU_I2C4 +const UInt32 TCA9548A_address = 0xE2; +const UInt32 I2C_Slave_Low_Add = 0xA0; //eeprom address - 64k low +const UInt32 I2C_Slave_High_Add = 0xA2; //eeprom address - 64k High +//---------------------- +byte [] EEPROM_Data = new byte [128]; + + +//---------------------End Command ---------------- + +const Int32 Dispenser_Motor1 = 6; +const Int32 Dispenser_Motor2 = 7; +const Int32 Dispenser_Motor3 = 8; +const Int32 Dispenser_Motor4 = 9; +const Int32 Dispenser_Motor5 = 10; +const Int32 Dispenser_Motor6 = 11; +const Int32 Dispenser_Motor7 = 12; +const Int32 Dispenser_Motor8 = 13; + +const Int32 AN_IDS_PRESSENS_1 = 2; +const Int32 AN_IDS_PRESSENS_2 = 3; +const Int32 AN_IDS_PRESSENS_3 = 4; +const Int32 AN_IDS_PRESSENS_4 = 5; +const Int32 AN_IDS_PRESSENS_5 = 6; +const Int32 AN_IDS_PRESSENS_6 = 7; +const Int32 AN_IDS_PRESSENS_7 = 8; +const Int32 AN_IDS_PRESSENS_8 = 9; + +const Int32 F2_LS_01_Direct = 0x60000420 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_2 F2_LS_DISPENSER_25_2 F2_LS_DISPENSER_75_2 F2_LS_DISPENSER_DOWN_2 F2_LS_DISPENSER_50_2 F2_LS_DISPENSER_SPARE_2 F2_LS_DISPENSER_UP_1 F2_LS_DISPENSER_25_1 F2_LS_DISPENSER_75_1 F2_LS_DISPENSER_DOWN_1 F2_LS_DISPENSER_50_1 F2_LS_DISPENSER_SPARE_1 +const Int32 F2_LS_02_Direct = 0x60000430 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_4 F2_LS_DISPENSER_25_4 F2_LS_DISPENSER_75_4 F2_LS_DISPENSER_DOWN_4 F2_LS_DISPENSER_50_4 F2_LS_DISPENSER_SPARE_4 F2_LS_DISPENSER_UP_3 F2_LS_DISPENSER_25_3 F2_LS_DISPENSER_75_3 F2_LS_DISPENSER_DOWN_3 F2_LS_DISPENSER_50_3 F2_LS_DISPENSER_SPARE_3 +const Int32 F2_LS_03_Direct = 0x60000440 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_6 F2_LS_DISPENSER_25_6 F2_LS_DISPENSER_75_6 F2_LS_DISPENSER_DOWN_6 F2_LS_DISPENSER_50_6 F2_LS_DISPENSER_SPARE_6 F2_LS_DISPENSER_UP_5 F2_LS_DISPENSER_25_5 F2_LS_DISPENSER_75_5 F2_LS_DISPENSER_DOWN_5 F2_LS_DISPENSER_50_5 F2_LS_DISPENSER_SPARE_5 +const Int32 F2_LS_04_Direct = 0x60000480 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_8 F2_LS_DISPENSER_25_8 F2_LS_DISPENSER_75_8 F2_LS_DISPENSER_DOWN_8 F2_LS_DISPENSER_50_8 F2_LS_DISPENSER_SPARE_8 F2_LS_DISPENSER_UP_7 F2_LS_DISPENSER_25_7 F2_LS_DISPENSER_75_7 F2_LS_DISPENSER_DOWN_7 F2_LS_DISPENSER_50_7 F2_LS_DISPENSER_SPARE_7 + +const Int32 Dispenser_Valve1 = 0; +const Int32 Dispenser_Valve2 = 1; +const Int32 Dispenser_Valve3 = 2; +const Int32 Dispenser_Valve4 = 3; +const Int32 Dispenser_Valve5 = 4; +const Int32 Dispenser_Valve6 = 5; +const Int32 Dispenser_Valve7 = 6; +const Int32 Dispenser_Valve8 = 7; + +const ushort MinPress_Mbar_Add =0x5c ; +const ushort MaxPress_Mbar_Add =0x60 ; + +const Int32 F3_VALVE_OUT = 0x600000e2; + +//string path = "C:\\Dispenser_setup\\Log\\"; + + +//Int32[] Start_Table; + +Int32[] Start_Table = new Int32 [10000]; + +UInt32 [] Motor_Dir=new UInt32 [8] {0,0,0,0,0,0,0,0}; + +string Dispenser_Fname ; + +Int32 Dispenser_ptr =-1; + +Int32 [] Dispenser_press= new Int32[8]{0,0,0,0,0,0,0,0}; +Int32 max_pressure_level = 20000; +Int32 min_pressure_level = -20000; + +Int32 [] A2D_Dispenser= new Int32[8]{0,0,0,0,0,0,0,0}; +Int32 Loop_cnt= 1; +Int32 Loop_length=1; + +Int32 PressureSensorType= 1; //1- new -1up +10 . 0-old 0 to +10 +Int32 Temp_Delay=0; + + +UInt32 RD_LS_01_Direct; +UInt32 RD_LS_02_Direct; +UInt32 RD_LS_03_Direct; +UInt32 RD_LS_04_Direct; + +long Lebel1_time; +long Lebel2_time; + +long time_Table; + +Int32 msec_index=0; + +Int32 MaxPress_Mbar; +Int32 MinPress_Mbar; +string state; + + public Int32 OnExecute(IProcedureContext context) + { + long Max_PBU; + Int32 Index=0; + Int32 speed=0; + Int32 Dispenser_Nm; + this.context = context; + + string box_msg = "Make sure Mixer Hot "; + MessageBox.Show(box_msg); + + var response1 = context.RequestUserInputFor("Dispenser Number", "Enter Dispenser number to make priming (1-8):"); + context.WriteLine(response1); + Dispenser_Nm = Int32.Parse(response1); + + check_Min_Max_Mbar(Dispenser_Nm); + + if (Dispenser_Nm==8) + Max_PBU=6000; + else + Max_PBU=4000; + + + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + context.WriteLine(path); + + context.Send("ProgressRequest" ,0xe0, 1); + + Dispenser_Fname=path + "Dispenser_Nm_" + Dispenser_Nm+"_" + DateTime.Now.ToString("MM-dd-yy hh-mm")+ ".csv" ; + + context.WriteLine(Dispenser_Fname); + + context.WriteToFile(Dispenser_Fname,"Dispenser Nm," + Dispenser_Nm + "\n" ); + context.AppendToFile(Dispenser_Fname,"Pressure,Command,Value,DateTime,Remark\n" ); + for(int j=0; j<2;j++) + { + for(int i=0; i<4;i++) + { + state="PBU No. "+ (4*j+i+1 ); + Start_Table=BuildUp_Table; + Table_Run(Dispenser_Nm ); + if (time_Table>300000) + { + context.AddResult(ResultType.Failed,"PBU", "PBU No."+ (4*j+i+1 ) + " Fail"); + return 0; + } + context.AddResult(ResultType.Passed,"PBU","PBU No."+ (4*j+i+1 ) + " Pass"); + + } + state="Flow No."+ (j+1 ) ; + Start_Table=Up_Table; + Table_Run(Dispenser_Nm ); + if (time_Table<115000) + { + context.WriteLine("time_Table= " +time_Table); + context.AddResult(ResultType.Failed,"Flow", "Flow No."+ (j+1) + " Fail"); + return 0; + } + context.AddResult(ResultType.Passed,"Flow","Flow No."+ (j+1 ) + " Pass"); + + } + state="Last PBU " ; + Start_Table=BuildUp_Table; + Table_Run(Dispenser_Nm ); + long Time=Lebel2_time-Lebel1_time; + if (Time>Max_PBU) + { + context.AddResult(ResultType.Failed,"PBU", "PBU = " +Time + "msec "); + state="PBU = " +Time + "msec \tFail"; + } + else + { + context.AddResult(ResultType.Passed,"PBU", "PBU = " +Time + "msec "); + state="PBU = " +Time + "msec \tPass"; + } + return 0; + + } + +///////////////////////////////////////////// +void check_Min_Max_Mbar(Int32 i ) +{ + int k; + string s ; + i--; + + context.WriteLine("-------------- write Enable Channel ------------"); //debug + enable_channel(i); // Chanel 0-7 => Disp0enser 0-7 + context.WriteLine("-------------- Read_header ------------"); //debug + + context.WriteLine("-------------- write_address_eeprom ------------"); //debug + write_address_eeprom (I2C_Slave_Low_Add,MinPress_Mbar_Add); + context.WriteLine("-------------- read_data_from_eeprom ------------"); //debug + read_data_from_eeprom (I2C_Slave_Low_Add,1); + if (EEPROM_Data[0]==0 ) + { PressureSensorType=0; + context.WriteLine("PressureSensorType=0" ); //debug + } + else + { + PressureSensorType=1; + context.WriteLine("PressureSensorType=1" ); //debug + } + +} +//----------------write address eeprom ------------------------- +public void write_address_eeprom (UInt32 I2C_Add, UInt32 Eeprom_Add) +{ + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = I2C_Add; + + UInt32 uInt32 = new UInt32(); + stubI2CWriteBytesRequest.BytesTWrite.Add(Convert.ToByte( (Eeprom_Add & 0xff00) >>8)); //Byte High add to write + stubI2CWriteBytesRequest.BytesTWrite.Add(Convert.ToByte(Eeprom_Add & 0xff)); //Byte Low add to write + context.WriteLine( (Eeprom_Add & 0xff00) >>8) ; //debug + context.WriteLine( Eeprom_Add & 0xff); //debug + + context.Send(stubI2CWriteBytesRequest); +} +//------------------- read Data from EEprom-------------------------- + +public void read_data_from_eeprom ( UInt32 I2C_Add, UInt32 cnt ) +{ + StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); + stubI2CReadBytesRequest.I2CId = I2C_ID; + stubI2CReadBytesRequest.SlaveAddress = (I2C_Add + 1); + stubI2CReadBytesRequest.NumberOfBytesToRead = cnt; // Number of bytes to read + + var response1 = context.Send(stubI2CReadBytesRequest); + + for(int i=0; i(stubI2CWriteBytesRequest); + + return 1; +} + + +////////////////////////////////////////////////////////////// +Int32 Table_Run(Int32 Dispenser ) + +{ + Int32 COMMAND=0; + Int32 Data=0; + Int32 count=0; + + Dispenser--; //check from 0-7 + + int j=0; + var stopwatch = new Stopwatch(); + stopwatch.Start(); + + long elapsed_time = stopwatch.ElapsedMilliseconds; + context.WriteLine(elapsed_time); + + while (count!=-1) + { + msec_index=msec_index+1; + + if (Dispenser<2) + { + var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_01_Direct); + RD_LS_01_Direct=response1.Value ; + } + else if ( (Dispenser<4) ) + { + var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_02_Direct); + RD_LS_02_Direct=response1.Value ; + } + else if ( (Dispenser<6) ) + { + var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_03_Direct); + RD_LS_03_Direct=response1.Value ; + } + else + { + var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_04_Direct); + RD_LS_04_Direct=response1.Value ; + } + if (Dispenser<4) + { + var response2 = context.Send("StubIntADCReadRequest" ,0x8000 + AN_IDS_PRESSENS_1); + A2D_Dispenser[0]=(response2.SamplingInBits)>>16; + A2D_Dispenser[1] =(response2.SamplingInBits) & 0x0000ffff; + A2D_Dispenser[2] =(response2.VoltageSamplingMv)>>16; + A2D_Dispenser[3] =(response2.VoltageSamplingMv) & 0x0000ffff; + } + else + { + var response3 = context.Send("StubIntADCReadRequest" ,0x8000 + AN_IDS_PRESSENS_5); + A2D_Dispenser[4] =(response3.SamplingInBits)>>16; + A2D_Dispenser[5] =(response3.SamplingInBits)& 0x0000ffff; + A2D_Dispenser[6] =(response3.VoltageSamplingMv)>>16; + A2D_Dispenser[7] =(response3.VoltageSamplingMv)& 0x0000ffff; + } + + COMMAND=Start_Table[count]; + Data=Start_Table[(count+1)]; + //Index=Index+2; + switch (COMMAND) + { + case CMD_RUN: + Motor_Run(Data,Dispenser); + count = count+2; + break; + + case CMD_VALVE: + Valve_3W(Data,Dispenser); + count = count+2; + break; + + case CMD_STOP: + Motor_Stop(Data,Dispenser); + count = count+2; + break; + + case CMD_DLY: + Delay_on_second(Data,Dispenser); + if (Temp_Delay ==0) + { + max_pressure_level=20000; + min_pressure_level=-20000; + count = count+2; + } + break; + + case CMD_TIME: + Print_Time(); + count = count+2; + break; + + case CMD_PRESS: + max_pressure_level=Data; + context.AppendToFile(Dispenser_Fname,",Max_pressure_level is, " + Data +","+DateTime.Now+"\n"); + count = count+2; + break; + + case CMD_PRESL: + min_pressure_level=Data; + context.AppendToFile(Dispenser_Fname,",Min_pressure_level is, " + Data +","+DateTime.Now+"\n"); + count = count+2; + break; + + case CMD_LBL: + context.AppendToFile(Dispenser_Fname,",Label," + Data+","+DateTime.Now+"\n"); + if(Data==1) + Lebel1_time=stopwatch.ElapsedMilliseconds; + if(Data==2) + Lebel2_time=stopwatch.ElapsedMilliseconds; + count = count+2; + break; + + + case CMD_SMP: + context.AppendToFile(Dispenser_Fname,",SampleRate," + Data+","+DateTime.Now+"\n"); + Dispenser_sample_rate =Data; + count = count+2; + break; + + case CMD_END: + count=-1; + context.AppendToFile(Dispenser_Fname,",End testing,,"+DateTime.Now+"\n"); + break; + + case CMD_MTV_OPEN: + open_midtank_valve(Data,Dispenser); + context.AppendToFile(Dispenser_Fname,",OPEN MIDTANK, " + Dispenser+","+DateTime.Now+"\n"); + count = count+2; + break; + + case CMD_MTV_CLOSE: + close_midtank_valve(Data,Dispenser); + context.AppendToFile(Dispenser_Fname,",CLOSE MIDTANK, " + Dispenser+","+DateTime.Now+"\n"); + count = count+2; + break; + + case CMD_LOOP_NM: + + Loop_cnt=Data-1; + context.AppendToFile(Dispenser_Fname,",Counter Loop,"+ Data+","+DateTime.Now +"\n"); + count = count+2; + break; + + case CMD_LOOP: + + if (Loop_cnt!=0) + { + context.AppendToFile(Dispenser_Fname,"Counter Loop,"+ Loop_cnt+","+DateTime.Now+"\n" ); + count = count+2*Data; + Loop_cnt--; + + } + else + { + context.AppendToFile(Dispenser_Fname,",End loop,,"+DateTime.Now +"\n"); + count = count+2; + } + break; + + default: + break; + + } + + long elapsed_time1 = stopwatch.ElapsedMilliseconds; + long elapsed_time2= elapsed_time1-elapsed_time; + if (elapsed_time2>95) + elapsed_time2=95; //minimum time + Thread.Sleep(100-(int )(elapsed_time2)); + + elapsed_time = stopwatch.ElapsedMilliseconds; + + + j++; + if (j==10) + { + j=0; + context.WriteLine(Dispenser_press[Dispenser]+ " mBar\t"+state + "\tTime-" + (elapsed_time/1000)); + } + } + time_Table=elapsed_time; + return 0; +} + +/////////////////////////////////////////////////////////////////// +Int32 Motor_Run(Int32 speed,Int32 Dispenser) + +{ + + switch (Dispenser) + { + case 0: + if ( speed<0) + { + Motor_Dir[0]=2; + if ((RD_LS_01_Direct & 0x04)!=0x04) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + + context.Send("StubMotorRunRequest" ,Dispenser_Motor1, false, (-speed)); + } + else + { + Motor_Dir[0]=1; + if ((RD_LS_01_Direct & 0x20)!=0x20) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor1, true, (speed)); + } + break; + + case 1: + if ( speed<0) + { + Motor_Dir[1]=2; + if ((RD_LS_01_Direct & 0x100)!=0x100) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor2, false, (-speed)); + } + else + { + Motor_Dir[1]=1; + if ((RD_LS_01_Direct & 0x800)!=0x800) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor2, true, (speed)); + } + break; + + case 2: + if ( speed<0) + { + Motor_Dir[2]=2; + if ((RD_LS_02_Direct & 0x04)!=0x04) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor3, false, (-speed)); + } + else + { + Motor_Dir[2]=1; + if ((RD_LS_02_Direct & 0x20)!=0x20) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+ ",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor3, true, (speed)); + } + break; + + case 3: + if ( speed<0) + { + Motor_Dir[3]=2; + + if ((RD_LS_02_Direct & 0x100)!=0x100) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+ ",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor4, false, (-speed)); + } + else + { + Motor_Dir[3]=1; + + if ((RD_LS_02_Direct & 0x800)!=0x800) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor4, true, (speed)); + } + break; + + case 4: + if ( speed<0) + { + Motor_Dir[4]=2; + if ((RD_LS_03_Direct & 0x04)!=0x04) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+ ",Warning Motor on Limit\n"); + return 0; + } + + context.Send("StubMotorRunRequest" ,Dispenser_Motor5, false, (-speed)); + } + else + { + Motor_Dir[4]=1; + if ((RD_LS_03_Direct & 0x20)!=0x20) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+ ",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor5, true, (speed)); + } + break; + + case 5: + if ( speed<0) + { + Motor_Dir[5]=2; + if ((RD_LS_03_Direct & 0x100)!=0x100) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor6, false, (-speed)); + } + else + { + Motor_Dir[5]=1; + if ((RD_LS_03_Direct & 0x800)!=0x800) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+ ",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor6, true, (speed)); + } + break; + + case 6: + if ( speed<0) + { + Motor_Dir[6]=2; + if ((RD_LS_04_Direct & 0x04)!=0x04) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor7, false, (-speed)); + } + else + { + Motor_Dir[6]=1; + if ((RD_LS_04_Direct & 0x20)!=0x20) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor7, true, (speed)); + } + break; + + case 7: + if ( speed<0) + { + Motor_Dir[7]=2; + + if ((RD_LS_04_Direct & 0x100)!=0x100) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor8, false, (-speed)); + } + else + { + Motor_Dir[7]=1; + + if ((RD_LS_04_Direct & 0x800)!=0x800) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Motor on Limit\n"); + return 0; + } + context.Send("StubMotorRunRequest" ,Dispenser_Motor8, true, (speed)); + } + break; + + default: + break; + + } + context.AppendToFile(Dispenser_Fname,",Run," +speed+","+DateTime.Now +"\n" ); + + return 1; +} + + + Int32 Valve_3W(Int32 Valve_Value,Int32 Dispenser) +{ + if ( Valve_Value==1) + context.Send("StubValveRequest" ,Dispenser_Valve1+Dispenser, 3, true); //3 3Way + else + context.Send("StubValveRequest" ,Dispenser_Valve1+Dispenser, 3, false); //3 3Way + + context.AppendToFile(Dispenser_Fname,",Dispenser Valve position is, " + Valve_Value+","+DateTime.Now +"\n" ); + + return 1; +} +//--------------------------------------- + + Int32 Motor_Stop(Int32 Stop_Value,Int32 Dispenser ) +{ + context.Send("StubMotorStopRequest" ,Dispenser_Motor1+Dispenser, Stop_Value); + + context.AppendToFile(Dispenser_Fname,",Motor Stop," + Stop_Value+","+DateTime.Now +"\n"); + Motor_Dir[Dispenser]=0; + return 1; +} + +//--------------------------------------- + + Int32 Delay_on_second(Int32 Delay,Int32 Dispenser ) +{ +//Int32 temp1; +Int32 pressure_om_mBAR=0; + if (Temp_Delay ==0) + { + context.AppendToFile(Dispenser_Fname,",DLY, " + Delay +","+DateTime.Now+"\n"); + Temp_Delay = Delay *10 -1; +// context.Write("A"); //debug + } + else + Temp_Delay--; + + if ( LimitSW_Dispenser(Dispenser)==0) + { + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now+",Warning Motor on Limit\n"); + MotorStop(Dispenser); + Temp_Delay =0; //end delay +// context.Write("C"); //debug + + return 0 ; + } + + pressure_om_mBAR=Calc_mBAR(Dispenser,true); + if (pressure_om_mBAR > max_pressure_level) + { + // MotorStop(Dispenser); + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Pressure too high\n"); + Temp_Delay =0; //end delay +// context.Write("D"); //debug + + return 0; + } + if (pressure_om_mBAR < min_pressure_level) + { + // MotorStop(Dispenser); + context.AppendToFile(Dispenser_Fname,",,,"+DateTime.Now +",Warning Pressure too low\n"); + Temp_Delay =0; //end delay +// context.Write("D"); //debug + + return 0; + } + + + return 1; +} + +Int32 LimitSW_Dispenser(Int32 Dispenser) +{ + + if (Dispenser==0) + + { + +// var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_01_Direct); + + if (((RD_LS_01_Direct & 0x04)!=0x04) && (Motor_Dir[0]==2)) + return 0; + else + if (((RD_LS_01_Direct & 0x20)!=0x20) && (Motor_Dir[0]==1)) + return 0; + else + return 1; + } + + if (Dispenser==1) + + { +// var response2 = context.Send("StubFpgaReadRegRequest" ,F2_LS_01_Direct); + if (((RD_LS_01_Direct & 0x100)!=0x100) && (Motor_Dir[1]==2)) + return 0; + else + if (((RD_LS_01_Direct & 0x800)!=0x800) && (Motor_Dir[1]==1)) + return 0; + else + return 1; + } + + + if (Dispenser==2) + + { + + //var response3 = context.Send("StubFpgaReadRegRequest" ,F2_LS_02_Direct); + if (((RD_LS_02_Direct & 0x04)!=0x04) && (Motor_Dir[2]==2)) + return 0; + else + if (((RD_LS_02_Direct & 0x20)!=0x20) && (Motor_Dir[2]==1)) + return 0; + else + return 1; + + } + + if (Dispenser==3) + + { + var response4 = context.Send("StubFpgaReadRegRequest" ,F2_LS_02_Direct); + if (((RD_LS_02_Direct & 0x100)!=0x100) && (Motor_Dir[3]==2)) + return 0; + else + if (((RD_LS_02_Direct & 0x800)!=0x800) && (Motor_Dir[3]==1)) + return 0; + else + return 1; + } + + + + + if (Dispenser==4) + + { + +// var response1 = context.Send("StubFpgaReadRegRequest" ,F2_LS_01_Direct); + if (((RD_LS_03_Direct & 0x04)!=0x04) && (Motor_Dir[4]==2)) + return 0; + else + if (((RD_LS_03_Direct & 0x20)!=0x20) && (Motor_Dir[4]==1)) + return 0; + else + return 1; + } + + if (Dispenser==5) + + { +// var response2 = context.Send("StubFpgaReadRegRequest" ,F2_LS_01_Direct); + if (((RD_LS_03_Direct & 0x100)!=0x100) && (Motor_Dir[5]==2)) + return 0; + else + if (((RD_LS_03_Direct & 0x800)!=0x800) && (Motor_Dir[5]==1)) + return 0; + else + return 1; + } + + + if (Dispenser==6) + + { + + //var response3 = context.Send("StubFpgaReadRegRequest" ,F2_LS_02_Direct); + if (((RD_LS_04_Direct & 0x04)!=0x04) && (Motor_Dir[6]==2)) + return 0; + else + if (((RD_LS_04_Direct & 0x20)!=0x20) && (Motor_Dir[6]==1)) + return 0; + else + return 1; + + } + + if (Dispenser==7) + + { +// var response4 = context.Send("StubFpgaReadRegRequest" ,F2_LS_02_Direct); + if (((RD_LS_04_Direct & 0x100)!=0x100) && (Motor_Dir[7]==2)) + return 0; + else + if (((RD_LS_04_Direct & 0x800)!=0x800) && (Motor_Dir[7]==1)) + return 0; + else + return 1; + } + + + return 0; +} + + +Int32 Print_Time() +{ + context.AppendToFile(Dispenser_Fname,",Time is\t,,"+ DateTime.Now +"\n" ); + + return 1; +} + + + +Int32 Calc_mBAR(Int32 Dispenser, bool save_press) +{ +Int32 Data; +Int32 Sense1; +Int32 temp=0; + + Data =A2D_Dispenser[Dispenser]; + if (Data<100) + temp=-1; + Data=Data-710; + if (Data<0) + Data=0; + + Data=Data*(10000+PressureSensorType*1000)/2840; // for -1 to 10 bar Press_Sensor_Type=1 else 0 + Data=Data-1000*PressureSensorType; // for -1 to 10 bar + + if (temp==-1) //if SamplingInBits <100 then No pressure sensor exist + Sense1=-9999 ; + else + Sense1=Data ; + if ( ((msec_index) % (Dispenser_sample_rate)) == 0) + { + context.AppendToFile(Dispenser_Fname,"" + Sense1+"\n"); + } + Dispenser_press[Dispenser]=Sense1; + return Sense1; + + } + + +//-------------------------------- +int open_midtank_valve (Int32 valve_type,Int32 valve_nm) //valve_type=0 is Air ,1 is Ink ; valve_nm 0-7 +{ + SetBit (F3_VALVE_OUT,((valve_type+1)*8)- valve_nm-1, 1); + return 1; + +} +//-------------------------------- +int close_midtank_valve (Int32 valve_type,Int32 valve_nm) //valve_type=0 is Air ,1 is Ink ; valve_nm 0-7 +{ + SetBit (F3_VALVE_OUT,((valve_type+1)*8)- valve_nm-1, 0); + return 1; +} +//-------------------------------- +Int32 SetBit(Int32 Adr, Int32 BitNo, Int32 Bit) +{ + Int32 BitMask; + + var response = context.Send("StubFpgaReadRegRequest" , F3_VALVE_OUT); + Int32 RV = (Int32) response.Value & 0xffff; + + + if (Bit == 0x1) + { + BitMask = 0x1 << BitNo; + RV = RV | BitMask; + context.Send("StubFpgaWriteRegRequest" ,F3_VALVE_OUT , RV); + } + else if (Bit == 0x0) + { + BitMask = ~(0x1 << BitNo); + RV = RV & BitMask; + context.Send("StubFpgaWriteRegRequest" ,F3_VALVE_OUT , RV); + } + return 1; +} +//---------------------------------- + void MotorStop(Int32 i) +{ + +context.Send("StubMotorStopRequest" ,Dispenser_Motor1+i, 2); +Motor_Dir[i]=0; //0 stop 1- up 2-dn + +} + +} \ No newline at end of file diff --git a/Software/Stubs Collection/Procedures/WHS_waste_Tank_Calibration_Save_V0.pproj b/Software/Stubs Collection/Procedures/WHS_waste_Tank_Calibration_Save_V0.pproj new file mode 100644 index 000000000..3bd4b1f84 --- /dev/null +++ b/Software/Stubs Collection/Procedures/WHS_waste_Tank_Calibration_Save_V0.pproj @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Drawing; +using Google.Protobuf; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.PMR.Stubs; +using Tango.PMR.Diagnostics; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.Diagnostics; +using Tango.FSE.Procedures; + + +public class Program +{ + double V0_default_ml = 8.7433; + + public void OnExecute(IProcedureContext context) + { + + var response1 = context.RequestUserInputFor("Warning - you are going to change the value of Vo in the eeprom !!!\nPlease Enter Password to confirme:",""); + if (response1=="Aa123456") + { + context.WriteLine(response1); + + //Write_0_Vo_in_ml_to_eeprom + context.WriteLine("\nWrite_0_Vo_in_ml_to_eeprom"); + StubWhsEEpromRequest stubWhsEEpromRequest = new StubWhsEEpromRequest(); + stubWhsEEpromRequest.BurnRequest = true; //write + StubWhsEEpromData stubWhsEEpromData = new StubWhsEEpromData(); + stubWhsEEpromData.Orifice1Flow = 0; + stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; + var response = context.Send(stubWhsEEpromRequest); + + //wait_10mSec + context.WriteLine("\nwait_10mSec"); + Thread.Sleep(100); //Sleep for 10 milli. + + //Read_Vo_in_ml_from_eeprom & verify it is 0 + context.WriteLine("\nRead_Vo_in_ml_from_eeprom & verify it is 0"); + stubWhsEEpromRequest.BurnRequest = false; //write + stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; + var response2 = context.Send(stubWhsEEpromRequest); + + //Read_Vo_in_mV + context.WriteLine("\nRead_Vo_in_mV"); + var response3 = context.Send("ProgressRequest" ,0x3EC, 0x01); + //Print_Vo_in_mV + context.WriteLine(response3.Progress); + + //check validity + context.WriteLine("\ncheck validity"); + if((response3.Progress <= 800) || (response3.Progress >=1200)) + { + response3.Progress = 1076; //default + context.Write("\nERROR ------ Vreading value outside the defined range !!! ------"); + context.AddResult(ResultType.Failed , "Error", "ERROR ------ Vreading value outside the defined range !!! ------"); + } + else + { + //calculate_V0_in_ml + context.WriteLine("\ncalculate_V0_in_ml"); + V0_default_ml = V0_default_ml * response3.Progress; + + //print_Vo_in_ml + context.WriteLine("\nprint_Vo_in_ml"); + context.WriteLine(V0_default_ml); + context.WriteLine(""); + + //Write_Vo_in_ml_to_eeprom + context.WriteLine("\nWrite_Vo_in_ml_to_eeprom"); + stubWhsEEpromRequest.BurnRequest = true; //write + + stubWhsEEpromData.Orifice1Flow = V0_default_ml; + stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; + var response4 = context.Send(stubWhsEEpromRequest); + + //wait_10mSec + context.WriteLine("\nwait_10mSec"); + Thread.Sleep(100); //Sleep for 10 milli. + + //Read_Vo_in_ml_from_eeprom + context.WriteLine("\nRead_Vo_in_ml_from_eeprom"); + stubWhsEEpromRequest.BurnRequest = false; //write + stubWhsEEpromRequest.WhsEEprom = stubWhsEEpromData; + var response5 = context.Send(stubWhsEEpromRequest); + + //Check if we read the correct value + context.WriteLine("\nVerify that we read the correct value of Orifice1Flow!!"); + context.AddResult(ResultType.Passed , "Pass", "Calibration Pass."); + + } + } + else + { + context.AddResult(ResultType.Failed , "Error", "Password Fail."); + } + context.WriteLine("\n -- END OF SCRIPT -- "); + } +} + -- cgit v1.3.1