diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-20 16:48:39 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-20 16:48:39 +0300 |
| commit | 9e268e6d994e21e63ead68b4314d54f4b6be56bd (patch) | |
| tree | 4b4309fbf82dc4b48c3556a3df4c0810d4b22862 | |
| parent | 384ccdc90a77d1b099ace3245163f24883bd60ee (diff) | |
| parent | 77e29b18f78daeb927c62ebd10978995d93a59f7 (diff) | |
| download | Tango-9e268e6d994e21e63ead68b4314d54f4b6be56bd.tar.gz Tango-9e268e6d994e21e63ead68b4314d54f4b6be56bd.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
74 files changed, 924 insertions, 187 deletions
diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject index 0bc7dc368..4bebf3c83 100644 --- a/Software/Embedded_SW/Embedded/.cproject +++ b/Software/Embedded_SW/Embedded/.cproject @@ -170,7 +170,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="Drivers/I2C_Communication/ektm4c129_i2c_master_udma_fifo.c|Drivers/I2C_Communication/test_fifo_dma.c|Drivers/Uart_Comm/WHS_Controller_Comm/Modbus|Drivers/Uart_Comm/WHS_Controller_Comm/Modbus/tcp|Drivers/I2C_Communication/RFID_NFC/NFC_I2C|Drivers/I2C_Communication/RFID_NFC/PN7150|Drivers/I2C_Communication/Head_Card/ADC/Head_ADC_old.c|src|EmbParam.cfg" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="Drivers/I2C_Communication/I2C_FIFO.c|Drivers/I2C_Communication/test_fifo_dma.c|Drivers/Uart_Comm/WHS_Controller_Comm/Modbus|Drivers/Uart_Comm/WHS_Controller_Comm/Modbus/tcp|Drivers/I2C_Communication/RFID_NFC/NFC_I2C|Drivers/I2C_Communication/RFID_NFC/PN7150|Drivers/I2C_Communication/Head_Card/ADC/Head_ADC_old.c|src|EmbParam.cfg" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -441,7 +441,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="EmbParam.cfg|Drivers/Uart_Comm/Uart.c|JigCommands.c|PWM.c|USBCDCD.c|Message.c|Pin_config.c|src|Configuration.c|SlowMotors.c|Timer.c|Communication.c|FastMotors.c|ADCUtils.c|Drivers/L6470|Pin.c|ADCLogger.c|Flashstore.c|Profile.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="Drivers/I2C_Communication/Head_Card/ADC/Head_ADC_old.c|Drivers/Uart_Comm/WHS_Controller_Comm/Modbus|Drivers/I2C_Communication/RFID_NFC/PN7150|Drivers/I2C_Communication/RFID_NFC/NFC_I2C|EmbParam.cfg|JigCommands.c|PWM.c|USBCDCD.c|Message.c|Pin_config.c|src|Configuration.c|SlowMotors.c|Timer.c|Communication.c|FastMotors.c|ADCUtils.c|Drivers/L6470|Pin.c|ADCLogger.c|Flashstore.c|Profile.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 4b6bdc129..0e38c6e2e 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -68,6 +68,8 @@ enum #define ENABLE 1 #define DISABLE 0 +#define DONTCARE 0 + //Valves Directions: #define MidTank_Dispenser 0 #define Dispenser_Mixer 1 diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index 3988712df..24b0fce27 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -1153,15 +1153,16 @@ uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent)//use STA return status; } -bool Emergency_Push_Button_Report()//TODO move to GPIO folder +bool Safety_Incident_Report()//TODO move to GPIO folder { - bool IsEmergencyPressed = false; + bool IsSafetyIncidentOccurred = No_Safety_Event; if(ROM_GPIOPinRead(GPIO_PORTR_BASE, GPIO_PIN_2)) //EPB_S1 (GPI_PS1_DC_OK) - IsEmergencyPressed = true; + IsSafetyIncidentOccurred = Safety_Event_Occurred; - return IsEmergencyPressed; + return IsSafetyIncidentOccurred; } + /* bool Dryer_Door_Switch()//move to Get_COVER_1_State { diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h index a764e69db..0ff0fa2de 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h @@ -247,7 +247,7 @@ void PumpActivation(uint32_t seconds); bool IsDryerStopped (void); uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent); bool Check_Disp_Safety_Stop_Indication(uint8_t Dispenser_ID); -bool Emergency_Push_Button_Report(); +bool Safety_Incident_Report(); //bool Dryer_Door_Switch(); uint8_t Pannel_Leds(PANEL_BUTTON_OR_CRAT_ID Pannel_Led_Id, OPERATION_MODE LED_Mode); uint8_t Init_Machine_Leds(); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c index 31cf5d0da..57b57a41d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c @@ -200,7 +200,7 @@ uint32_t Turn_the_Blower_Off() } else //new WHS { - Trigger_SetWHSBlowerVoltage(0); + //Trigger_SetWHSBlowerVoltage(0); } blowerStatus = false; 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 e8f41eaac..05423b8d8 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 @@ -288,7 +288,7 @@ uint32_t Head_Read_IO_Reg(uint8_t TCA9555_ADDRESS, uint8_t Byte) //LOW/HIGH/LOW_ Head_I2C_EXP4_0x46.uchar[0] &= BIT7;//ACT_DIR Head_I2C_EXP4_0x46.uchar[0] |= Read_Buf[0]; Head_I2C_EXP4_0x46.uchar[1] &= (BIT2 | BIT3);//ACTIN_ON ACTOT_ON - Head_I2C_EXP4_0x46.uchar[1] |= Read_Buf[0]; + Head_I2C_EXP4_0x46.uchar[1] |= Read_Buf[1]; } else if(Byte == LOW) @@ -520,7 +520,26 @@ uint32_t HeadCard_Actuators_Control(ACTUATORS Act_ID, bool Direction) } -uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction) +uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) // use IfIndex for Act_ID +{ + uint32_t status = OK; + + ACTUATORS Act_ID = (ACTUATORS)(IfIndex); + + if(Act_ID == ACTIN)//0 + { + Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTIN_ON = HIGH; + } + else//if(Act_ID == ACTOUT) 1 + { + Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTOT_ON = HIGH; + } + Trigger_OutputsWriting();//status |= Head_Write_IO_Reg(0x46,HIGH); + + return status; +} + +uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)//ENABLE/DISABLE, DOWN/UP/DONTCARE { uint32_t status = OK; @@ -538,6 +557,9 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction) { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTOT_ON = LOW; } + + //100msec delay - (need short command - Active LOW ) + ActControlId = AddControlCallback("ctuatorControl", HeadCard_ActStubCallBackFunction, (eHundredMillisecond), TemplateDataReadCBFunction,Act_ID,0, 0 ); } else { @@ -598,7 +620,7 @@ uint32_t HeadCard_Actuators_Status(ACTUATORS Act_ID)// { uint32_t Motion_Status = STOPPED; - //Head_Read_IO_Reg(0x46,HIGH); //I2C task - Actuators_Control + //Head_Read_IO_Reg(0x46,HIGH); //Trigger_InputsReading(); Done every Hundred_msTick if(Act_ID == ACTIN) { @@ -650,6 +672,89 @@ uint8_t Head_Test_IO() return status; } +#define ACTUATOR_RELOCATING_MOVEUP_TIME 160 + +typedef enum +{ + ActuatorIdle, + ActuatorMoveDown, + ActuatorWait, //wait for the actuator to get to the lower position + ActuatorMoveUp, + ActuatorLocated +}ActuatorLocatingEnum; + +ActuatorLocatingEnum ActuatorLocating = ActuatorIdle; +uint32_t ActuatorLocatingControl = 0xFF; +uint32_t count_time = 0, moveuptime = 0; +uint32_t MovingUpTime = ACTUATOR_RELOCATING_MOVEUP_TIME; + +bool isActuatorOnLowestLocation(void) // Give indication if the actuator stopped in this case reached to the lowest point +{ + bool Status = FALSE; + + //read the inputs in Hundred_msTick + + if(HeadCard_Actuators_Status(ACTIN) == STOPPED) + { + Status = TRUE; + } + return Status; +} + +uint32_t HeadCard_Actuators_Relocate_callback(uint32_t IfIndex, uint32_t BusyFlag) // use IfIndex for Act_ID +{ + count_time++; + 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); + 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); + } + 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); + } + break; + case ActuatorLocated: + if (SafeRemoveControlCallback(ActuatorLocatingControl, HeadCard_Actuators_Relocate_callback )==OK) + ActuatorLocatingControl = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActuatorLocatingControl,RpWarning,(int)HeadCard_Actuators_Relocate_callback,0); + ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + break; + default: + break; + } + return ActuatorLocatingControl; +} +uint32_t HeadCard_Actuators_Relocate(void) +{ + if ((ActuatorLocating == ActuatorIdle)||(ActuatorLocating == ActuatorLocated)) + { + 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 ); + } + return ActuatorLocatingControl; +} + + diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h index d927fdaa0..33187d1f6 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h @@ -198,6 +198,7 @@ uint32_t HeadCard_Valve_Control(bool Direction); uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction); +uint32_t HeadCard_Actuators_Relocate(void); //------------------------------ uint8_t Head_Test_IO(); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c index 04388865b..c83fe6e50 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c @@ -23,6 +23,8 @@ #define I2C_DELAY 3000 uint8_t Main_Mux_Flag = UNKNOWN; +uint32_t I2C_BUSY_DELAY = 100; + void InitI2C2() { // diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h index e8fa3efc3..56c386aa8 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h @@ -10,8 +10,8 @@ extern uint32_t Arb_Loss_Count; - -#define I2C_BUSY_DELAY 100//15000 +extern uint32_t I2C_BUSY_DELAY; +//#define I2C_BUSY_DELAY 100//15000 uint32_t I2C_control(uint32_t I2C_ID, uint32_t Slave_Add, bool RW,uint32_t Byte2Write ); void Init_All_I2C(); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Comm.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Comm.c index 9bcdec476..182e5ccf7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Comm.c @@ -55,16 +55,16 @@ uint32_t I2C_WriteBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* dat { I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_SINGLE_SEND); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed - while(I2CMasterBusy(I2C_BASE)); status |= I2CMasterErr(I2C_BASE); + while(I2CMasterBusy(I2C_BASE)); } else { // Start sending consecutive data I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_SEND_START); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed - while(I2CMasterBusy(I2C_BASE)); status |= I2CMasterErr(I2C_BASE); + while(I2CMasterBusy(I2C_BASE)); len--; data++; @@ -74,8 +74,8 @@ uint32_t I2C_WriteBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* dat I2CMasterDataPut(I2C_BASE, *data); I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed - while(I2CMasterBusy(I2C_BASE)); status |= I2CMasterErr(I2C_BASE); + while(I2CMasterBusy(I2C_BASE)); len--; data++; @@ -85,8 +85,8 @@ uint32_t I2C_WriteBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* dat I2CMasterDataPut(I2C_BASE, *data); I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed - while(I2CMasterBusy(I2C_BASE)); status |= I2CMasterErr(I2C_BASE); + while(I2CMasterBusy(I2C_BASE)); } return status; @@ -119,9 +119,9 @@ uint32_t I2C_ReadBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* data //see: https://e2e.ti.com/support/microcontrollers/other/f/908/t/368493?Why-is-a-delay-needed-before-writing-the-first-byte-from-I2C-Master- //therefore we need delay before waiting until bus is not busy - it doesn't work as expected without it or with while(!(I2CMasterBusy(I2C0_BASE) SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed + status |= I2CMasterErr(I2C_BASE); while(I2CMasterBusy(I2C_BASE)); *data = I2CMasterDataGet(I2C_BASE); - status |= I2CMasterErr(I2C_BASE); } else { @@ -129,9 +129,9 @@ uint32_t I2C_ReadBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* data // Start receiving consecutive data I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed + status |= I2CMasterErr(I2C_BASE); while(I2CMasterBusy(I2C_BASE)); *data = I2CMasterDataGet(I2C_BASE); - status |= I2CMasterErr(I2C_BASE); len--; data++; @@ -141,9 +141,9 @@ uint32_t I2C_ReadBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* data while(len > 1){ I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed + status |= I2CMasterErr(I2C_BASE); while(I2CMasterBusy(I2C_BASE)); *data = I2CMasterDataGet(I2C_BASE); - status |= I2CMasterErr(I2C_BASE); len--; data++; @@ -152,9 +152,9 @@ uint32_t I2C_ReadBuff(uint32_t I2C_BASE, unsigned char addr, unsigned char* data // Receive last piece of data I2CMasterControl(I2C_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); SysCtlDelay(I2C_BUSY_DELAY);//The CPU waits for the Command processing to begin before it goes to check if the command is processed + status |= I2CMasterErr(I2C_BASE); while(I2CMasterBusy(I2C_BASE)); *data = I2CMasterDataGet(I2C_BASE); - status |= I2CMasterErr(I2C_BASE); } return status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c index 708c4dde5..f126c254b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c @@ -28,6 +28,7 @@ #include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h> #include "ADC_MUX/ADC_MUX.h" #include "modules/ids/ids_ex.h" +#include <Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h> extern Semaphore_Handle I2C_Sem; Task_Handle I2C_Task_Handle; @@ -274,6 +275,19 @@ void Trigger_InputsReading(void) } +void Trigger_OutputsWriting(void) +{ + I2C_ReadingMessageStruc I2C_ReadingMessage; + //uint8_t Midtank_i; + + I2C_ReadingMessage.messageId = Head_Outputs_Writing; + if (I2C_ReadingMsgQ != NULL) + Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); + return; + +} + + void Trigger_WHS_init_IO(void) { I2C_ReadingMessageStruc I2C_ReadingMessage; @@ -652,6 +666,7 @@ void I2C_ReadingTask(UArg arg0, UArg arg1) Head_Read_IO_Reg(0x46, LOW_AND_HIGH);//READ HEAD CARD LS + ACT status + BREAK_HTOT break; case Head_Outputs_Writing: + Head_Write_IO_Reg(0x46,HIGH);//ACT break; case DispenserReadData: Dispenser_EEPROM_Read_Data(I2C_ReadingMessage.parameter); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h index 2a98296b4..16f86f9ed 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h @@ -51,6 +51,7 @@ void Trigger_Head_Actuators_Stub(uint32_t Act_ID, bool Active_Low_Pwr, bool Dire void Trigger_Head_Actuators_Disable(void); void Trigger_Head_Fan_Control(uint32_t Fan_ID, uint16_t PWM); void Trigger_InputsReading(void); +void Trigger_OutputsWriting(void); void Trigger_Head_Magnet(int direction); void Trigger_Head_MixerValve(int direction); void Trigger_Head_PressureArc(bool Enable_Disable); 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 c51ff6d96..32d82f8af 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 @@ -407,7 +407,7 @@ void WHS_Set_IFS_Clearing_Suction (int midtank) } #define MAX_ALLOWED_BLOWER_VOLTAGE 4300 -#define MIN_ALLOWED_BLOWER_VOLTAGE 2000 +#define MIN_ALLOWED_BLOWER_VOLTAGE 2400 bool BlowerAlarmActive = false; void SendLimitedBlowerControl(int mV) { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c index 74083e67a..0b859cc79 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c @@ -24,7 +24,7 @@ //uint32_t I2C_WHS_EEPROM_SLAVE_ADD = 0xA0; WHS_EEPROM WHS_Eeprom; -uint8_t WHS_Type = WHS_TYPE_UNKNOWN; +WHS_TYPE WHS_Type = WHS_TYPE_UNKNOWN; #define MAX_ALLOWS_PAGE_WRITE 256 #define MIN_READ_BYTE 1 diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 8f5bd0b1d..cd66c7a16 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -386,9 +386,9 @@ uint32_t MotorGetStatusFromFPGA(TimerMotors_t _motorId) uint32_t MotorGetStatusFromFPGA_Callback(TimerMotors_t _motorId,uint32_t Data) { #ifndef EVALUATION_BOARD - MotorDriverResponse[_motorId].Status = Data;//TODO >>8 ??? + MotorDriverResponse[_motorId].Status = Data >> 8; #endif - return MotorDriverResponse[_motorId].Status; + return (MotorDriverResponse[_motorId].Status & 0xFFFF); } //uint32_t MotorGetStatusFromFPGA_Res(TimerMotors_t _motorId) diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index b2e623a11..12c9193e3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -179,6 +179,7 @@ uint32_t MotorMoveWithCallback (TimerMotors_t MotorId,bool direction, uint32_t S printBusy = true; Report("MotorControlGetnBusyState print",__FILE__,__LINE__,MotorDriverResponse[MotorId].Busy,RpMessage,0,0); }*/ + ReportWithPackageFilter(GeneralFilter,"MotorMoveWithCallback",__FILE__,direction,MotorId,RpMessage,Steps,0); //call driver action to device id with the parameter //SetMotorSpeed (deviceId, parameter); @@ -657,6 +658,11 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t //SetMotorSpeed (deviceId, parameter); if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DH_LID) { + if ((Is_PP_Machine()==true)&&(Safety_Incident_Report()==Safety_Event_Occurred)) + { + ReportWithPackageFilter(GeneralFilter,"cannot open dyeing head lid when safety active",__FILE__,direction,MotorId,RpMessage,Safety_Incident_Report(),0); + return ERROR; + } DeActivateHeadMagnet(); //open the lid magnet if (direction == MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_LID].directionthreadwize) { diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 5c6c13686..88ba521a4 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -39,6 +39,7 @@ #include <DataDef.h> #include "Sys_PinOut_Config/MCU_MAIN_pinout.h" +#include <Drivers/I2C_Communication/I2C.h> /* #include "Drivers/SPI_SDCARD/SDSPI.h" @@ -265,8 +266,10 @@ int main(void) Init_All_I2C(); Block_Main_MUX_TCA9548A_0xE4();//unused, same i2c as head and whs cards + I2C_BUSY_DELAY = 3000; //temporary workaround!!! Check_Head_Type_Via_EEPROM();//without trigger Check_WHS_Type_Via_EEPROM();//without trigger + I2C_BUSY_DELAY = 100; //temporary workaround!!! if ((Head_Type >= HEAD_TYPE_UNKNOWN_WITH_CARD)&&(WHS_Type == WHS_TYPE_NEW)) { PP_Machine = true; diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 1c2b6662d..cc8ae5be8 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -893,7 +893,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) if (AlarmItem[Alarm_i].AlarmSource == ALARM_SOURCE_TYPE__CoversAlarm) { - if (AlarmState[Alarm_i].Status == true) + if ((AlarmState[Alarm_i].Status == true)&&(AlarmItem[Alarm_i].Severity == DEBUG_LOG_CATEGORY__Error)) { FoundReason = JOB_TAMPER_ALARM; ReportWithPackageFilter(AlarmFilter,"tamper alarm preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); @@ -977,6 +977,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) case EVENT_TYPE__INSUFFICIENT_AIR_FLOW: case EVENT_TYPE__VOC_SENSOR_ALARM_TIME: case EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE: + //case EVENT_TYPE__POWER_UP_BIT_FAILURE: FoundReason = JOB_UNSPECIFIED_ERROR; AlarmId = Alarm_i; ReportWithPackageFilter(AlarmFilter,"an alarm preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); @@ -1001,7 +1002,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) //AbortJob(AlarmReasonStr); //PrepareReady(Module_Alarms,ModuleFail); ReportWithPackageFilter(AlarmFilter,AlarmReasonStr, __FILE__,__LINE__,AlarmId, RpMessage, DEBUG_LOG_CATEGORY__Error, 0); - return (JobEndReason); + return (FoundReason); } return JOB_OK; } @@ -1314,7 +1315,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) } break; case ALARM_SOURCE_TYPE__MotorAlarm: - if (0)//(CheckMotorAlarms) + if (CheckMotorAlarms) { if (FPGA_WD_Occurred == true) { @@ -1324,6 +1325,10 @@ uint32_t AlarmHandlingLoop(uint32_t tick) { Status = false; } + else if (AlarmItem[Alarm_i].DeviceId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) + { + Status = false; + } else { switch (AlarmItem[Alarm_i].AlarmValue) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index a56c3dae1..27fc8a707 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -594,7 +594,7 @@ uint32_t MillisecLowLoop(uint32_t tick) //call all modules Millisec functions //test dancers and speed encoders //check all callback units (state machine waiting for completion of a change) - bool Ten_msTick, Fifty_msTick, Hundred_msTick , m20msecTick,m70msecTick,m90msecTick, Onesecond_Tick,Tensecond_Tick,OneMinute_Tick,OneHourTick,Gradient_Tick; + bool Ten_msTick, Fifty_msTick, Hundred_msTick , m20msecTick,m70msecTick,m90msecTick, Onesecond_Tick,Tensecond_Tick,OneMinute_Tick,TenMinutes_Tick,OneHourTick,Gradient_Tick; bool O700Millisecond_Tick,O200Millisecond_Tick,O400Millisecond_Tick,O500Millisecond_Tick,O600Millisecond_Tick; //bool O100Millisecond_Tick,O200Millisecond_Tick,O400Millisecond_Tick,O500Millisecond_Tick,O600Millisecond_Tick,O800Millisecond_Tick,O900Millisecond_Tick; Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; @@ -614,6 +614,7 @@ uint32_t MillisecLowLoop(uint32_t tick) Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; Tensecond_Tick = (tick%10000 == 0) ?true:false; OneMinute_Tick = (tick%eOneMinute == 0) ?true:false; + TenMinutes_Tick = (tick%eTenMinutes == 0) ?true:false; OneHourTick = (tick%eOneHour == 0) ?true:false; realtimetest[(tick%1000)/10]++; //gather Motor data from FPGA @@ -800,11 +801,13 @@ uint32_t MillisecLowLoop(uint32_t tick) #ifdef CONTROL_DEBUG ResetControlTime(); #endif + } + if (TenMinutes_Tick) + { if (WHS_Type == WHS_TYPE_NEW) { waste_seq_step1();// include 1Sec delay <- to open !!!! } - } if (OneHourTick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h index 78e24f495..4b6a80967 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.h +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h @@ -21,6 +21,7 @@ typedef enum { eHundredMillisecond = 100, eOneSecond = 1000, eOneMinute = 60000, + eTenMinutes = 600000, eOneHour = 3600000 }CTRL_TIMING_ENUM; typedef enum diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index 60b9cba9e..4d3344ce7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -31,7 +31,7 @@ #include <Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.h> #include "drivers/Valves/Valve.h" #include "drivers/Heater/Heater.h" -#include "modules/waste/waste.h" +#include "modules/waste/waste_ex.h" #include "Drivers/I2C_Communication/I2C_Task.h" #include "Drivers/I2C_Communication/I2C.h" #include "modules/ids/ids_ex.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 8e01fe18e..1f5093601 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -31,7 +31,7 @@ #include "Modules/AlarmHandling/AlarmHandling.h" #include "Modules/heaters/heaters_ex.h" #include "modules/thread/thread_ex.h" -#include "modules/waste/waste.h" +#include "modules/waste/waste_ex.h" #include "PMR/Hardware/HardwareDancerType.pb-c.h" #include <PMR/Diagnostics/StartDiagnosticsRequest.pb-c.h> @@ -864,10 +864,10 @@ void DiagnosticOneSecCollection(void) tempFlow = HeadFlowMeter; }*/ WasteLevel = GetWHSWasteTankLevelMiliLiter()/1000;//change from ml to litter - static double InitCounter = 0; - if (GetMachineState()<MACHINE_STATE_NO_PROCESS_PARAMS) + static double InitCounter = 60.0; + if ((GetMachineState()<MACHINE_STATE_NO_PROCESS_PARAMS) &&(GetMachineState()>=MACHINE_STATE_WAIT_FOR_COOLER)) { - InitCounter+=1.0; + InitCounter-=1.0; DiagnosticsMonitor.chillertemperature = &InitCounter; } @@ -1058,7 +1058,8 @@ void SendDiagnostics(void) DiagnosticsMonitor.dancer2angle = dancer2angle; DiagnosticsMonitor.dancer3angle = dancer3angle; */ - if ((JobIsActive())&&(DiagnosticMode >= Diagnostic_Extended_Mode)) +// if ((JobIsActive())&&(DiagnosticMode >= Diagnostic_Extended_Mode)) + if (DiagnosticMode >= Diagnostic_Extended_Mode) { DiagnosticsMonitor.n_dancer1angle = DancerCounterIndex[0]; DiagnosticsMonitor.n_dancer2angle = DancerCounterIndex[1]; diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index bec8fc53f..e9d9a4e9b 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -165,8 +165,12 @@ uint32_t HWConfigurationInit(void) #ifndef DISPESER_TEST if (WHS_Type == WHS_TYPE_NEW) newWHS_init(); + //WHS_init(); // remove call to old WHS #endif + + // Waste Init (WHS) Waste_Init(); + ADC_MUX_Init(); GeneralHwReady = true; @@ -420,8 +424,8 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) EmbeddedParametersInit(); PrintingHWConfiguration(request); - if (request->n_winders == 1) - status += InternalWinderConfigMessage(request->winders); + //if (request->n_winders == 1) + // status += InternalWinderConfigMessage(request->winders); status += MotorsInit(); @@ -490,7 +494,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) DispenserId = request->dispensers[Dispenser_i]->index; Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON Valve_Set(IDS_Id_to_CartrideValve[DispenserId], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON - status += DispenserConfigMessage(request->dispensers[Dispenser_i]); + //status += DispenserConfigMessage(request->dispensers[Dispenser_i]); if (Check_Dispenser_Type(DispenserId) == LS_STATUS_ERROR) { LOG_ERROR (DispenserId, "Dispenser identification failed"); diff --git a/Software/Embedded_SW/Embedded/Modules/General/Safety.c b/Software/Embedded_SW/Embedded/Modules/General/Safety.c index 89ac8d020..099ac1769 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/Safety.c +++ b/Software/Embedded_SW/Embedded/Modules/General/Safety.c @@ -46,7 +46,7 @@ uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) bool mDrierDoorAlarmState = false; bool mAirFlowAlarmState = false; bool mAirFilterAlarmState = false; - //bool mWasteOverflowAlarmState = false; + bool mWasteOverflowAlarmState = false; #ifdef CONTROL_DEBUG uint32_t tempp,tempq,delta; uint32_t sys_ticks_start = msec_millisecondCounter,sys_ticks_end,max = 0,dev = 0; @@ -91,6 +91,16 @@ uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) mDrierDoorAlarmState = true; DrierDoorAlarmState = true; } + else + { + //if (WHS_GPI_WASTE_OVERFULL()) - cannot read this switch + { + //report and handle waste overflow + AlarmHandlingSetAlarm(EVENT_TYPE__CHILLER_DRY_CONTACT, true); + mWasteOverflowAlarmState = true; + WasteOverflowAlarmState = true; + } + } } } @@ -224,6 +234,12 @@ uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) AlarmHandlingSetAlarm(EVENT_TYPE__AIR_FILTER_NOT_INSTALLED, false); AirFilterAlarmState = mAirFilterAlarmState; } + if ((mWasteOverflowAlarmState != WasteOverflowAlarmState)|| (mWasteOverflowAlarmState == false)) + { + //alarm went off + AlarmHandlingSetAlarm(EVENT_TYPE__WASTE_CONTAINER_OVERFLOW, false); + WasteOverflowAlarmState = mWasteOverflowAlarmState; + } #ifdef CONTROL_DEBUG tempq = HibernateRTCSSGet(); if (tempq < tempp) diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h index 646861bc7..6a15d3765 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h @@ -59,7 +59,6 @@ uint32_t Buttons_Init(void); uint32_t Button_load_Init(void); uint32_t Button_JOG_Init(void); bool SetPowerMachineState(PBmachineState state); -void Ink_Cart_Led(); diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index bf7d761dd..30a99ac86 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -119,7 +119,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams,bool saveData) } if (saveData == true) { - if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters + if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone1temp > 0.1))//NOT turning off heaters { Bytes = sizeof(ProcessParameters); FileWrite(ProcessParams,Bytes,ProcessParamsConfigPath,BIOS_WAIT_FOREVER); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 3798e9aee..7693d1520 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -347,19 +347,20 @@ void IDS_Dispenser_Content_Calculation (char DispenserId) != DispenserIdToMotorId[DispenserId]) return; + /********* THIS FUNCTION IS NOW CALLED EVERY 400 MILISECONDS!!!!!!!!!! ***************************/ //int dir = (IDS_Dispenser_Data[DispenserId].direction==1)?1:-1; //double consumedintimeframe = (double)(CurrentDispenserSpeed[DispenserId])*(double)(IDS_Dispenser_Data[DispenserId].microsteps)* // IDS_Dispenser_Data[DispenserId].nanolitterperpulse ;//* dir; //double consumedintimeframe = (double)(CurrentDispenserSpeed[DispenserId]); //pulses only //consumedintimeframe = 10+DispenserId; - IDS_Dispenser_Data[DispenserId].consumedinnanolitter += (CurrentDispenserSpeed[DispenserId]/10);//100 milliseconds ==> speed/10 + IDS_Dispenser_Data[DispenserId].consumedinnanolitter += (CurrentDispenserSpeed[DispenserId]*4/10);//100 milliseconds ==> speed/10 if (IDS_Dispenser_Data[DispenserId].consumedinnanolitter<0) IDS_Dispenser_Data[DispenserId].consumedinnanolitter = 0; if (CurrentDispenserSpeed[DispenserId]>0.1) { DispenserDataUpdated = true; IDS_Dispenser_Data[DispenserId].totalconsumedinnanolitter += (CurrentDispenserSpeed[DispenserId]/10); - if (seconds_counter%6000 == 0) + if (seconds_counter%1500 == 0) //1500*400MILI = 600000 { Report("IDS_Dispenser_Data ",__FILE__,DispenserId,(int)IDS_Dispenser_Data[DispenserId].consumedinnanolitter,RpWarning,(int)CurrentDispenserSpeed[DispenserId],0); } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c index 470bf974e..8f1de2c1c 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c @@ -17,7 +17,7 @@ #define MAX_CONTROL_SAMPLES 10 -HardwareDispenser DispensersCfg[ MAX_SYSTEM_DISPENSERS]; +//HardwareDispenser DispensersCfg[ MAX_SYSTEM_DISPENSERS]; TimerMotors_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS] = {HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_2,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_3,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_4,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_5,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_6,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_7,HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8}; @@ -37,7 +37,7 @@ bool isDispenserInConfig(int DispenserId) } -uint32_t DispenserConfigMessage(HardwareDispenser * request) +/*uint32_t DispenserConfigMessage(HardwareDispenser * request) { uint32_t status = PASSED; int Dispenser_i; @@ -50,7 +50,7 @@ uint32_t DispenserConfigMessage(HardwareDispenser * request) } else return Dispenser_i; -} +}*/ void IDS_ModuleInit(void) { Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index c444c7017..8682d648a 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -43,6 +43,8 @@ typedef struct HardwarePidControl *DispensersControl; HardwarePidControl DispensersCtrl[MAX_SYSTEM_DISPENSERS]; #define MAX_DYE_DISPENSERS 6 +#define IDS_PRESEGMENT_TIME_STEP 50 + int32_t DispenserSamples[MAX_SYSTEM_DISPENSERS][MAX_CONTROL_SAMPLES] = {0}; int DispenserSamplePointer[MAX_SYSTEM_DISPENSERS] = {0}; double DispenserNormalizedErrorCoEfficient[MAX_SYSTEM_DISPENSERS] = {0}; @@ -117,8 +119,9 @@ void IDS_Dispenser_SetPreSegmentWFCFValues(double dispenserpresegmentwfcf, doubl LeftRockerSpeed = ids_leftcleaningmotorspeed; if ( ids_rightcleaningmotorspeed) RightRockerSpeed = ids_rightcleaningmotorspeed; - Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,CleaningDispenserSpeed,RpWarning,(int)LeftRockerSpeed,0); + Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,RightRockerSpeed,RpWarning,(int)LeftRockerSpeed,0); Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,InterSegmentStartSprayCleaner,RpWarning,(int)InterSegmentCenterRockers,0); + Report("IDS_Dispenser actuator times ",__FILE__,(int)LeftRockerSpeed/100*IDS_PRESEGMENT_TIME_STEP,(int)LeftRockerSpeed%100*IDS_PRESEGMENT_TIME_STEP,RpWarning,(int)RightRockerSpeed*IDS_PRESEGMENT_TIME_STEP,0); } @@ -648,7 +651,7 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) "WFCF Dispenser %d nl/sec %d nl/pulse %d Pulse/sec %d speed %d", DispenserId, (int) Dispensers[Dispenser_i]->nanolitterpersecond, - (int) Dispensers[Dispenser_i]->nanoliterperpulse, + (int) (Dispensers[Dispenser_i]->nanoliterperpulse*100), (int) Dispensers[Dispenser_i]->pulsepersecond*1000, (int) segmentfirst_speed*1000); //REPORT_MSG(segmentfirst_speed,IdsMessage); @@ -1034,7 +1037,6 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) //******************************************************************************************************************** -#define IDS_PRESEGMENT_TIME_STEP 50 uint32_t IDSPreSegmentStateCallbackRunner(uint32_t IfIndex, uint32_t ReadValue) { JobDispenser **Dispensers; diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h index bf42c0e9a..55d712412 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h @@ -24,4 +24,8 @@ typedef enum{ void midTankStateMachine(void); uint32_t MidTankReading(void); void ResponseDemo(int MidtankId); +bool IFS_MidTankFilling(void); +MidTank_t IFS_MidTankIsActive(void); +bool IFS_CartridgeLowerPresent(); + #endif /* MODULES_IFS_IFS_H_ */ diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index e5afba3b9..6b6b85f2f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -526,6 +526,14 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } else + if(request->amount == 0xAD9) //halt + { + LOG_ERROR(request->delay,"halt"); + memset (0,0,100000); + 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); @@ -1117,7 +1125,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); free(responseContainer.data.data); - //writeLine("Progress Completed!"); + progress_request__free_unpacked(request,NULL); SendChars((char*)container_buffer, container_size); //free(container_buffer); if (RestartNeeded == true) diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c index 1663219bd..0cc1e8939 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c @@ -379,7 +379,10 @@ void Stub_MotorStatusRequest(MessageContainer* requestContainer) } else { - read_status = Get_Param(x_STATUS); + #ifdef EVALUATION_BOARD + read_status = Get_Param(x_STATUS);// Function only for evaluation board !!!!! + //if needed use Motor_Get_Param_Horizontal_Printing_powerstep01_rev10.cs + #endif } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 92b953db5..420141d5b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -89,14 +89,14 @@ void SetWinderBackToBaseTime(uint32_t value) ReportWithPackageFilter(ThreadFilter,"Set WinderBackToBaseTime",__FILE__,__LINE__,WinderBackToBaseTime,RpWarning,KeepWindingCone, 0); } -uint32_t InternalWinderConfigMessage(HardwareWinder* request) +/*uint32_t InternalWinderConfigMessage(HardwareWinder* request) { uint32_t status = PASSED; InternalWinderCfg.milimetersperrotation = request->millimeterperrotation; return status; -} +}*/ char ScrewStr[150]; uint32_t InternalWindingConfigMessage(JobSpool* request) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 42a56ae8a..c67619e20 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -352,9 +352,9 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) } if ((CurrentProcessedLength>=CurrentRequestedLength )&&(CurrentRequestedLength > 0.0)) { - usnprintf(Lenstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); + usnprintf(Lenstr, 100, "Total processed length: Feeder: %d Puller %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); SendJobProgress(0.0,0,false, Lenstr); - ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); + ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,__LINE__,(int)(TotalProcessedLength*100),RpWarning,(int)(PoolerTotalProcessedLength*100),0); // segment/intersegment/distance to spool finished if (ProcessedLengthFuncPtr) ProcessedLengthFuncPtr(); @@ -696,18 +696,19 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*`/ }*/ calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; + calculated_speed = calculated_speed*InitialDryerSpeed/OriginalMotorSpd_2PPS[DRYER_MOTOR]; //calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*CurrentControlledSpeed[index]; - //if (JobCounter % eHundredMillisecond == 50) - if (FirstCalcInJob == true) + if (0)//(JobCounter % 1000 == 0) + //if (JobCounter < 100)//(FirstCalcInJob == true) { - if (index == POOLER_MOTOR) + if (index == FEEDER_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", - ReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000), + // 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", + 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); - ReportWithPackageFilter(ThreadFilter,TMessage,__FILE__,__LINE__,DancerId,RpError,ReadValue,0); + (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); } } @@ -720,6 +721,11 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { if (calculated_speed>5.0) { + if (calculated_speed>(CurrentControlledSpeed[index]+100)) + { + ReportWithPackageFilter(ThreadFilter,"limit acceleration",__FILE__,calculated_speed,CurrentControlledSpeed[index],RpError,CurrentControlledSpeed[index]+100,0); + calculated_speed=CurrentControlledSpeed[index]+100; + } CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } @@ -845,6 +851,7 @@ uint32_t Release_Right_TFU_Tension() return status; } int SecondFeederCorrection = 4; +int PrepareWaitCount = 0; uint32_t Adjust_Right_TFU_Tension_2nd_Callback(uint32_t MotorId, uint32_t ReadValue) { MotorStop (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,Soft_Stop); //per L6470 errata between mov and run commands @@ -854,6 +861,18 @@ uint32_t Adjust_Right_TFU_Tension_2nd_Callback(uint32_t MotorId, uint32_t ReadVa Report("release tension - job aborted",__FILE__,__LINE__,MotorId,RpMessage,0,0); Release_Right_TFU_Tension(); } + if (PrepareWaitCount) + { + ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_TensionCallback",__FILE__,__LINE__,2,RpWarning,PrepareWaitCount,0); + PrepareWaitCount--; + } + if ((PrepareWaitCount == 0)&&(PrepareState == true)) + { + PrepareState = false; + ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_TensionCallback Prepare Ready",__FILE__,__LINE__,2,RpWarning,PrepareWaitCount,0); + PrepareReady(Module_Thread,ModuleDone); + } + return OK; } uint32_t Adjust_Right_TFU_Tension_Callback(uint32_t MotorId, uint32_t ReadValue) @@ -869,16 +888,16 @@ uint32_t Adjust_Right_TFU_Tension(double tension) uint32_t status = OK; if (tension > 0.5) //0 = lower position, 1 = high position { + //PrepareWaitCount++; if (FPGA_Read_limit_Switches(GPI_LS_RDANCER_UP) == NO_LIMIT) { - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 40, GPI_LS_RDANCER_UP, Adjust_Right_TFU_Tension_Callback,15000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, GPI_LS_RDANCER_UP, Adjust_Right_TFU_Tension_Callback,15000); Report("Adjust_Right_TFU_Tension",__FILE__,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize,HARDWARE_MOTOR_TYPE__MOTO_RDANCER,RpMessage,GPI_LS_RDANCER_UP,0); } } return status; } -int PrepareWaitCount = 0; uint32_t ThreadPrepare_TensionCallback (int DancerId, double tension) { if (PrepareWaitCount) @@ -886,7 +905,7 @@ uint32_t ThreadPrepare_TensionCallback (int DancerId, double tension) ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_TensionCallback",__FILE__,__LINE__,DancerId,RpWarning,PrepareWaitCount,0); PrepareWaitCount--; } - if (PrepareWaitCount == 0) + if ((PrepareWaitCount == 0)&&(PrepareState == true)) { PrepareState = false; ReportWithPackageFilter(ThreadFilter,"ThreadPrepare_TensionCallback Prepare Ready",__FILE__,__LINE__,DancerId,RpWarning,PrepareWaitCount,0); @@ -944,7 +963,7 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) } usnprintf(Lenstr, 100, "ThreadPrepare_Tension Dancer %d Request: %d Current %d movement %d dir %d motor %d address %d", DancerId,request,current,movement,direction,HW_Motor_Id,address); - ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,address,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpWarning,PrepareWaitCount,0); + ReportWithPackageFilter(ThreadFilter,Lenstr,__FILE__,address,current,RpWarning,request,0); return status; } @@ -1046,71 +1065,73 @@ uint32_t ThreadPrepareState(void *JobDetails) { HW_Motor_Id = ThreadMotorIdToMotorId[Motor_i]; Pid_Id = Motor_i;/*ThreadMotorIdToControlId[Motor_i];*/ - 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; - MotorControlConfig[Motor_i].m_params.Kp = MotorsControl[Pid_Id].proportionalgain; - MotorControlConfig[Motor_i].m_params.Ki = MotorsControl[Pid_Id].integraltime; - MotorControlConfig[Motor_i].m_params.IntegralErrorMultiplier = MotorsControl[Pid_Id].setpointramprateorsoftstartramp; - MotorControlConfig[Motor_i].m_params.ProportionalErrorMultiplier = MotorsControl[Pid_Id].outputonoffhysteresisvalue; - MotorControlConfig[Motor_i].m_params.epsilon = MotorsControl[Pid_Id].epsilon; - MotorControlConfig[Motor_i].m_params.dt = MotorsControl[Pid_Id].controloutputtype; - MotorControlConfig[Motor_i].m_ingnoreValue = MotorsControl[Pid_Id].sensorcorrectionadjustment; // the minimal change required to change the motor speed in pulses - MotorControlConfig[Motor_i].m_calculatedError = 0; - MotorControlConfig[Motor_i].m_integral = 0; - MotorControlConfig[Motor_i].m_isEnabled = true; - MotorControlConfig[Motor_i].m_isReady = true; - MotorControlConfig[Motor_i].m_mesuredParam = 0; - 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]) - { - MotorTimer[Motor_i] = MotorTiming[Motor_i]-1; - ReportWithPackageFilter(ThreadFilter,"MotorTiming",__FILE__,Motor_i,MotorTiming[Motor_i],RpWarning,MotorTimer[Motor_i],0); - } + 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; + MotorControlConfig[Motor_i].m_params.Kp = MotorsControl[Pid_Id].proportionalgain; + MotorControlConfig[Motor_i].m_params.Ki = MotorsControl[Pid_Id].integraltime; + MotorControlConfig[Motor_i].m_params.IntegralErrorMultiplier = MotorsControl[Pid_Id].setpointramprateorsoftstartramp; + MotorControlConfig[Motor_i].m_params.ProportionalErrorMultiplier = MotorsControl[Pid_Id].outputonoffhysteresisvalue; + MotorControlConfig[Motor_i].m_params.epsilon = MotorsControl[Pid_Id].epsilon; + MotorControlConfig[Motor_i].m_params.dt = MotorsControl[Pid_Id].controloutputtype; + MotorControlConfig[Motor_i].m_ingnoreValue = MotorsControl[Pid_Id].sensorcorrectionadjustment; // the minimal change required to change the motor speed in pulses + MotorControlConfig[Motor_i].m_calculatedError = 0; + MotorControlConfig[Motor_i].m_integral = 0; + MotorControlConfig[Motor_i].m_isEnabled = true; + MotorControlConfig[Motor_i].m_isReady = true; + MotorControlConfig[Motor_i].m_mesuredParam = 0; + 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]) + { + MotorTimer[Motor_i] = MotorTiming[Motor_i]-1; + ReportWithPackageFilter(ThreadFilter,"MotorTiming",__FILE__,Motor_i,MotorTiming[Motor_i],RpWarning,MotorTimer[Motor_i],0); + } ////////////////////////////////////////////////// - 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] = 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; - } - MotorSamplePointer[Motor_i] = 0; + 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] = 0; + if (Motor_i == FEEDER_MOTOR) + MotorSamples[Motor_i][i] = -500; + // else if ((Motor_i == POOLER_MOTOR)||(Motor_i == FEEDER_MOTOR)) + // MotorSamples[Motor_i][i] = DancersCfg[ThreadMotorIdToDancerId[Motor_i]].zeropoint; + //MotorSpeedSamples[Motor_i][i] = 0; + } + MotorSamplePointer[Motor_i] = 0; ///////////////////////////////////////////////////// - MotorSetDirection((TimerMotors_t)HW_Motor_Id,MotorsCfg[HW_Motor_Id].directionthreadwize); + MotorSetDirection((TimerMotors_t)HW_Motor_Id,MotorsCfg[HW_Motor_Id].directionthreadwize); - if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled + if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled + { + ReportWithPackageFilter(ThreadFilter,"Feeder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); + if (SpeedControlId != 0xFF) { - ReportWithPackageFilter(ThreadFilter,"Feeder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); - if (SpeedControlId != 0xFF) - { - RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction); - SpeedControlId = 0xFF; - } - //SetMotHome(ThreadMotorIdToMotorId[Motor_i]); - LengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); - SpeedControlId = AddControlCallback(NULL,ThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i); + RemoveControlCallback(SpeedControlId,ThreadLengthCBFunction); + SpeedControlId = 0xFF; } - if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled + //SetMotHome(ThreadMotorIdToMotorId[Motor_i]); + LengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); + SpeedControlId = AddControlCallback(NULL,ThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i); + } + if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled + { + ReportWithPackageFilter(ThreadFilter,"Puller Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); + if (PoolerSpeedControlId != 0xFF) { - ReportWithPackageFilter(ThreadFilter,"Puller Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0); - if (PoolerSpeedControlId != 0xFF) - { - if (RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK) - ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)Motor_i,RpError,(int)PoolerSpeedControlId,0); - PoolerSpeedControlId = 0xFF; - } - //SetMotHome(ThreadMotorIdToMotorId[Motor_i]); - PoolerLengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); - PoolerSpeedControlId = AddControlCallback(NULL,PoolerThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i); + if (RemoveControlCallback(PoolerSpeedControlId,PoolerThreadLengthCBFunction)!=OK) + ReportWithPackageFilter(ThreadFilter,"Remove Control Failed.",__FILE__,__LINE__,(int)Motor_i,RpError,(int)PoolerSpeedControlId,0); + PoolerSpeedControlId = 0xFF; } + //SetMotHome(ThreadMotorIdToMotorId[Motor_i]); + PoolerLengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); + PoolerSpeedControlId = AddControlCallback(NULL,PoolerThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i); + } if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled { if (ControlIdtoMotorId[Motor_i] != 0xFF) @@ -1152,10 +1173,6 @@ uint32_t ThreadPrepareState(void *JobDetails) ControlIdtoMotorId[Motor_i] = AddControlCallback(NULL,ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i); #endif } -// if (HW_Motor_Id == HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled -// AddControlCallback(ThreadSpeedControlCBFunction, eOneMillisecond,TemplateDataReadCBFunction,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],0); - 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; } #ifdef TEST_PID_THREAD @@ -1382,7 +1399,7 @@ char Endstr[150]; int Motor_i; ThreadControlActive = false; uint32_t status = OK; - usnprintf(Endstr, 100, "Total _processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); + usnprintf(Endstr, 100, "Total _processed length: Feeder: %d Puller %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); SendJobProgress(0.0,0,false, Endstr); ReportWithPackageFilter(ThreadFilter,Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h index 4518f0ded..0da3530a9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h @@ -1,6 +1,6 @@ #ifndef WASTE_H #define WASTE_H - +#if 0 #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" @@ -202,6 +202,6 @@ void midtanktest6_OFF(); bool RdInkCartridgeSensor(); bool WasteTankCBFunction(); - +#endif #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h index 7d6837018..308de0bd0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h @@ -37,6 +37,12 @@ bool cartCart_door();//Polled by polling function. Notify waste. Poll each 1 sec void Waste_Init(); void Waste_StateMachine(void); void Waste_StateMachine_OneSecond_Call(void); +bool SetWastePump( bool power); +bool WHS_IsContainerEmpty(); +bool WHS_IsContainerFull(); +bool WHS_WasteCartridgeLowerPresent(); +bool WHS_WasteCartridgeMiddlePresent(); +bool WHS_IsEmptying(); #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index dc76a3390..7d358cfc2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -432,6 +432,7 @@ void Waste_StateMachine(void) // set count down timeout_counter = 1; + AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_EMPTYING_TIMEOUT, false); // set emptying limit wasteLevelEmpty = wasteLevel - WASTE_CARTRIDGE_SIZE; diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.h deleted file mode 100644 index e69de29bb..000000000 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.h +++ /dev/null diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_print.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_print.c deleted file mode 100644 index e69de29bb..000000000 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_print.c +++ /dev/null diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index 8857b69eb..66a039a7d 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -2,10 +2,28 @@ 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) +Head cleaning - move actuators fix RML PID support -head open prevent job - (with stub - 0xAD6) -add stub to overrule cone missing - 0xAD8 +head open prevent job +add stub to overrule cone missing + +fixed I2C delays - will help in real time and disconnection +new blower bug - prevent turning blower off +new blower- minimal voltage 2400 (moti) + +motor alarms - new approach (warning, rises immediately). +new WASTE handling +new IFS handling +IDS - cleaning. FIXED ink calculation info +thread - fix initial feeder dancer drop on job start + +stubs: +skip open lids test (amount = 0xAD6) +skip actuators cleaning sequence (amount = 0xAD7) +skip spool presence check (amount = 0xAD8) +watchdog activity check (amount = 0xAD9) + + Embedded SW Release note - Version 1.4.6.34 - Pack 2+ ============================================================= diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index 169772480..dfd9ffaa5 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -34,6 +34,7 @@ #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "drivers/Heater/TemperatureSensor.h" #include "drivers/Valves/Valve.h" +#include <Drivers/I2C_Communication/I2C.h> #include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h> #include "StateMachines/Printing/PrintingSTM.h" @@ -484,6 +485,7 @@ uint32_t PowerOffTurnOffCooler(void) uint32_t PowerOffTurnOffBlower(void) { WHS_Set_SetPoint_Q_value(0); + Control_Voltage_To_Blower(500); Turn_the_Blower_Off();//Turn off PowerOffMachineState++; return OK; @@ -492,6 +494,8 @@ uint32_t PowerOffTurnOffBlower(void) uint32_t PowerOffPowerOff(void) { int i; + Task_setPri (I2C_Task_Handle,-1); + for (i = 0;i<10;i++) { REPORT_MSG (10-i, "Power off in x seconds"); diff --git a/Software/Embedded_SW/Embedded/src/makefile.libs b/Software/Embedded_SW/Embedded/src/makefile.libs index f262762ef..ae6999352 100644 --- a/Software/Embedded_SW/Embedded/src/makefile.libs +++ b/Software/Embedded_SW/Embedded/src/makefile.libs @@ -1,6 +1,6 @@ # # This file was generated based on the configuration script: -# C:\Tango\Software\Embedded_SW\Embedded\Embedded.cfg +# C:\tango\Software\Embedded_SW\Embedded\Embedded.cfg # # This makefile may be included in other makefiles that need to build # the libraries containing the compiled source files generated as @@ -14,7 +14,7 @@ # # The absolute path to the generated source directory (at the time the # sources were generated) is: -# C:\Tango\Software\Embedded_SW\Embedded\src +# C:\tango\Software\Embedded_SW\Embedded\src # GEN_SRC_DIR ?= ../src diff --git a/Software/Embedded_SW/Embedded/src/sysbios/makefile b/Software/Embedded_SW/Embedded/src/sysbios/makefile index 0f63ec463..a8280a913 100644 --- a/Software/Embedded_SW/Embedded/src/sysbios/makefile +++ b/Software/Embedded_SW/Embedded/src/sysbios/makefile @@ -1,29 +1,29 @@ -XOPTS = -I"C:/TI/xdctools_3_32_00_06_core/packages/" -Dxdc_target_types__=C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/std.h -Dxdc_target_name__=M4F +XOPTS = -I"C:/ti/xdctools_3_32_00_06_core/packages/" -Dxdc_target_types__=C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/std.h -Dxdc_target_name__=M4F -vpath % C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ -vpath %.c C:/TI/xdctools_3_32_00_06_core/packages/ +vpath % C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ +vpath %.c C:/ti/xdctools_3_32_00_06_core/packages/ CCOPTS = --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -q -ms --program_level_compile -g -Dxdc_FILE=__FILE__ -Dti_sysbios_knl_Task_minimizeLatency__D=FALSE -Dti_sysbios_knl_Clock_stopCheckNext__D=FALSE -Dti_sysbios_family_arm_m3_Hwi_enableException__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_disablePriority__D=32U -Dti_sysbios_family_arm_m3_Hwi_numSparseInterrupts__D=0U -Dti_sysbios_hal_Core_numCores__D=1 -XDC_ROOT = C:/TI/xdctools_3_32_00_06_core/packages/ +XDC_ROOT = C:/ti/xdctools_3_32_00_06_core/packages/ -BIOS_ROOT = C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ +BIOS_ROOT = C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ BIOS_DEFS = -Dti_sysbios_BIOS_swiEnabled__D=TRUE -Dti_sysbios_BIOS_taskEnabled__D=TRUE -Dti_sysbios_BIOS_clockEnabled__D=TRUE -Dti_sysbios_BIOS_runtimeCreatesEnabled__D=TRUE -Dti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS -Dti_sysbios_knl_Swi_DISABLE_ALL_HOOKS -Dti_sysbios_BIOS_smpEnabled__D=FALSE -Dti_sysbios_Build_useHwiMacros -Dti_sysbios_knl_Swi_numPriorities__D=16 -Dti_sysbios_knl_Task_deleteTerminatedTasks__D=FALSE -Dti_sysbios_knl_Task_numPriorities__D=16 -Dti_sysbios_knl_Task_checkStackFlag__D=TRUE -Dti_sysbios_knl_Task_initStackFlag__D=TRUE -Dti_sysbios_knl_Task_DISABLE_ALL_HOOKS -Dti_sysbios_knl_Clock_TICK_SOURCE=ti_sysbios_knl_Clock_TickSource_TIMER -Dti_sysbios_knl_Clock_TICK_MODE=ti_sysbios_knl_Clock_TickMode_PERIODIC -Dti_sysbios_hal_Core_delegate_getId=ti_sysbios_hal_CoreNull_getId__E -Dti_sysbios_hal_Core_delegate_interruptCore=ti_sysbios_hal_CoreNull_interruptCore__E -Dti_sysbios_hal_Core_delegate_lock=ti_sysbios_hal_CoreNull_lock__E -Dti_sysbios_hal_Core_delegate_unlock=ti_sysbios_hal_CoreNull_unlock__E -Dti_sysbios_hal_Core_numCores__D=1 -Dti_sysbios_hal_CoreNull_numCores__D=1 -Dti_sysbios_utils_Load_taskEnabled__D=TRUE -Dti_sysbios_utils_Load_swiEnabled__D=FALSE -Dti_sysbios_utils_Load_hwiEnabled__D=FALSE -Dti_sysbios_family_arm_m3_Hwi_dispatcherSwiSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherTaskSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherAutoNestingSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherIrpTrackingSupport__D=TRUE -Dti_sysbios_knl_Semaphore_supportsEvents__D=FALSE -Dti_sysbios_knl_Semaphore_supportsPriority__D=TRUE -BIOS_INC = -I"C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" +BIOS_INC = -I"C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" -TARGET_INC = -I"C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" +TARGET_INC = -I"C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" INCS = $(BIOS_INC) $(TARGET_INC) -CC = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl -c $(CCOPTS) -I C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include -ASM = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl -c $(CCOPTS) -I C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include -AR = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armar rq +CC = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.2.LTS/bin/armcl -c $(CCOPTS) -I C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.2.LTS/include +ASM = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.2.LTS/bin/armcl -c $(CCOPTS) -I C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.2.LTS/include +AR = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.2.LTS/bin/armar rq -DEL = C:/TI/xdctools_3_32_00_06_core/packages/../bin/rm -f -CP = C:/TI/xdctools_3_32_00_06_core/packages/../bin/cp -f +DEL = C:/ti/xdctools_3_32_00_06_core/packages/../bin/rm -f +CP = C:/ti/xdctools_3_32_00_06_core/packages/../bin/cp -f define RM $(if $(wildcard $1),$(DEL) $1,:) diff --git a/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f b/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f Binary files differindex 93c4f5655..50096cc7a 100644 --- a/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f +++ b/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f diff --git a/Software/Graphics/FSE/Installer/machine_full.ico b/Software/Graphics/FSE/Installer/machine_full.ico Binary files differnew file mode 100644 index 000000000..95d632d16 --- /dev/null +++ b/Software/Graphics/FSE/Installer/machine_full.ico diff --git a/Software/Graphics/FSE/Installer/machine_full_0UZ_icon.ico b/Software/Graphics/FSE/Installer/machine_full_0UZ_icon.ico Binary files differnew file mode 100644 index 000000000..6454f962c --- /dev/null +++ b/Software/Graphics/FSE/Installer/machine_full_0UZ_icon.ico diff --git a/Software/Graphics/FSE/Installer/twine_logo_installer_.png b/Software/Graphics/FSE/Installer/twine_logo_installer_.png Binary files differnew file mode 100644 index 000000000..a45fc1257 --- /dev/null +++ b/Software/Graphics/FSE/Installer/twine_logo_installer_.png diff --git a/Software/Stubs Collection/stubs/cleaning sequence disable.cs b/Software/Stubs Collection/stubs/cleaning sequence disable.cs new file mode 100644 index 000000000..49bf4d968 --- /dev/null +++ b/Software/Stubs Collection/stubs/cleaning sequence disable.cs @@ -0,0 +1,24 @@ +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) +{ + +//"Set WFCF Value +ProgressRequest progressRequest = new ProgressRequest(); +progressRequest.Amount = 0xAD7; +progressRequest.Delay = 0; + +var response = stubManager.Run<ProgressResponse>(progressRequest); + + +}
\ 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 new file mode 100644 index 000000000..eaf15b1f6 --- /dev/null +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs @@ -0,0 +1,195 @@ +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; +using Google.Protobuf; +using Tango.PMR.EmbeddedParameters; +using System.IO; +using Tango.PMR.IO; + + +public void OnExecute(StubManager stubManager) +{ + + +ConfigurationParameters configurationParameters = new ConfigurationParameters(); + +configurationParameters.BreakSensorLimit = 10; + +//how many samples to collect in diagnostics before sending +configurationParameters.DiagnosticCollectionLimit = 3; + +//how many consecutive readout before declaring DC over/underheat alarm +configurationParameters.OverHeatCountLimit = 3; +configurationParameters.UnderHeatCountLimit = 3; + +// time of motor activity before opening the valve or after closing the valve, in milliseconds +configurationParameters.CloseValveTimeout = 20; +configurationParameters.OpenValveTimeout = 20; + +//backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters) +configurationParameters.InitialDispenserPressure = 0.25; +configurationParameters.InitialDispenserTimeout = 60000; //20 seconds +configurationParameters.InitialDispenserTimeLag = 100; + +//job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed +configurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000 +configurationParameters.DispenserBuildPressureLimit = 0.85; +configurationParameters.DispenserBuildPressureTimeout = 180000; +configurationParameters.DispenserBuildPressureLag = 100; + +//temperature band 1000 = 100% - thresholds for job start around target temprature - AC +configurationParameters.ACHeatersLowerOperationLimit = 995; +configurationParameters.ACHeatersUpperOperationLimit = 1005; + +//temperature band 1000 = 100% - thresholds for job start around target temprature - DC +configurationParameters.DCHeatersLowerOperationLimit = 978; +configurationParameters.DCHeatersUpperOperationLimit = 1005; + +// mid tank reading offset to add to the readout (OBSOLETE!) +configurationParameters.MidTankPressureCorrection = 0.0; + +//waste factor for intersegment pressure building +configurationParameters.DispenserPresegmentWFCF = 40; +//how much time to start the WFCF process (pressure buildup) before segment start +configurationParameters.IDSPreSegmentWFCFTimeBeforeSegment = 12000; + +//flag: start heaters according to saved process parameters upon init? +configurationParameters.StartHeatingOnInitSequence = true; + +// current test for the heaters - alarm thresholds +configurationParameters.CurrentAlarmLowLimit = 0.78; +configurationParameters.CurrentAlarmHighLimit = 1.07; + +//currently not in use +configurationParameters.IDSSegmentRefillTimeout = 5000; +configurationParameters.IDSPreSegmentBuildupTime = 5000; +//cleaning!!!!!!!!!! +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 +// Tup = LeftRockerSpeed/100; +// Tdelay1 = LeftRockerSpeed%100; +// Tdelay2 = RightRockerSpeed; +int LeftRockerSpeed = Tup*100+Tdelay1; +int RightRockerSpeed = Tdelay2; + +configurationParameters.IDSLeftCleaningMotorSpeed = LeftRockerSpeed; +configurationParameters.IDSRightCleaningMotorSpeed = RightRockerSpeed; + +configurationParameters.SwitchToIdleTimeinSeconds = 3600; +configurationParameters.IdleDrierTemperature = 80; +configurationParameters.IdleHeadTemperature = 80; +configurationParameters.IdleMixerTemperature = 0; +configurationParameters.PowerOffTemperatureLimit = 60; + +//general parameters, ORDER MUST BE PRESERVED!!!! +//check the dispensers hard limit alarms +/*1*/ +Double checkHardLimitAlarms = new Double(); + +checkHardLimitAlarms = 1.0; +configurationParameters.GeneralParameters.Add(checkHardLimitAlarms); + +/*2*/ +Double checkCurrentAlarms = new Double(); +checkCurrentAlarms = 0.0; +configurationParameters.GeneralParameters.Add(checkCurrentAlarms); +//check the tamper alarms + +/*3*/ +Double checkTamperAlarms = new Double(); +checkTamperAlarms = 1.0; +configurationParameters.GeneralParameters.Add(checkTamperAlarms); + +/*4*/ +Double checkMotorAlarms = new Double(); +checkMotorAlarms = 1.0; +configurationParameters.GeneralParameters.Add(checkMotorAlarms); + +/*5*/ +Double WinderBackToBaseTime = new Double(); +WinderBackToBaseTime = 820.0; +configurationParameters.GeneralParameters.Add(WinderBackToBaseTime); + +/*6*/ +Double DispenserInitialPressureSpeed = new Double(); +DispenserInitialPressureSpeed = 1050.0; +configurationParameters.GeneralParameters.Add(DispenserInitialPressureSpeed); + +/*7*/ +Double SetDiagnosticMode = new Double(); +SetDiagnosticMode = 3.0; +configurationParameters.GeneralParameters.Add(SetDiagnosticMode); + +/*8*/ +Double SetAutoFill = new Double(); +SetAutoFill = 3.0; +configurationParameters.GeneralParameters.Add(SetAutoFill); + +File.WriteAllBytes("C:/temp/EmbParam.cfg",configurationParameters.ToBytes()); + +byte[] fileBytes = File.ReadAllBytes("C:/temp/EmbParam.cfg"); + + +var config = ConfigurationParameters.Parser.ParseFrom(fileBytes); + +stubManager.Write( config); +Thread.Sleep(1000); + + +stubManager.Write("\n\n Deleting old file"); + +DeleteRequest deleteRequest = new DeleteRequest(); +deleteRequest.Path = "SYSINFO//EmbParam.cfg"; +deleteRequest.Attribute = Tango.PMR.IO.FileAttribute.Unspecified; +DeleteResponse response5 = stubManager.Run<DeleteResponse>(deleteRequest); + + +Thread.Sleep(1000); +stubManager.Write("\n\n Loading new file file"); + +FileUploadRequest fileUploadRequest = new FileUploadRequest(); +fileUploadRequest.Path = "SYSINFO//EmbParam.cfg"; +fileUploadRequest.Length = (int)fileBytes.Length; +FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest); +Thread.Sleep(1000); +long chunk_size = response2.MaxChunkLength; + +FileStream fs = new FileStream("C:/temp/EmbParam.cfg",FileMode.Open); + +while (fs.Position < fs.Length) +{ + stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n"); + FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest(); + fileChunkUploadRequest.UploadID = response2.UploadID; + byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)]; + fs.Read(chunk,0,chunk.Length); + fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk); + var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest); + Thread.Sleep(2000); + +} + +// activating the new file +ProgressRequest progressRequest = new ProgressRequest(); +progressRequest.Amount = 0xCD; +progressRequest.Delay = 0xCD; +var response1 = stubManager.Run<ProgressResponse>(progressRequest); + + +/* +13:46:42.38: Executing script 'embeddedparametersbuild.cs'... +{ "BreakSensorLimit": 10, "DiagnosticCollectionLimit": 1, "OverHeatCountLimit": 3, "UnderHeatCountLimit": 3, "CloseValveTimeout": 255, "OpenValveTimeout": 255, "InitialDispenserPressure": 1.5, "InitialDispenserTimeout": 60000, "InitialDispenserTimeLag": 100, "DispenserBuildPressureSpeed": 800, "DispenserBuildPressureLimit": 0.9, "DispenserBuildPressureTimeout": 80000, "DispenserBuildPressureLag": 50, "ACHeatersLowerOperationLimit": 995, "ACHeatersUpperOperationLimit": 1005, "DCHeatersLowerOperationLimit": 978, "DCHeatersUpperOperationLimit": 1005, "DispenserPresegmentWFCF": 80, "StartHeatingOnInitSequence": true, "GeneralParameters": [ 1, 1, 1, 1, 800, 1000 ], "CurrentAlarmLowLimit": 0.8, "CurrentAlarmHighLimit": 1.07, "IDSSegmentRefillTimeout": 5000, "IDSPreSegmentBuildupTime": 5000, "IDSCleaningSpeed": 50, "IDSCleaningStopBeforeSegmentTime": 3000, "IDSCleaningStartSprayPreSegmentTime": 1000, "IDSLeftCleaningMotorSpeed": 30, "IDSRightCleaningMotorSpeed": 23, "SwitchToIdleTimeinSeconds": 3600, "IdleDrierTemperature": 80, "IdleHeadTemperature": 80, "PowerOffTemperatureLimit": 50, "IDSPreSegmentWFCFTimeBeforeSegment": 1500 } */ + + +}
\ No newline at end of file diff --git a/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip index 9dfaa3803..d8c669460 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip @@ -17,12 +17,12 @@ <ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/> <ROW Property="ARPHELPLINK" Value="https://twine-s.com/"/> <ROW Property="ARPNOREPAIR" MultiBuildValue="DefaultBuild:1"/> - <ROW Property="ARPPRODUCTICON" Value="Tango.FSE.UI.exe" Type="8"/> + <ROW Property="ARPPRODUCTICON" Value="machine_full.exe" Type="8"/> <ROW Property="ARPURLINFOABOUT" Value="https://twine-s.com/"/> <ROW Property="ARPURLUPDATEINFO" Value="https://twine-s.com/"/> <ROW Property="CTRLS" Value="2"/> - <ROW Property="CompanyLogo" Value="blue.jpg" MultiBuildValue="DefaultBuild:twine_logo_installer_.png" Type="1" MsiKey="CompanyLogo"/> - <ROW Property="LogoIcon" Value="externalui.ico" MultiBuildValue="DefaultBuild:machine_full_0UZ_icon.ico" Type="1" MsiKey="LogoIcon"/> + <ROW Property="CompanyLogo" Value="blue.jpg" MultiBuildValue="DefaultBuild:twine_logo_installer_.png_1" Type="1" MsiKey="CompanyLogo"/> + <ROW Property="LogoIcon" Value="externalui.ico" MultiBuildValue="DefaultBuild:machine_full_0UZ_icon.ico_1" Type="1" MsiKey="LogoIcon"/> <ROW Property="Manufacturer" Value="Twine Solutions LTD"/> <ROW Property="ProductCode" Value="1033:{4CBDABE7-727D-4858-AAC9-8E1D8D9B231D} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> @@ -717,8 +717,8 @@ <ROW Name="SoftwareDetector.dll" SourcePath="<AI_CUSTACTS>SoftwareDetector.dll"/> <ROW Name="aicustact.dll" SourcePath="<AI_CUSTACTS>aicustact.dll"/> <ROW Name="lzmaextractor.dll" SourcePath="<AI_CUSTACTS>lzmaextractor.dll"/> - <ROW Name="machine_full_0UZ_icon.ico" SourcePath="..\..\..\..\..\..\Users\Roy\Downloads\machine_full_0UZ_icon.ico"/> - <ROW Name="twine_logo_installer_.png" SourcePath="..\..\..\..\..\..\Users\Roy\Downloads\twine_logo_installer_.png"/> + <ROW Name="machine_full_0UZ_icon.ico_1" SourcePath="..\..\Graphics\FSE\Installer\machine_full_0UZ_icon.ico"/> + <ROW Name="twine_logo_installer_.png_1" SourcePath="..\..\Graphics\FSE\Installer\twine_logo_installer_.png"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent"> <ROW Dialog_="WelcomePrereqDlg" Control_="Next" Event="NewDialog" Argument="PrerequisitesDlg" Condition="AI_BOOTSTRAPPER" Ordering="1"/> @@ -1065,7 +1065,7 @@ <ROW Feature_="TangoFSE" Component_="Tango.Visuals.dll"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent"> - <ROW Name="Tango.FSE.UI.exe" SourcePath="..\..\..\..\..\..\Users\Roy\Downloads\machine_full.ico" Index="0"/> + <ROW Name="machine_full.exe" SourcePath="..\..\Graphics\FSE\Installer\machine_full.ico" Index="0"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent"> <ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="210"/> @@ -1134,7 +1134,7 @@ <ROW FileKey="_" Component_="System.Runtime.InteropServices.RuntimeInformation.dll" DirProperty="APPDIR" InstallMode="3"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiShortsComponent"> - <ROW Shortcut="TangoFSE" Directory_="DesktopFolder" Name="TANGOF~1|Tango FSE" Component_="Tango.FSE.UI.exe" Target="[#Tango.FSE.UI.exe]" Description="Twine Solutions - Tango FSE" Hotkey="0" Icon_="Tango.FSE.UI.exe" IconIndex="0" ShowCmd="1" WkDir="APPDIR" Advertised="true"/> + <ROW Shortcut="TangoFSE" Directory_="DesktopFolder" Name="TANGOF~1|Tango FSE" Component_="Tango.FSE.UI.exe" Target="[#Tango.FSE.UI.exe]" Description="Twine Solutions - Tango FSE" Hotkey="0" Icon_="machine_full.exe" IconIndex="0" ShowCmd="1" WkDir="APPDIR" Advertised="true"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiThemeComponent"> <ATTRIBUTE name="UsedTheme" value="modern"/> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Logging/ILoggingProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Logging/ILoggingProvider.cs index d000f75a0..42978fe70 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Logging/ILoggingProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Logging/ILoggingProvider.cs @@ -42,9 +42,9 @@ namespace Tango.FSE.Common.Logging /// Downloads the specified remote log file. /// </summary> /// <param name="logFile">The log file.</param> - /// <param name="targetFolder">Target folder.</param> + /// <param name="targetFile">Target file.</param> /// <returns></returns> - Task<FileSystemHandler> DownloadLogFile(RemoteLogFile logFile, String targetFolder); + Task<FileSystemHandler> DownloadLogFile(RemoteLogFile logFile, String targetFile); /// <summary> /// Occurs when a new FSE application log is available. diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs index e378835c1..e66a7e27e 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media.Imaging; +using Tango.RemoteDesktop.Frames; using Tango.RemoteDesktop.Network; namespace Tango.FSE.Common.RemoteDesktop @@ -176,5 +177,11 @@ namespace Tango.FSE.Common.RemoteDesktop /// </summary> /// <param name="visible">if set to <c>true</c> [visible].</param> void SetRemoteCursorVisibility(bool visible); + + /// <summary> + /// Gets a single remote desktop screen-shot. + /// </summary> + /// <returns></returns> + Task<RasterFrame> GetDesktopScreenShot(); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs index c156122f9..661f10c3c 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Management; @@ -19,11 +20,17 @@ using Tango.FSE.Common.BugReporting; using Tango.FSE.Common.Connection; using Tango.FSE.Common.Connectivity; using Tango.FSE.Common.FSEApplication; +using Tango.FSE.Common.Logging; using Tango.FSE.Common.Notifications; +using Tango.FSE.Common.RemoteDesktop; using Tango.FSE.UI.Dialogs; using Tango.FSE.Web.Messages; +using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; using Tango.Logging; +using Tango.RemoteDesktop; +using Tango.RemoteDesktop.CaptureMethods; +using Tango.RemoteDesktop.Encoders; using Tango.TFS; namespace Tango.FSE.UI.BugReporting @@ -35,6 +42,7 @@ namespace Tango.FSE.UI.BugReporting private Project Project; private TeamFoundationServiceClient _tfsClient; private BugReportingInfoResponse _bugReportingInfoResponse; + private Bitmap _desktopBitmap; private IFSEApplicationManager ApplicationManager { get; set; } @@ -53,6 +61,13 @@ namespace Tango.FSE.UI.BugReporting [TangoInject(TangoInjectMode.WhenAvailable)] private FSEServicesContainer Services { get; set; } + [TangoInject(TangoInjectMode.WhenAvailable)] + private ILoggingProvider LoggingProvider { get; set; } + + [TangoInject(TangoInjectMode.WhenAvailable)] + private IRemoteDesktopProvider RemoteDesktopProvider { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="DefaultBugReporter"/> class. /// </summary> @@ -96,7 +111,12 @@ namespace Tango.FSE.UI.BugReporting } else { - item.Area = Project.GetAreaByName("FSE"); + item.Area = Project.GetAreaByName("FSE Public"); + + if (item.Area == null) + { + throw new NullReferenceException("Area 'FSE Public' not found."); + } } item.Iteration = Project.Iterations.FirstOrDefault(); @@ -175,6 +195,92 @@ namespace Tango.FSE.UI.BugReporting } } + if (MachineProvider.IsConnected && MachineProvider.IsPPCAvailable) + { + var tempLogsFolder = TemporaryManager.CreateFolder(); + + try + { + var ppcLogFiles = LoggingProvider.GetApplicationLogFiles().Result; + var ppcLogFile = ppcLogFiles.OrderBy(x => x.DateCreated).LastOrDefault(); + + if (ppcLogFile != null) + { + var ppcLogFilePath = Path.Combine(tempLogsFolder, ppcLogFile.Name); + var handler = LoggingProvider.DownloadLogFile(ppcLogFile, ppcLogFilePath).Result; + handler.WaitForCompletion().GetAwaiter().GetResult(); + + item.Attachments.Add(new Attachment() + { + Description = "PPC Log File", + FilePath = ppcLogFilePath, + Name = ppcLogFile.Name + }); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error attaching remote PPC log file."); + } + + try + { + var embeddedLogFiles = LoggingProvider.GetFirmwareLogFiles().Result; + var embeddedLogFile = embeddedLogFiles.OrderBy(x => x.DateCreated).LastOrDefault(); + + if (embeddedLogFile != null) + { + var embeddedLogFilePath = Path.Combine(tempLogsFolder, embeddedLogFile.Name); + var handler = LoggingProvider.DownloadLogFile(embeddedLogFile, embeddedLogFilePath).Result; + handler.WaitForCompletion().GetAwaiter().GetResult(); + + item.Attachments.Add(new Attachment() + { + Description = "Embedded Log File", + FilePath = embeddedLogFilePath, + Name = embeddedLogFile.Name + }); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error attaching remote embedded log file."); + } + + try + { + var frame = RemoteDesktopProvider.GetDesktopScreenShot().Result; + var ppcDesktopFile = TemporaryManager.CreateImaginaryFile(".jpg"); + File.WriteAllBytes(ppcDesktopFile, frame.ToEncoder<JpegEncoder>().ToArray()); + frame.Dispose(); + item.Attachments.Add(new Attachment() + { + Description = "PPC Screen Capture", + FilePath = ppcDesktopFile, + Name = "PPC Screen Capture.jpg" + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error retrieving remote PPC screenshot for bug report."); + } + } + + if (_desktopBitmap != null) + { + var tmpBitmap = TemporaryManager.CreateImaginaryFile(".jpg"); + _desktopBitmap.SaveJpeg(tmpBitmap, 80); + + item.Attachments.Add(new Attachment() + { + Description = "FSE Screen Capture", + FilePath = tmpBitmap, + Name = "FSE Screen Capture.jpg" + }); + + _desktopBitmap = null; + } + foreach (var attachment in bug.Attachments.ToList()) { if (File.Exists(attachment.File)) @@ -199,7 +305,8 @@ namespace Tango.FSE.UI.BugReporting } SystemInformationModel sysModel = new SystemInformationModel(); - sysModel.ApplicationVersion = ApplicationManager.Version.ToString(); + sysModel.FSEVersion = ApplicationManager.Version.ToString(); + sysModel.PPCVersion = "N/A"; sysModel.EmbeddedVersion = "N/A"; sysModel.HostName = Environment.MachineName; sysModel.UserName = AuthenticationProvider.CurrentUser.Contact.FullName; @@ -218,6 +325,12 @@ namespace Tango.FSE.UI.BugReporting LogManager.Log("Machine is connected. Getting device information and configurations..."); sysModel.Machine = MachineProvider.Machine; sysModel.EmbeddedVersion = op.DeviceInformation.Version; + + var m = op as ExternalBridgeTcpClient; + if (m != null) + { + sysModel.PPCVersion = m.ApplicationInformation.Version; + } } else { @@ -260,6 +373,17 @@ namespace Tango.FSE.UI.BugReporting try { + _desktopBitmap?.Dispose(); + GdiScreenCapture capture = new GdiScreenCapture(); + _desktopBitmap = capture.GetDesktopBitmap(CaptureRegion.PrimaryScreenBounds()); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error capturing the user desktop bitmap for bug report."); + } + + try + { if (AuthenticationProvider.CurrentUser.HasPermission(Permissions.FSE_ModifyBugReport)) { await Task.Factory.StartNew(() => @@ -295,7 +419,7 @@ namespace Tango.FSE.UI.BugReporting vm = await NotificationProvider.ShowDialog(new BugReportFullViewVM(bug) { - Areas = Project.Areas.ToList(), + Areas = GetAreasWithoutFSEPublic(Project.Areas.ToList()), TeamMembers = Project.Members.ToList(), Area = area, AssignedTo = assignedTo @@ -432,5 +556,31 @@ namespace Tango.FSE.UI.BugReporting return Environment.OSVersion.ToString(); } } + + private List<Area> GetAreasWithoutFSEPublic(List<Area> areas) + { + List<Area> partial = new List<Area>(); + CloneAreasWithoutFSEPublic(areas.ToList(), partial); + return partial; + } + + private void CloneAreasWithoutFSEPublic(List<Area> all, List<Area> partial) + { + foreach (var area in all) + { + if (area.Name != "FSE Public") + { + var cloned = new Area() + { + Name = area.Name, + Path = area.Path + }; + + partial.Add(cloned); + + CloneAreasWithoutFSEPublic(area.SubAreas, cloned.SubAreas); + } + } + } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs index fd1b4fdd8..f6fbb7dd3 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs @@ -9,7 +9,8 @@ namespace Tango.FSE.UI.BugReporting { public class SystemInformationModel { - public String ApplicationVersion { get; set; } + public String FSEVersion { get; set; } + public String PPCVersion { get; set; } public String EmbeddedVersion { get; set; } public String UserName { get; set; } public String UserEmail { get; set; } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml index d63aa4f95..2aa96f6fc 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml @@ -18,8 +18,13 @@ <tbody> <tr> - <td><b>Application Version:</b></td> - <td>@vm.ApplicationVersion</td> + <td><b>FSE Version:</b></td> + <td>@vm.FSEVersion</td> + </tr> + + <tr> + <td><b>PPC Version:</b></td> + <td>@vm.PPCVersion</td> </tr> <tr> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Logging/DefaultLoggingProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Logging/DefaultLoggingProvider.cs index 6a6ae9e3e..29880988a 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Logging/DefaultLoggingProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Logging/DefaultLoggingProvider.cs @@ -110,9 +110,9 @@ namespace Tango.FSE.UI.Logging /// Downloads the specified remote log file. /// </summary> /// <param name="logFile">The log file.</param> - /// <param name="targetFolder">Target local folder.</param> + /// <param name="targetFile">Target local file.</param> /// <returns></returns> - public async Task<FileSystemHandler> DownloadLogFile(RemoteLogFile logFile, String targetFolder) + public async Task<FileSystemHandler> DownloadLogFile(RemoteLogFile logFile, String targetFile) { var tempFolder = TemporaryManager.CreateFolder(); var handler = await _fileSystemProvider.Download(new FileItem() { Path = logFile.Path }, tempFolder); @@ -120,7 +120,7 @@ namespace Tango.FSE.UI.Logging { if (status == FileSystemHandlerStatus.Completed) { - File.Move(Path.Combine(tempFolder, logFile.Name), targetFolder); + File.Move(Path.Combine(tempFolder, logFile.Name), targetFile); } }; return handler; diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs index 0a5277eff..cced594ea 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs @@ -109,6 +109,13 @@ namespace Tango.FSE.UI.Panes _scanner = new ExternalBridgeScanner(); _scanner.MachineDiscovered += _scanner_MachineDiscovered; _scanner.MachineLost += _scanner_MachineLost; + + ApplicationManager.ApplicationReady += ApplicationManager_ApplicationReady; + } + + private void ApplicationManager_ApplicationReady(object sender, EventArgs e) + { + _allowedMachines = null; } /// <summary> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs index 73976a95f..e2de27611 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs @@ -1103,5 +1103,28 @@ namespace Tango.FSE.UI.RemoteDesktop } #endregion + + #region Screenshot + + /// <summary> + /// Gets a single remote desktop screen-shot. + /// </summary> + /// <returns></returns> + public async Task<RasterFrame> GetDesktopScreenShot() + { + var response = await _machineProvider.MachineOperator.SendGenericRequest<GetScreenshotRequest, GetScreenshotResponse>(new GetScreenshotRequest(), + new TransportRequestConfig() + { + Timeout = TimeSpan.FromSeconds(30) + }); + + MemoryStream ms = new MemoryStream(response.Bitmap); + ms.Position = 0; + System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(ms); + RasterFrame frame = new RasterFrame(bitmap); + return frame; + } + + #endregion } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs index 9db8551d9..00adb72b0 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs @@ -257,6 +257,26 @@ namespace Tango.FSE.UI.ViewModels this.SetFocus(nameof(ToggleConnectionPaneCommand)); } + public override async Task<bool> OnApplicationLogout() + { + if (MachineProvider.IsConnected) + { + if (await NotificationProvider.ShowWarningQuestion("The current machine connection will be automatically closed.\nAre you sure you want to log out?")) + { + await MachineProvider.DisconnectMachine(); + return true; + } + else + { + return false; + } + } + else + { + return true; + } + } + #endregion #region Private Methods diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs index f583fa15e..d9ba419e0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -314,11 +314,11 @@ namespace Tango.MachineStudio.RML.ViewModels try { var tables = RML.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); - return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + return tables.Max(x => x.MaxInkUptake); } catch { - return BrushStop.MAX_TOTAL_LIQUID_VOLUME; + return BrushStop.MAX_INK_UPTAKE; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 36398a593..d4bb07a9b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -468,7 +468,7 @@ namespace Tango.MachineStudio.RML.ViewModels rml.DisplayName = name; rml.QualificationDate = DateTime.UtcNow; rml.Manufacturer = "Twine"; - rml.Code = Rmls.Max(x => x.Code) + 1; + rml.Code = Rmls.Count > 0 ? Rmls.Max(x => x.Code) + 1 : 1; rml.MediaMaterial = Materials.FirstOrDefault(); rml.MediaPurpose = Purposes.FirstOrDefault(); rml.MediaCondition = Conditions.FirstOrDefault(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs index c51969a16..05eb9ef8d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs @@ -211,7 +211,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels JobRuns = new ObservableCollection<JobRunModel>(); LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), () => IsFree); ExportToExcelCommand = new RelayCommand(ExportToExcel, () => IsFree); - LengthUpperValue = 5000.0; + LengthUpperValue = 10000.0; LengthLowerValue = 0.0; DateTime now = DateTime.Now; StartSelectedDate = now.AddMonths(-1); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml index e6c46ba10..9e92aabc2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml @@ -267,7 +267,7 @@ <Border BorderThickness="1" CornerRadius="3" BorderBrush="{StaticResource borderBrush}" Margin="0 10 0 0" Height="24" Padding="10 0"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11" Width="30"></TextBlock> - <mahapps:RangeSlider Focusable="True" Height="40" Margin="5 5 5 5" Minimum="0" Maximum="5000" Width="140" ExtendedMode="True" + <mahapps:RangeSlider Focusable="True" Height="40" Margin="5 5 5 5" Minimum="0" Maximum="10000" Width="140" ExtendedMode="True" LowerValue="{Binding LengthLowerValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" UpperValue="{Binding LengthUpperValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" IsSnapToTickEnabled="True" FontSize="8"/> diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Azure/New Environment.txt b/Software/Visual_Studio/Notes/Tango.Notes/Azure/New Environment.txt index 710cdcb2d..212da09a2 100644 --- a/Software/Visual_Studio/Notes/Tango.Notes/Azure/New Environment.txt +++ b/Software/Visual_Studio/Notes/Tango.Notes/Azure/New Environment.txt @@ -41,8 +41,8 @@ EXEC sp_addrolemember N'db_datawriter', N'BackupUser' CREATE USER [Tango] FROM EXTERNAL PROVIDER WITH DEFAULT_SCHEMA=[dbo] GO -EXEC sp_addrolemember N'db_datareader', N'BackupUser' -EXEC sp_addrolemember N'db_datawriter', N'BackupUser' +EXEC sp_addrolemember N'db_datareader', N'Tango' +EXEC sp_addrolemember N'db_datawriter', N'Tango' 9. Create a new storage blob container for the machine studio versions. diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index 365075d4a..d6eb3bc63 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -26,6 +26,7 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _context; private bool _canStartJob; + private bool _startingJob; private bool _isPreparingJob; /// <summary> @@ -96,12 +97,17 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { + if (_startingJob) return; + + _startingJob = true; + try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo<JobsModule>(false, nameof(JobProgressView)); + _startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -112,6 +118,10 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}"); } + finally + { + _startingJob = false; + } } /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index efaf98966..665847081 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -56,6 +56,7 @@ namespace Tango.PPC.Jobs.ViewModels private ActionTimer _volumeConversionTimer; private IColorConverter _converter; private string _current_job_string; + private bool startingJob = false; #region Properties @@ -545,7 +546,7 @@ namespace Tango.PPC.Jobs.ViewModels } catch (Exception ex) { - LogManager.Log(ex, $"Error loading job '{_job_to_load.Name}'"); + LogManager.Log(ex, $"Error loading job '{(_job_to_load != null ? _job_to_load.Name : "null")}'"); await NotificationProvider.ShowError("An error occurred while trying to load the selected job."); _can_navigate_back = true; await NavigationManager.NavigateBack(); @@ -647,11 +648,16 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { + if (startingJob) return; + try { + Debug.WriteLine("Job Starting..."); + startingJob = true; LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); var handler = await PrintingManager.Print(Job, _db); await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); + startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -662,6 +668,10 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}."); } + finally + { + startingJob = false; + } } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs index 62bb99d2e..45ba29e2a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs @@ -387,6 +387,18 @@ namespace Tango.PPC.Common.RemoteDesktop await receiver.SendGenericResponse(new SetCursorVisibilityResponse(), token); } + [ExternalBridgeRequestHandlerMethod(typeof(GetScreenshotRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task OnGetScreenshotRequest(GetScreenshotRequest request, String token, ExternalBridgeReceiver receiver) + { + GdiScreenCapture capture = new GdiScreenCapture(); + var bitmap = capture.GetDesktopBitmap(CaptureRegion.PrimaryScreenBounds()); + RasterFrame frame = new RasterFrame(bitmap); + var data = frame.ToEncoder<JpegEncoder>().ToArray(80); + frame.Dispose(); + + await receiver.SendGenericResponse(new GetScreenshotResponse() { Bitmap = data }, token); + } + private async void _engine_FrameReceived(object sender, ScreenCaptureFrameReceivedEventArgs<RasterFrame> e) { if (_drawCursor) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index 3502648d4..7c71ef3d0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; @@ -501,6 +502,10 @@ namespace Tango.PPC.UI.Navigation private void NotifyOnBeforeNavigated(object fromVM, object toVM) { + IsBackEnabled = false; + + if (fromVM == toVM) return; + if (fromVM is PPCViewModel) { (fromVM as PPCViewModel)?.OnBeforeNavigatedFrom(); @@ -514,6 +519,10 @@ namespace Tango.PPC.UI.Navigation private void NotifyOnNavigated(object fromVM, object toVM) { + IsBackEnabled = true; + + if (fromVM == toVM) return; + if (fromVM is PPCViewModel) { (fromVM as PPCViewModel)?.OnNavigatedFrom(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index e84fd81a1..3b45a0c2b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -35,6 +35,7 @@ namespace Tango.PPC.UI.ViewModels private bool _isPowerUpDialogShown; private bool _isThreadLoadingShown; private PowerUpAppBarItem _powerUpAppBar; + private bool _started; private DateTime _currentDateTime; /// <summary> @@ -79,6 +80,7 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_PowerUpEnded(object sender, EventArgs e) { + _started = false; _powerUpAppBar?.Close(); _powerUpAppBar = null; } @@ -93,6 +95,8 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_PowerUpStarted(object sender, PMR.Power.StartPowerUpResponse e) { + _started = true; + InvokeUI(() => { if (_powerUpAppBar != null) @@ -100,8 +104,11 @@ namespace Tango.PPC.UI.ViewModels _powerUpAppBar.Close(); } - _powerUpAppBar = NotificationProvider.PushAppBarItem<PowerUpAppBarItem>(); - _powerUpAppBar.Priority = AppBarPriority.Low; + if (_started) + { + _powerUpAppBar = NotificationProvider.PushAppBarItem<PowerUpAppBarItem>(); + _powerUpAppBar.Priority = AppBarPriority.Low; + } }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index 6633d9eed..4ad21d4cd 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -28,7 +28,7 @@ namespace Tango.BL.Entities private bool _ignorePropChanged; private ActionTimer _syncTimer; private static List<String> _colorPropertyNames; - public const double MAX_TOTAL_LIQUID_VOLUME = 200; + public const double MAX_INK_UPTAKE = 400; #region Enums @@ -104,7 +104,7 @@ namespace Tango.BL.Entities #region Properties /// <summary> - /// Gets or sets a value indicating whether the total value of liquid volumes has exceeded the maximum range of <see cref="MAX_TOTAL_LIQUID_VOLUME"/>. + /// Gets or sets a value indicating whether the total value of liquid volumes has exceeded the maximum range of <see cref="MAX_INK_UPTAKE"/>. /// </summary> [NotMapped] [JsonIgnore] @@ -112,7 +112,7 @@ namespace Tango.BL.Entities { get { - return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > GetTotalMaximumLiquidVolumeLimit() : false; + return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.NanoliterPerCentimeter) > GetTotalMaximumLiquidNlPerCMLimit() : false; } } @@ -780,23 +780,24 @@ namespace Tango.BL.Entities #region Private Methods - private double GetTotalMaximumLiquidVolumeLimit() + private double GetTotalMaximumLiquidNlPerCMLimit() { try { var tables = Segment.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); - if (tables.Count > 1) + + if (tables.Count > 0) { - return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + return tables.Max(x => x.MaxInkUptake); } else { - return MAX_TOTAL_LIQUID_VOLUME; + return MAX_INK_UPTAKE; } } catch { - return MAX_TOTAL_LIQUID_VOLUME; + return MAX_INK_UPTAKE; } } diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotRequest.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotRequest.cs new file mode 100644 index 000000000..f52059f0e --- /dev/null +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.RemoteDesktop.Network +{ + public class GetScreenshotRequest + { + } +} diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotResponse.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotResponse.cs new file mode 100644 index 000000000..39a460073 --- /dev/null +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/GetScreenshotResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.RemoteDesktop.Network +{ + public class GetScreenshotResponse + { + public byte[] Bitmap { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj index c9eafa8ce..a3767bd34 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj @@ -92,6 +92,8 @@ <Compile Include="Input\Touch\TouchInjector.cs" /> <Compile Include="IScreenCaptureEngine.cs" /> <Compile Include="MaxDifferencesReachedException.cs" /> + <Compile Include="Network\GetScreenshotRequest.cs" /> + <Compile Include="Network\GetScreenshotResponse.cs" /> <Compile Include="Network\KeyboardEventType.cs" /> <Compile Include="Network\KeyboardStateRequest.cs" /> <Compile Include="Network\KeyboardStateResponse.cs" /> |
