diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-02-19 10:32:48 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-02-19 10:32:48 +0200 |
| commit | 685b1da155bda741a3378a1c19a04ffd110a0a33 (patch) | |
| tree | e38a3740bf4727dfa9368c6010c6cd55d6910ffb | |
| parent | 94fccc66fd2b8b6aed1371546dfd8cef68d5e60d (diff) | |
| parent | bb51ac752b58b3d64e86a8150e7a9b1f5749e379 (diff) | |
| download | Tango-685b1da155bda741a3378a1c19a04ffd110a0a33.tar.gz Tango-685b1da155bda741a3378a1c19a04ffd110a0a33.zip | |
merge conflict
65 files changed, 1120 insertions, 955 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 873c89b7e..e8d7f6f58 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -280,16 +280,22 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); - Fresult = f_open(DownloadFileHandle,request->filename,FA_READ ); - if (Fresult == FR_OK) + if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { - response.has_maxchunklength = true; - response.maxchunklength = MAX_CHUNK_LENGTH; - strcpy(FileHandleChar, "1234"); - response.downloadid = FileHandleChar; //supporting only single file at each time. + Fresult = f_open(DownloadFileHandle,request->filename,FA_READ ); + if (Fresult == FR_OK) + { + response.has_maxchunklength = true; + response.maxchunklength = MAX_CHUNK_LENGTH; + strcpy(FileHandleChar, "1234"); + response.downloadid = FileHandleChar; //supporting only single file at each time. + Report("data request", __FILE__, 1234, MAX_CHUNK_LENGTH, RpWarning, (int)fno->fsize, 0); + } + else + { + Semaphore_post(FFS_Sem); + } } - } } @@ -323,10 +329,11 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) Buffer = my_malloc (MAX_CHUNK_LENGTH); if (Buffer != NULL) { - Fresult = f_read(SentFileHandle,Buffer,2000,&ReadBytes ); + Fresult = f_read(SentFileHandle,Buffer,MAX_CHUNK_LENGTH,&ReadBytes ); if(Fresult != FR_OK) { - LOG_ERROR (Fresult,"f_write error"); + LOG_ERROR (Fresult,"f_read error"); + Semaphore_post(FFS_Sem); } else { @@ -334,6 +341,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) response.buffer.len = ReadBytes; response.buffer.data = Buffer; FileSentLength += ReadBytes; + Report("sending data to MS", __FILE__, ReadBytes, FileSentLength, RpWarning, (int)FileLength, 0); if (FileSentLength == FileLength) { REPORT_MSG (FileSentLength,"file download ended successfully"); diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 32e149968..716ae7fe4 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -26,9 +26,8 @@ #define USE_POWERSTEP01 //#define SPECIAL_DISPENSERS -#define Use_Head_Card //for real card only -#define Use_WHS_Card //for real card only -//#define Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 +//#define Use_Head_Card //for real card only +//#define Use_WHS_Card //for real card only #define I2C_2_Data_Transfer_Rate_400kbps #define I2C_3_Data_Transfer_Rate_400kbps// Head card + WHS card 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 f182ec09c..1684b1dcc 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 @@ -539,7 +539,10 @@ uint32_t ActivateHeadMagnet() F2_CTRL = F2_CTRL_Reg.ushort; if (isMotorConfigured(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM)) { - MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_CLOSE ); + if (MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM].DriverType == CombinrdMotDriver) + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_OPEN ); + else + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_CLOSE ); } } MagnetControlId = AddControlCallback(NULL, MagnetCallBackFunction, 2* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); @@ -566,7 +569,10 @@ uint32_t DeActivateHeadMagnet() Report("DeActivateHeadMagnet - open the lid magnet",__FILE__,__LINE__,(int)HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,RpWarning,(int)DH_LID_CLOSE,0); if (isMotorConfigured(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM)) { - MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_OPEN ); + if (MotorDriverResponse[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM].DriverType == CombinrdMotDriver) + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_CLOSE ); + else + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_OPEN ); //MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM, DH_LID_OPEN, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM], NULL,1000); } F2_CTRL_Reg.ushort |= SPARE_SSR13_CTRL; diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c index a23e405dc..43dea9e24 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -480,15 +480,13 @@ void FPGA_SetMotorsInit() { uint8_t i=0; - #ifdef USE_POWERSTEP01 //since powerstep in stby on powerup) - F1_Moto_Driver_NSTBYRST1 = 0xFFFF; - F1_Moto_Driver_NSTBYRST2 = 0xFFFF; - F2_Moto_Driver_NSTBYRST1 = 0xFFFF; - F3_Moto_Driver_NSTBYRST1 = 0xFFFF; + F1_Moto_Driver_NSTBYRST1 = 0xFFFF; + F1_Moto_Driver_NSTBYRST2 = 0xFFFF; + F2_Moto_Driver_NSTBYRST1 = 0xFFFF; + F3_Moto_Driver_NSTBYRST1 = 0xFFFF; - SysCtlDelay(120000);//1mSec - #endif + SysCtlDelay(120000);//1mSec for(i=0;i<NUM_OF_MOTORS;i++) { diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c index 57f96fbbf..df05156e4 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c @@ -114,6 +114,9 @@ uint32_t ActivateHeater (int HeaterId) { F2_CTRL_Reg.ushort |= portMap[HeaterId].m_pin; F2_CTRL = F2_CTRL_Reg.ushort; + portMap[HeaterId].Active = true; + //--------------------------------------------------------------------------------------- + HeaterActive |= 1 << HeaterId; } else { //F2_CTRL |= portMap[HeaterId].m_pin; @@ -177,6 +180,8 @@ uint32_t DeActivateHeater (int HeaterId) //F2_CTRL &= ~portMap[HeaterId].m_pin; F2_CTRL_Reg.ushort &= ~portMap[HeaterId].m_pin; F2_CTRL = F2_CTRL_Reg.ushort; + portMap[HeaterId].Active = false; + HeaterActive &= ~(1 << HeaterId); } else { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c index a2f003840..9b17ae0dd 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c @@ -127,14 +127,5 @@ uint32_t Check_Head_Type_Via_EEPROM() Head_Type = Head_struct.Read_Head_EEPROM.bytes.HeadType; } - //temporary - #ifdef Use_Head_Card - Head_Type = HEAD_TYPE_SYLKO; - #else - Head_Type = HEAD_TYPE_SYLKO_WITHOUT_CARD; - #endif - - //TODO to test and replace #ifdef Use_Head_Card with if(Head_Type != HEAD_TYPE_SYLKO_WITHOUT_CARD) - return status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c index 87616e52a..6a37a2003 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c @@ -279,11 +279,7 @@ void Test_Head_fan_Click() static uint8_t once = 1; if (once) { - #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 - Select_Main_Head_Mux_Channel_test(); - #else - Select_Main_Head_Mux_Channel(); - #endif + Select_Main_Head_Mux_Channel(); //once = 0; } @@ -299,11 +295,7 @@ uint8_t Head_Fan_PWM_Control(uint8_t Fan_ID, uint8_t PWM) { uint8_t status = OK; - #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 - Select_Main_Head_Mux_Channel_test(); - #else - Select_Main_Head_Mux_Channel(); - #endif + Select_Main_Head_Mux_Channel(); if(Fan_ID < 0x02) { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h index 24eb5bfe7..4709f5d92 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h @@ -18,11 +18,7 @@ The I2C addresses on the board: //#include "Drivers/I2C_Communication/PT100/PT100_ADC.h" //I2C MAIM OUTPUT 12v: -#ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 - #define I2C_ID_HEAD_CARD 0x04 // 4 for testing via dispenser card 0x03 -#else - #define I2C_ID_HEAD_CARD 0x03 // -#endif +#define I2C_ID_HEAD_CARD 0x03 // #define I2C3_MAIN_MUX_TCA9548A_0xE2 0xE2 //SD4 - MCU_SPARE1_SDA , SC4 - MCU_SPARE1_SCL //---------------------------------------------------------- diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c index 47bbb7b60..8ed492ccc 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c @@ -238,66 +238,60 @@ uint32_t HeadADCPT100_WriteReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg, return Status; } - - -#ifdef Use_Head_Card - uint8_t HeadADCPT100_InitConfigReg() { uint8_t i; - - for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them + if (Head_Type >= HEAD_TYPE_SYLKO)//adjust the limit switches { - // - - - - - - - - - - Reg0 - - - - - - - - - - - HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 - HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 - //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them + { + // - - - - - - - - - - Reg0 - - - - - - - - - - + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 + //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 - // - - - - - - - - - - Reg1 - - - - - - - - - - + // - - - - - - - - - - Reg1 - - - - - - - - - - - HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 - HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 - HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 - HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 - HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 - // - - - - - - - - - - Reg2 - - - - - - - - - - + // - - - - - - - - - - Reg2 - - - - - - - - - - - HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 - HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 - HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 - HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 - HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 - // - - - - - - - - - - Reg3 - - - - - - - - - - - HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 - HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 - HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 + // - - - - - - - - - - Reg3 - - - - - - - - - - + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 - } + } - for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++) - { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 - HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL; - } + for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++) + { + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL; + } - for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++) - { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 - HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL; - } + for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++) + { + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL; + } - HeadTempSensConfig[i].Config = 0; + HeadTempSensConfig[i].Config = 0; - HeadTempSensConfig[i].MUX_Status = UNKNOWN; + HeadTempSensConfig[i].MUX_Status = UNKNOWN; - return OK; -} -#else - uint8_t HeadADCPT100_InitConfigReg() + } + else { - uint8_t i; for(i=HEAD_PT100_ZONE_1_0X80_0;i<MAX_HEAD_CARD_TEMP_SENS_ID; i++) { @@ -328,10 +322,10 @@ uint8_t HeadADCPT100_InitConfigReg() HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN3 ;//Bits 5-7 } - - return OK; } -#endif + + return OK; +} uint32_t HeadADCPT100_Config_callback(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Stage) { @@ -606,11 +600,7 @@ uint32_t Test_HeadCard_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId) uint32_t Status = OK; //uint8_t i = 0; - #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 - Select_Main_Head_Mux_Channel_test(); - #else - Select_Main_Head_Mux_Channel(); - #endif + Select_Main_Head_Mux_Channel(); //HeadADCPT100_Reset(); //HeadADCPT100_InitConfigReg(); 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 27ae72084..c6b8dbf39 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c @@ -82,12 +82,9 @@ void Trigger_Heater_Current_Read(void) I2C_ReadingMessage.parameter = NUM_OF_CURRENT_HEATERS; if (I2C_ReadingMsgQ != NULL) Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); - I2C_ReadingMessage.parameter = HEATER_DRYER_CURRENT_1; - if (I2C_ReadingMsgQ != NULL) - Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); - I2C_ReadingMessage.parameter = HEATER_DRYER_CURRENT_2; - if (I2C_ReadingMsgQ != NULL) - Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); + + Read_Heaters_Current(HEATER_DRYER_CURRENT_1); + Read_Heaters_Current(HEATER_DRYER_CURRENT_2); return; @@ -302,17 +299,17 @@ void Trigger_SetWHSBlowerVoltage (uint16_t voltage) return; } -void Trigger_WHS_Set_Blower_Control_Closed_Loop (uint32_t setpoint_Q) -{ - I2C_ReadingMessageStruc I2C_ReadingMessage; - - I2C_ReadingMessage.messageId = WHS_SETPOINT_Q_BLOWER; - I2C_ReadingMessage.parameter = setpoint_Q; - - if (I2C_ReadingMsgQ != NULL) - Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); - return; -} +//void Trigger_WHS_Set_Blower_Control_Closed_Loop (uint32_t setpoint_Q) +//{ +// I2C_ReadingMessageStruc I2C_ReadingMessage; +// +// I2C_ReadingMessage.messageId = WHS_SETPOINT_Q_BLOWER; +// I2C_ReadingMessage.parameter = setpoint_Q; +// +// if (I2C_ReadingMsgQ != NULL) +// Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); +// return; +//} //void Trigger_WHS_Set_Valve(uint8_t valve_number, bool status) @@ -440,8 +437,8 @@ void I2C_ReadingTask(UArg arg0, UArg arg1) //Report("Read_Heaters_Current",__FILE__,__LINE__,255,RpWarning,0,0); if((Head_Type > HEAD_TYPE_SYLKO_WITHOUT_CARD)&&(I2C_ReadingMessage.parameter>=HEATER_DRYER_CURRENT_3)) Read_Head_ADC(I2C_ReadingMessage.parameter); - else - Read_Heaters_Current(I2C_ReadingMessage.parameter); +// else +// Read_Heaters_Current(I2C_ReadingMessage.parameter); break; case PT100_Reading: Set_HeadCard_PT100(); @@ -514,11 +511,10 @@ void I2C_ReadingTask(UArg arg0, UArg arg1) WHS_Set_Volt_Blower_Control(I2C_ReadingMessage.parameter); //(fan_number, 0x20) break; - case WHS_SETPOINT_Q_BLOWER: - - dbl_setpoint_Q = (double)(I2C_ReadingMessage.parameter / 100) ; - WHS_Set_Blower_Control_Closed_Loop(dbl_setpoint_Q); - break; +// case WHS_SETPOINT_Q_BLOWER: +// dbl_setpoint_Q = (double)(I2C_ReadingMessage.parameter / 100) ; +// WHS_Set_Blower_Control_Closed_Loop(dbl_setpoint_Q); +// break; case WHS_SET_VAlVE_CARTRIDGE: // Set_WHS_valve(VALVE_0, I2C_ReadingMessage.parameter, 0); 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 b16e87766..c34191c0a 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h @@ -27,7 +27,7 @@ void Trigger_WHS_PT100_Read_All(void); void Trigger_ReadWHSPT100(uint8_t PT100_Id); //void Trigger_WHS_Set_Volt_Blower_Control(uint16_t volt); void Trigger_SetWHSBlowerVoltage (uint16_t voltage); -void Trigger_WHS_Set_Blower_Control_Closed_Loop (uint32_t setpoint_Q); +//void Trigger_WHS_Set_Blower_Control_Closed_Loop (uint32_t setpoint_Q); //void Trigger_WHS_Set_Valve(uint8_t valve_number, bool status); void Trigger_SetWHSValveWatseCartridge(uint8_t Cart_Id); //void Trigger_WHS_Set_Pump(bool status); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c index 2316b3387..97b572697 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c @@ -481,11 +481,7 @@ bool D_ADS122_InitConfigReg() // uint32_t Status = OK; // uint8_t i = 0; // -// #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 -// Select_Main_Head_Mux_Channel_test(); -// #else -// Select_Main_Head_Mux_Channel(); -// #endif +// Select_Main_Head_Mux_Channel(); // // //HeadADCPT100_Reset(); // HeadADCPT100_InitConfigReg(); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c index d34787671..6cfdee163 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c @@ -293,652 +293,6 @@ bool Test_WHS_PT100_ADC() status |= WHS_PT100_Read(/*TEMPERATURE_SENSOR_ID_ENUM*/ WHS_PT100_2_0X80_1); status |= WHS_PT100_Read(/*TEMPERATURE_SENSOR_ID_ENUM*/ WHS_PT100_4_0X82_1); - - - /* - * WHS_PT100_1_0X80_0, -WHS_PT100_2_0X80_1, -WHS_PT100_3_0X82_0, -WHS_PT100_4_0X82_1, - * */ - - return status; -} - - -//D_ADS122C04_TempSensConfigStruc HeadTempSensConfig[MAX_HEAD_CARD_TEMP_SENS_ID];//using only from HEAD_PT100_ZONE_1_0X80_0 -// -//uint32_t was_I2C_ADC_ADS122C04_SLAVE_ADD = 0x80; //A0-GND A1-GND 4-Bit, 4-Channel, 2-kSPS, ADC ------ PT100 ADC – 0x80 … 0x87. -// -//uint8_t was_Save_Sel_Status = UNKNOWN; - -//uint32_t SensorId_To_SlaveAdd(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// switch(SensorId) -// { -// case HEAD_PT100_ZONE_1_0X80_0: -// case HEAD_PT100_ZONE_2_0X80_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x80; -// break; -// case HEAD_PT100_ZONE_3_0X82_0: -// case HEAD_PT100_ZONE_4_0X82_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x82; -// break; -// case HEAD_PT100_ZONE_5_0X84_0: -// case HEAD_PT100_ZONE_6_0X84_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x84; -// break; -// case HEAD_PT100_ZONE_7_0X86_0: -// case HEAD_PT100_ZONE_8_0X86_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x86; -// break; -// case HEAD_PT100_ZONE_9_0X88_0: -// case HEAD_PT100_ZONE_10_0X88_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x88; -// break; -// case HEAD_PT100_ZONE_11_0X8A_0: -// case HEAD_PT100_ZONE_12_0X8A_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x8A; -// break; -// case HEAD_PT100_AIR_HEATER_1_0X8C_0: -// case HEAD_PT100_AIR_HEATER_2_0X8C_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x8C; -// break; -// case HEAD_PT100_MIXER_0X8E_0: -// case HEAD_PT100_RESERVE_0X8E_1: -// I2C_ADC_ADS122C04_SLAVE_ADD = 0x8E; -// break; -// default: -// break; -// } -// -// return I2C_ADC_ADS122C04_SLAVE_ADD; -//} - -//uint32_t I2C_Write_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Write_buf, uint32_t No_BytesToWrite ) -//{ -// uint32_t status = OK; -// -// I2C_ADC_ADS122C04_SLAVE_ADD = SensorId_To_SlaveAdd(SensorId); -// status |= I2C_Write(I2C_ID, I2C_ADC_ADS122C04_SLAVE_ADD, I2C_Write_buf, No_BytesToWrite); -// -// return status; -//} - -//uint32_t HeadADCPT100_ControlMux_Brfore_Reading(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// -// uint8_t Write_Buf[2]; -// -// if(SensorId % 2) -// HeadTempSensConfig[SensorId].Reg0.bits.MUX = 0x03; // TBD -// else -// HeadTempSensConfig[SensorId].Reg0.bits.MUX = 0x04; // TBD -// -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// -// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// -// return Status; -//} - - -//uint32_t was_I2C_Read_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Read_buf, uint32_t No_BytesToRead ) -//{ -// uint32_t status = OK; -// -// //HeadADCPT100_ControlMux_Brfore_Reading(SensorId); -// //TODO Choose TEMP1 sensor by I/O -// was_I2C_ADC_ADS122C04_SLAVE_ADD = SensorId_To_SlaveAdd(SensorId); -// status |= I2C_Read(I2C_ID, was_I2C_ADC_ADS122C04_SLAVE_ADD + 1, I2C_Read_buf, No_BytesToRead); -// -// return status; -//} - -//uint32_t was_HeadADCPT100_Reset(void) -//{ -// uint32_t status = OK; -// #ifndef EVALUATION_BOARD -// uint8_t i; -// uint8_t Write_Buf[1]; -// -// for(i=HEAD_PT100_ZONE_1_0X80_0;i<MAX_HEAD_CARD_TEMP_SENS_ID; i++) -// { -// //Reset the device -// Write_Buf[0] = ADS122X_RESET_CMD; -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -//// status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, i, Write_Buf, 1); -// //status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_ADC_ADS122C04_SLAVE_ADD, Write_Buf, 1); -// //Wait at least (50 us + 32 · t(CLK)) after the RESET command is sent before sending any other command. -// -// } -// #endif -// SysCtlDelay(100); // Must delay after hard reset -// -// return status; -//} - - -//uint32_t was_HeadADCPT100_StartSync(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// uint8_t Write_Buf[1]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// Status = ERROR; -// -// Write_Buf[0] = ADS122X_START_CMD; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -// -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// //Status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_ADC_ADS122C04_SLAVE_ADD, Write_Buf, 1); -// -// return Status; -//} - -//uint32_t was_HeadADCPT100_PowerDown(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// uint8_t Write_Buf[1]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// Status = ERROR; -// -// Write_Buf[0] = ADS122X_POWERDOWN_CMD; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// //Status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_ADC_ADS122C04_SLAVE_ADD, Write_Buf, 1); -// -// return Status; -//} - -//uint32_t was_Data_ADC_Head = 0; -//uint32_t was_HeadADCPT100_SendReadDataCommand(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// uint8_t Write_Buf[1]; -// -// uint32_t temp; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// Status = ERROR; -// -// //Write_Buf[0] = ADS122X_RDATA_CMD; -// Write_Buf[0] = ADS122X_RDATA_CMD; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// //Status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_ADC_ADS122C04_SLAVE_ADD, Write_Buf, 1); -// -//// Status |= I2C_Read_SensorId(I2C_ID_HEAD_CARD, SensorId, &temp, 3); -// was_Data_ADC_Head = (temp & 0xFF0000) >> 16 | (temp & 0xFF00) | (temp & 0x0000FF) << 16;//First send the MSB so we need to reorder the bytes -// -// CalculateTemperatures(SensorId, was_Data_ADC_Head); -// -// -// return Status; -//} - -//uint32_t was_HeadADCPT100_WriteReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg, uint8_t writeValue) -//{ -// uint32_t Status = OK; -// uint8_t Write_Buf[2]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// Status = ERROR; -// -// Write_Buf[0] = ADS122X_WRITE_CMD(reg); -// Write_Buf[1] = writeValue; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// //Status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_ADC_ADS122C04_SLAVE_ADD, Write_Buf, 2); -// -// return Status; -//} - - - -//#ifdef Use_Head_Card -// -//uint8_t was_HeadADCPT100_InitConfigReg() -//{ -// uint8_t i; -// -// for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them -// { -// // - - - - - - - - - - Reg0 - - - - - - - - - - -// HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 -// HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 -// //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 -// -// // - - - - - - - - - - Reg1 - - - - - - - - - - -// -// HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 -// HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_INTERNAL ;//Bits 1-2 -// HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 -// HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 -// HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 -// -// // - - - - - - - - - - Reg2 - - - - - - - - - - -// -// HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 -// HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 -// HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 -// HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 -// HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 -// -// // - - - - - - - - - - Reg3 - - - - - - - - - - -// HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 -// HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 -// HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 -// -// } -// -// for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID_0;i++) -// { -// HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 -// HeadTempSensConfig[i].SEL = ODD; -// } -// -// for(i=HEAD_PT100_ZONE_2_0X80_1;i < MAX_HEAD_CARD_TEMP_SENS_ID_1;i++) -// { -// HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 -// HeadTempSensConfig[i].SEL = EVEN; -// } -// -// HeadTempSensConfig[i].Config = 0; -// -// HeadTempSensConfig[i].MUX_Status = UNKNOWN; -// -// return OK; -//} -//#else -// uint8_t was_HeadADCPT100_InitConfigReg() -// { -// uint8_t i; -// -// for(i=HEAD_PT100_ZONE_1_0X80_0;i<MAX_HEAD_CARD_TEMP_SENS_ID; i++) -// { -// // - - - - - - - - - - Reg0 - - - - - - - - - - -// HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_PGA_ENABLE ;//Bit 0 -// HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 -// HeadTempSensConfig[i].Reg0.bits.MUX = ADS122X_MUX_AIN1_AIN0 ;//Bits 4-7 -// -// // - - - - - - - - - - Reg1 - - - - - - - - - - -// -// HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 -// HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_INTERNAL ;//Bits 1-2 -// HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 -// HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 -// HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 -// -// // - - - - - - - - - - Reg2 - - - - - - - - - - -// -// HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_500_UA ;//Bits 0-2 -// HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 -// HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 -// HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 -// HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 -// -// // - - - - - - - - - - Reg3 - - - - - - - - - - -// HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 -// HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_DISABLED ;//Bits 2-4 -// HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN3 ;//Bits 5-7 -// -// } -// -// return OK; -// } -//#endif - -//uint32_t was_HeadADCPT100_Config_callback(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Stage) -//{ -// uint32_t Status = OK; -// -// #ifndef EVALUATION_BOARD -// -// uint8_t Write_Buf[2]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// return ERROR; -// -// if(HeadTempSensConfig[SensorId].Config == DONE) -// return Status; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -// -// switch(Stage) -// { -// case SENSOR_CONFIG_REG0: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// break; -// case SENSOR_CONFIG_REG1: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_1_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg1.Byte; -// break; -// case SENSOR_CONFIG_REG2: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_2_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg2.Byte; -// break; -// case SENSOR_CONFIG_REG3: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_3_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg3.Byte; -// break; -// default: -// Status = ERROR; -// } -// -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// -// switch(SensorId) -// { -// case HEAD_PT100_ZONE_1_0X80_0: -// case HEAD_PT100_ZONE_2_0X80_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_1_0X80_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_2_0X80_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_3_0X82_0: -// case HEAD_PT100_ZONE_4_0X82_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_3_0X82_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_4_0X82_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_5_0X84_0: -// case HEAD_PT100_ZONE_6_0X84_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_5_0X84_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_6_0X84_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_7_0X86_0: -// case HEAD_PT100_ZONE_8_0X86_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_7_0X86_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_8_0X86_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_9_0X88_0: -// case HEAD_PT100_ZONE_10_0X88_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_9_0X88_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_10_0X88_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_11_0X8A_0: -// case HEAD_PT100_ZONE_12_0X8A_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_11_0X8A_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_12_0X8A_1].Config = DONE; -// break; -// case HEAD_PT100_AIR_HEATER_1_0X8C_0: -// case HEAD_PT100_AIR_HEATER_2_0X8C_1: -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_1_0X8C_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_2_0X8C_1].Config = DONE; -// break; -// case HEAD_PT100_MIXER_0X8E_0: -// case HEAD_PT100_RESERVE_0X8E_1: -// HeadTempSensConfig[HEAD_PT100_MIXER_0X8E_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_RESERVE_0X8E_1].Config = DONE; -// break; -// default: -// break; -// } -// -// #endif -// -// return Status; -//} - -//void was_HeadADCPT100_SensorInitConfig() -//{ -// int Sensor=0,Register = 0; -// -// HeadADCPT100_InitConfigReg(); // Initial the configuration registers -// -// for(Register=0;Register<=SENSOR_CONFIG_REG3;Register++) -// { -// for(Sensor=HEAD_PT100_ZONE_1_0X80_0;Sensor<MAX_HEAD_CARD_TEMP_SENS_ID; Sensor++) -// { -// HeadADCPT100_Config_callback( (TEMPERATURE_SENSOR_ID_ENUM)(Sensor), Register); -// } -// SysCtlDelay(1000); -// } -//} -/* -uint32_t was_HeadCard_Toggle_PT100(bool Odd_OR_Even)//ODD/EVEN -{ - uint32_t status = OK; - uint8_t i=0; - uint8_t Write_Buf[2]; - - was_HeadCard_Toggle_PT100_SEL(Odd_OR_Even); - - if(Odd_OR_Even == EVEN) - { - for(i=HEAD_PT100_ZONE_2_0X80_1;i < MAX_HEAD_CARD_TEMP_SENS_ID;i=i+2) - { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX;//Reg0 Bits 4-7 - - Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); - Write_Buf[1] = HeadTempSensConfig[i].Reg0.Byte; - - status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, i, Write_Buf, 2); - } - } - else - { - for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i=i+2) - { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX;//Reg0 Bits 4-7 - - Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); - Write_Buf[1] = HeadTempSensConfig[i].Reg0.Byte; - - status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, i, Write_Buf, 2); - } - } - return status; } -*/ - -//uint32_t was_HeadCard_Toggle_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t status = OK; -// uint8_t Write_Buf[2]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// return ERROR; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -// -//// if(was_Save_Sel_Status != HeadTempSensConfig[SensorId].SEL) -//// { -//// was_HeadCard_Toggle_PT100_SEL(HeadTempSensConfig[SensorId].SEL); -//// was_Save_Sel_Status = HeadTempSensConfig[SensorId].SEL; -//// } -// -// if(HeadTempSensConfig[SensorId].MUX_Status != HeadTempSensConfig[SensorId].Reg0.bits.MUX) -// { -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// -//// status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// -// switch(SensorId) -// { -// case HEAD_PT100_ZONE_1_0X80_0: -// case HEAD_PT100_ZONE_2_0X80_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_1_0X80_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_2_0X80_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_3_0X82_0: -// case HEAD_PT100_ZONE_4_0X82_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_3_0X82_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_4_0X82_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_5_0X84_0: -// case HEAD_PT100_ZONE_6_0X84_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_5_0X84_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_6_0X84_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_7_0X86_0: -// case HEAD_PT100_ZONE_8_0X86_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_7_0X86_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_8_0X86_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_9_0X88_0: -// case HEAD_PT100_ZONE_10_0X88_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_9_0X88_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_10_0X88_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_11_0X8A_0: -// case HEAD_PT100_ZONE_12_0X8A_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_11_0X8A_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_12_0X8A_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_AIR_HEATER_1_0X8C_0: -// case HEAD_PT100_AIR_HEATER_2_0X8C_1: -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_1_0X8C_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_2_0X8C_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_MIXER_0X8E_0: -// case HEAD_PT100_RESERVE_0X8E_1: -// HeadTempSensConfig[HEAD_PT100_MIXER_0X8E_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_RESERVE_0X8E_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// default: -// break; -// } -// } -// return status; -//} - - -//uint32_t was_HeadADCPT100_ReadReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg, uint8_t *readValue) -//{ -// uint32_t Status = OK; -// -// uint8_t Write_Buf[1]; -// -// #ifdef Use_Head_Card -// Select_Main_Head_Mux_Channel(); -// #endif -// -// Write_Buf[0] = ADS122X_READ_CMD(reg); -// -//// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// delayUs(1); // delayUs(50); -//// Status |= I2C_Read_SensorId(I2C_ID_HEAD_CARD, SensorId, readValue, 1); -// -// return Status; -//} - -//uint8_t was_Test_Read_Buf[4] = {0,0,0,0}; - -//uint32_t was_Test_HeadCard_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// uint8_t i = 0; -// -// #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 -// Select_Main_Head_Mux_Channel_test(); -// #else -// Select_Main_Head_Mux_Channel(); -// #endif -// -// //HeadADCPT100_Reset(); -// HeadADCPT100_InitConfigReg(); -// -// -// was_HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG0); -// was_HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG1); -// was_HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG2); -// was_HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG3); -// -// was_HeadADCPT100_StartSync(SensorId); -// -// -// -// uint8_t Write_Buf[4] = {SENSOR_CONFIG_REG0,SENSOR_CONFIG_REG1,SENSOR_CONFIG_REG2,SENSOR_CONFIG_REG3}; -// -// for(i=0; i<4; i++) -// { -// was_HeadADCPT100_ReadReg(SensorId, Write_Buf[i], &was_Test_Read_Buf[i]); -// -// } -// -// was_HeadADCPT100_SendReadDataCommand(SensorId); -// -// -// return Status; -//} - -//uint32_t was_HeadADCPT100_Calc_Resistance(TEMPERATURE_SENSOR_ID_ENUM SensorId, unsigned int Current_Measurement) -//{ -// -// #define Rref 1650 //ohm -// -// uint32_t HeadADCPT100_Resistance_100; -// -// unsigned int Factor_2Rref_E_H; -// unsigned int Factor_2Rref_E_L; -// -// //Resistance = Measurement / (2^23) *4 * Rref / Gain //---------------------- is it *4 ???? -// -// Factor_2Rref_E_H = 400 * Rref; // 200 to calculate Resistance*100 -// -// Factor_2Rref_E_L = 8388608 * (2<<(TempSensConfig[SensorId].Reg0.bits.GAIN -1));//2^23*Gain -// -// HeadADCPT100_Resistance_100 = (float)Current_Measurement / (float)Factor_2Rref_E_L * (float)Factor_2Rref_E_H; -// -// return HeadADCPT100_Resistance_100; -//} -//uint32_t was_Test_ADS122X_Internal_Temperature_Sensor(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Data = 0; -// -// uint8_t Write_Buf[2]; -// -// Select_Main_Head_Mux_Channel(); -// -// SysCtlDelay(5000); -// HeadTempSensConfig[SensorId].Reg1.bits.TS = ADS122X_TEMP_SENSOR_ON;//Bit 1 Enables the Internal temperature sensor -// -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_1_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg1.Byte; -//// I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// -// was_HeadCard_Toggle_PT100(SensorId); -// -// SysCtlDelay(5000); -// -// was_HeadADCPT100_StartSync(SensorId); -// SysCtlDelay(3000); -// -// was_HeadADCPT100_SendReadDataCommand(SensorId); -// -// Data = was_Data_ADC_Head; -// -// Data = Data & 0xFFFFFF;//24bit -// -// Data = Data >> 10;//need the 14 left bits // According to ADS1220 data sheet page 31 8.3.13 -// -// Data*=0.03125;// According to ADS1220 data sheet page 31 8.3.13 -// -// return Data;//Temperature_C -// -//} diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.c index ab7ea8303..b3d967ad3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.c @@ -72,7 +72,7 @@ bool Select_WHS_Fan_Mux_Channel(WHS_fan_num fan_number) // { // return status; // } - ReportWithPackageFilter(WasteFilter,"------------ select fan MUX (fan_number)-----------------", __FILE__,__LINE__,fan_number, RpMessage, 0, 0); + //ReportWithPackageFilter(WasteFilter,"------------ select fan MUX (fan_number)-----------------", __FILE__,__LINE__,fan_number, RpMessage, 0, 0); switch (fan_number) { case FAN1: @@ -122,7 +122,7 @@ bool WHS_Read_fan_tach(WHS_fan_num fan_number) bool status = OK; uint8_t fan_driver = 0; - fan_driver = Select_Fan_Driver(fan_number); + fan_driver = Select_Fan_Driver(fan_number); status = Select_Main_WHS_Mux_Channel(); Select_WHS_Fan_Mux_Channel(fan_number); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c index 58f2878ef..aa2be496e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c @@ -17,6 +17,7 @@ #include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.h> #include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h> #include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h> +#include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h> MAX11614 U20_MAX11614 ; @@ -181,16 +182,17 @@ bool Test_WHS_max11614() #define Aorf_ofset 0.0425 //#define Corf_flow 0.2485 #define Corf_flow 0.239 //email from Sergey 3.2.2020 +#define V0 1000 double get_Q(int16_t num) { double Sqrt = 0; double calc = 0; - int16_t tmp = num; + int16_t tmp = num-V0; if (tmp<0) tmp = 0; Sqrt = sqrt((double)tmp); - calc = Aorf_ofset + Corf_flow*Sqrt; + calc = Corf_flow*Sqrt; ReportWithPackageFilter(WasteFilter,"------------ calc Q value (calc)-----------------", __FILE__,__LINE__, calc, RpMessage, num, 0); return calc; } @@ -273,16 +275,19 @@ uint16_t Orf_zero_value[HEAD_FLOW_METER+1] = {1112,0,1040}; double GetWHSAirFlow(uint8_t OR_Id) { uint16_t value = 0; + double Q_value = 0 ; switch (OR_Id) { case DRIER_FLOW_METER: - get_orf_1(&value); + //get_orf_1(&value); + Q_value = get_average_ORF1_Q(); break; case NU_FLOW_METER: get_orf_2(&value); break; case HEAD_FLOW_METER: - get_orf_3(&value); + //get_orf_3(&value); + Q_value = get_average_ORF3_Q(); break; default: break; @@ -290,7 +295,7 @@ double GetWHSAirFlow(uint8_t OR_Id) ReportWithPackageFilter(WasteFilter,"------------ GetWHSAirFlow -----------------",__FILE__, OR_Id, (int)value, RpWarning, (int) Orf_zero_value[OR_Id], 0); - return get_Q((int16_t)value-Orf_zero_value[OR_Id]); + return Q_value ;//get_Q((int16_t)value-Orf_zero_value[OR_Id]); } 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 28b4f8598..384e3cd59 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 @@ -26,6 +26,8 @@ double average_orf3_Q_buff[ORF_BUFF_SIZE] = {0}; double average_Q_orifice1; double average_Q_orifice3; +bool ORF1_flageNewBlowerValue; +bool ORF3_flageNewBlowerValue; int32_t i2c_smbus_write_word_data(int i2cFileDescriptor, uint8_t command_regAddress, uint16_t regValue) { @@ -115,6 +117,8 @@ bool WHS_Set_Volt_Blower_Control(uint16_t volt) } else { + ORF1_flageNewBlowerValue = 1; + ORF3_flageNewBlowerValue = 1; MAX5805_CODE_LOAD( volt); ReportWithPackageFilter(WasteFilter,"------------ WHS_Set_Volt_Blower_Control (volt)-----------------", __FILE__,__LINE__, volt, RpMessage, 0, 0); } @@ -190,21 +194,38 @@ double WHS_Blower_Avarege_ORF1() static uint8_t i = 0 ; static double sum_orifice_Q = 0; uint16_t orifice_hex_value = 0; + double Q_temp = 0 ; - if (i == ORF_BUFF_SIZE) + get_orf_1( &orifice_hex_value ); + if (ORF1_flageNewBlowerValue) { - i = 0; + ORF1_flageNewBlowerValue = 0; + Q_temp = get_Q(orifice_hex_value); + sum_orifice_Q = Q_temp*ORF_BUFF_SIZE; + average_Q_orifice1 = Q_temp; + for (i = 0; i < ORF_BUFF_SIZE; i+=1) + { + average_orf1_Q_buff[i] = Q_temp; + } + ReportWithPackageFilter(WasteFilter,"------------ average_Q_orifice1 hex drier new value-----------------", __FILE__,__LINE__,(int)orifice_hex_value, RpMessage, (average_Q_orifice1*1000), 0); } else { - i += 1; + if (i == ORF_BUFF_SIZE) + { + i = 0; + } + else + { + i += 1; + } + sum_orifice_Q -= average_orf1_Q_buff[i]; + get_orf_1(&orifice_hex_value ); + average_orf1_Q_buff[i] = get_Q(orifice_hex_value); + sum_orifice_Q += average_orf1_Q_buff[i]; + average_Q_orifice1 = sum_orifice_Q / ORF_BUFF_SIZE; + ReportWithPackageFilter(WasteFilter,"------------ average_Q_orifice3 hex head -----------------", __FILE__,__LINE__,(int)orifice_hex_value, RpMessage, (average_Q_orifice3*1000), 0); } - sum_orifice_Q -= average_orf1_Q_buff[i]; - get_orf_1(&orifice_hex_value ); - average_orf1_Q_buff[i] = get_Q(orifice_hex_value); - sum_orifice_Q += average_orf1_Q_buff[i]; - - average_Q_orifice1 = sum_orifice_Q /ORF_BUFF_SIZE; return average_Q_orifice1; } @@ -213,23 +234,39 @@ double WHS_Blower_Avarege_ORF3() static uint8_t i = 0 ; static double sum_orifice_Q = 0; uint16_t orifice_hex_value = 0; + double Q_temp = 0 ; - if (i == ORF_BUFF_SIZE) + get_orf_3( &orifice_hex_value ); + if (ORF3_flageNewBlowerValue) { - i = 0; + ORF3_flageNewBlowerValue = 0; + Q_temp = get_Q(orifice_hex_value); + sum_orifice_Q = Q_temp*60; + average_Q_orifice3= Q_temp; + for (i = 0; i < ORF_BUFF_SIZE; i+=1) + { + average_orf3_Q_buff[i] = Q_temp; + } + ReportWithPackageFilter(WasteFilter,"------------ average_Q_orifice3 hex head new value-----------------", __FILE__,__LINE__,(int)orifice_hex_value, RpMessage, (average_Q_orifice3*1000), 0); + } else { - i += 1; + if (i == ORF_BUFF_SIZE) + { + i = 0; + } + else + { + i += 1; + } + sum_orifice_Q -= average_orf3_Q_buff[i]; + average_orf3_Q_buff[i] = get_Q(orifice_hex_value); + sum_orifice_Q += average_orf3_Q_buff[i]; + average_Q_orifice3 = sum_orifice_Q /ORF_BUFF_SIZE; } - sum_orifice_Q -= average_orf3_Q_buff[i]; - get_orf_3( &orifice_hex_value ); //average_orf1_buff[i] = - average_orf3_Q_buff[i] = get_Q(orifice_hex_value); - sum_orifice_Q += average_orf3_Q_buff[i]; - - average_Q_orifice3 = sum_orifice_Q /ORF_BUFF_SIZE; ReportWithPackageFilter(WasteFilter,"------------ average_Q_orifice3 hex head -----------------", __FILE__,__LINE__,(int)orifice_hex_value, RpMessage, (average_Q_orifice3*1000), 0); - return OK; + return average_Q_orifice3; } double get_average_ORF1_Q() @@ -274,7 +311,7 @@ bool WHS_Set_Blower_Control_Closed_Loop(double SetPoint_Q) current_dying_head_flow_Q = get_average_ORF3_Q(); ReportWithPackageFilter(WasteFilter,"------------ current_dying_head_flow_Q =-----------------", __FILE__,__LINE__, current_dying_head_flow_Q, RpMessage, 0, 0); ReportWithPackageFilter(WasteFilter,"------------ SET_DYEING_HEAD_ORRIFFICE_SENSOR =-----------------", __FILE__,__LINE__, SET_DYEING_HEAD_ORRIFFICE_SENSOR, RpMessage, current_dying_head_flow_Q, 0); - if (abs(current_dying_head_flow_Q - SetPoint_Q) > 0.2) + while (abs(current_dying_head_flow_Q - SetPoint_Q) > 0.2) { volt = getBlowerState(); if (current_dying_head_flow_Q < SetPoint_Q) @@ -283,13 +320,15 @@ bool WHS_Set_Blower_Control_Closed_Loop(double SetPoint_Q) { /* increase blower voltage by large step: */ ReportWithPackageFilter(WasteFilter,"------------ increase blower voltage by large step:-----------------", __FILE__,__LINE__, volt, RpMessage, LARGE_STEP, 0); - WHS_Set_Volt_Blower_Control( volt + LARGE_STEP ); + //WHS_Set_Volt_Blower_Control( volt + LARGE_STEP );//call func :Control_Voltage_To_Blower + Control_Voltage_To_Blower(volt + LARGE_STEP); } else { /* increase blower voltage by small step: */ ReportWithPackageFilter(WasteFilter,"------------ increase blower voltage by large step:-----------------", __FILE__,__LINE__, volt, RpMessage, SMALL_STEP, 0); - WHS_Set_Volt_Blower_Control( volt + SMALL_STEP ); + //WHS_Set_Volt_Blower_Control( volt + SMALL_STEP ); + Control_Voltage_To_Blower(volt + SMALL_STEP); } } else @@ -298,13 +337,15 @@ bool WHS_Set_Blower_Control_Closed_Loop(double SetPoint_Q) { /* decrease blower voltage by large step: */ ReportWithPackageFilter(WasteFilter,"------------ decrease blower voltage by large step:-----------------", __FILE__,__LINE__, volt, RpMessage, LARGE_STEP, 0); - WHS_Set_Volt_Blower_Control(volt - LARGE_STEP); + //WHS_Set_Volt_Blower_Control(volt - LARGE_STEP); + Control_Voltage_To_Blower(volt - LARGE_STEP); } else { /* decrease blower voltage by small step: */ ReportWithPackageFilter(WasteFilter,"------------ decrease blower voltage by small step:-----------------", __FILE__,__LINE__, volt, RpMessage, SMALL_STEP, 0); - WHS_Set_Volt_Blower_Control( volt + SMALL_STEP ); + //WHS_Set_Volt_Blower_Control( volt - SMALL_STEP ); + Control_Voltage_To_Blower(volt - SMALL_STEP); } } } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c index a472fb9eb..f7fe99aed 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c @@ -37,7 +37,7 @@ bool D_TCA9546_Select_Channel(uint8_t TCA9546A_I2C_bus_number, uint8_t TCA9546A_ } Write_Buf[0]=chnl_number; status |= I2C_Write(TCA9546A_I2C_bus_number, TCA9546A_I2C_addr, Write_Buf, 1); - ReportWithPackageFilter(WasteFilter,"------------ Select I2C Channel (chnl_number)-----------------", __FILE__,__LINE__, chnl_number, RpMessage, status, 0); + // ReportWithPackageFilter(WasteFilter,"------------ Select I2C Channel (chnl_number)-----------------", __FILE__,__LINE__, chnl_number, RpMessage, status, 0); return status; } 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 117a20913..dfd49a71b 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 @@ -101,9 +101,6 @@ uint32_t Check_WHS_Type_Via_EEPROM() WHS_Type = WHS_TYPE_NEW; } - - //TODO to test and replace #ifdef Use_Head_Card with if(Head_Type != HEAD_TYPE_SYLKO_WITHOUT_CARD) - return status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c index dc92b6683..3ea703b93 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c +++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c @@ -430,8 +430,8 @@ uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callb Valve3WayControlId[_ValveId] = AddControlCallback("Valve3WayControlId", Valve3WayCallBackFunction, eOneSecond/*eHundredMillisecond*/, FPGA_GetDispenserValveBusyOCD,(IfTypeDisopenser*0x100+_ValveId), _ValveId, 0 ); if (Valve3WayControlId[_ValveId] == 0xFF) Report("Add control callback failed",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0); - else - Report("Add control callback",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0); +// else +// Report("Add control callback",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0); /*busy = */FPGA_GetDispenserValveBusyOCD(_ValveId,0); //Report("Set valve id, dir, busy",__FILE__,_ValveId,(int)direction,RpWarning,(int)busy,0); diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 6b5424d74..803a22cc4 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -298,6 +298,7 @@ int main(void) //Turn_the_Blower_On();//Turn on with the Default_Voltage ActivateChiller();//WHS Cooler SSR9 //ActivateHeadMagnet(); + Set_Speed_Sensor_TypeII_Registers(10,5);//set default values #endif I2C_ReadingTask_Init(); //EMAC_initEMAC(); @@ -337,11 +338,6 @@ int main(void) // //test_avi(); //example for shai - - -#ifndef EVALUATION_BOARD - //Set_Speed_Sensor_TypeII_Registers(2,2);//set default values -#endif //Read_Speed_Sensor_TypeII();//must be delay between Set_Speed_Sensor_TypeII_Registers to Read_Speed_Sensor_TypeII //Test_ADS120_Internal_Temperature_Sensor(0); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e5064ef70..2c7512129 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -606,7 +606,7 @@ uint32_t MillisecLowLoop(uint32_t tick) StartPT100 = TEMP_SENSE_ANALOG_DRYER_TEMP1; if (Ten_msTick) { - //Speed_Data = Calculate_Speed_Sensor_Velocity(); + Speed_Data = Read_Speed_Sensor_TypeII(); //MillisecReadFromTempSensor(Sensor_Read, NULL); //if (Sensor_Read++ >= MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID) Sensor_Read = 0; if(Machine_Idle_Mode == true) @@ -720,7 +720,7 @@ uint32_t MillisecLowLoop(uint32_t tick) } Trigger_WHS_PT100_Read_All(); Trigger_WHS_MAX11614_Read_allADC(); -// WHS_Blower_Avarege_ORF1(); //drier + WHS_Blower_Avarege_ORF1(); //drier WHS_Blower_Avarege_ORF3(); //head Trigger_WHSReadAllFanTacho (); } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 36d4505d0..63fe510c4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -314,12 +314,14 @@ uint32_t DiagnosticsLoadDigitalValues(void) DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR13_CTRL; DigitalOutputState[index++].value = ReadHeadMagnetBit(); - DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED3; - //DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTIN); + /*if (Head_Type == HEAD_TYPE_SYLKO) //rapid/pp machines + { + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED3; + DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTIN); - DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED4; - // indication of movement cause the switch in the tech board to change, also doesn't go through the task - //DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTOT); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED4; + DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTOT); + }*/ DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_FULL; DigitalOutputState[index++].value = WHS_IsContainerFull(); @@ -408,7 +410,7 @@ void DiagnosticTenMsecCollection(void) DiagnosticLoadDancerError(POOLER_DANCER,ThreadGetMotorCalculatedError(POOLER_DANCER)); DiagnosticLoadDancerError(FEEDER_DANCER,ThreadGetMotorCalculatedError(FEEDER_DANCER)); - //DiagnosticLoadSpeedSensor(getSensorSpeedData()); + DiagnosticLoadSpeedSensor(getSensorSpeedData()); } void DiagnosticOneMinuteCollection(void) { @@ -444,7 +446,7 @@ void DiagnosticOneMinuteCollection(void) } DiagnosticsMonitor.n_overalltemperature = 1; OverallTemperature = max(MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP1),MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP2)); - OverallTemperature = ((int)(MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP1))*1000 + (int)(MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP2))); + OverallTemperature = ((int)(MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP1))*10 + (int)(MillisecGetTemperatures(TEMP_SENSE_AN_ENCLOSURETEMP2)/100)); DiagnosticsMonitor.overalltemperature = &OverallTemperature; DiagnosticsMonitor.n_midtank1level = 1; @@ -794,7 +796,9 @@ void Diagnostic100msecCollection(void) } } + DiagnosticsMonitor.n_drierzone1heatercurrent = 1; HeatersCurrent[HEATER_DRYER_CURRENT_1][0] = Get_Heaters_Current(HEATER_DRYER_CURRENT_1); + DiagnosticsMonitor.n_drierzone2heatercurrent = 1; HeatersCurrent[HEATER_DRYER_CURRENT_2][0] = Get_Heaters_Current(HEATER_DRYER_CURRENT_2); /*dispenser1motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index f43cf8c56..6e4eed580 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -27,9 +27,9 @@ uint32_t CloseValveTimeout = 10; uint32_t OpenValveTimeout = 10; -#define DISPENSER_BUILD_PRESSURE_SPEED 900 -#define DISPENSER_BUILD_PRESSURE_LIMIT 1.5 -#define DISPENSER_BUILD_PRESSURE_TIMEOUT 60000 +#define DISPENSER_BUILD_PRESSURE_SPEED 940 +#define DISPENSER_BUILD_PRESSURE_LIMIT 1.0 +#define DISPENSER_BUILD_PRESSURE_TIMEOUT 120000 #define DISPENSER_BUILD_PRESSURE_LAG 50 #define DEFAULT_NANOLITER_PER_PULSE 2.34 uint32_t DispenserPrepareSpeed = DISPENSER_BUILD_PRESSURE_SPEED; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 14718ab0e..0c28ee564 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -519,12 +519,12 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { HW_Motor_Id = DispenserIdToMotorId[i]; - if (GetDispenserPressure(i) > DispenserPreparePressure*1.02) + if (GetDispenserPressure(i) > DispenserPreparePressure*1.05) { NumofReadyDispensers++; - CurrentDispenserSpeed[i] = 0; #ifdef SPECIAL_DISPENSERS MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[i] = 0; //Report("IDS stopped ready",__FILE__,i,(int)(DispenserPreparePressure*100),RpWarning,(int)NumofReadyDispensers,0); #else tempSpeed = CurrentDispenserSpeed[i]; @@ -569,7 +569,7 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) Report("pressureReady = true or timeout;",__FILE__,DispenserBuildTimeCounter,NumofReadyDispensers,RpWarning,(int)NumOfActiveDispensers,0); } } -#ifndef SPECIAL_DISPENSERS +//#ifndef SPECIAL_DISPENSERS else if (endOfPrepareWCF == false) { if ((DispenserBuildTimeCounter == PRESSURE_READ_TIME_GAP)&&(FirstBrushStop)) @@ -614,8 +614,11 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) segmentfirst_speed /= 100; DispenserSegmentReady[DispenserId] = false; //Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - //IDS_Dispenser_Start_Motor_and_Open_Valve(DispenserId,segmentfirst_speed,NULL); +#ifdef SPECIAL_DISPENSERS + IDS_Dispenser_Start_Motor_and_Open_Valve(DispenserId,segmentfirst_speed,NULL); +#else MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); +#endif CurrentDispenserSpeed[Dispenser_i] = segmentfirst_speed; usnprintf(IdMessage, 80, @@ -657,13 +660,13 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } } -#endif +/*#endif #ifdef SPECIAL_DISPENSERS if (pressureReady == true) -#else +#else*/ //start new stage if (endOfPrepareWCF == true) -#endif +//#endif { SafeRemoveControlCallback(DispenserPrepareControlId, IDS_Prepare_Callback ); DispenserPrepareControlId = 0xFF; @@ -785,6 +788,9 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) for (i = 0; i < MAX_DYE_DISPENSERS; i++) { dispenserspeed = DispenserPrepareSpeed; +#ifdef SPECIAL_DISPENSERS + dispenserspeed = 300; +#endif TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[i]; if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers @@ -1060,7 +1066,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); //cleaning return OK; } -#ifndef SPECIAL_DISPENSERS +//#ifndef SPECIAL_DISPENSERS if ((InterSegmentStartWFCFDispensers > 12000)&&(InterSegmentStartWFCFDispensers == (InterSegmentStepsCount+12000))) { //start prepare 4 seconds before wcf @@ -1141,7 +1147,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); //close waste valve one second before segment - trial Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); } -#endif +//#endif return OK; } uint32_t IDSCheckSegmentData(void *SegmentDetails, int SegmentId) diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 51fe807d8..d3a97bf3a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -107,64 +107,65 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) } } else - if((request->amount == 0x3E8) && (request->delay <= 0x0fff))// set WHS Blower speed 0x00-0xfff - { - if (WHS_Type == WHS_TYPE_NEW) + if((request->amount == 0x3E8) && (request->delay <= 0x0fff))// set WHS Blower speed 0x00-0xfff { - Trigger_SetWHSBlowerVoltage (request->delay); - response.progress = 0; - response.has_progress = true; - } //Trigger_WHS_Set_Volt_Blower_Control(request->delay); - } + if (WHS_Type == WHS_TYPE_NEW) + { + Trigger_SetWHSBlowerVoltage (request->delay); + response.progress = 0; + response.has_progress = false; + } + } else if (request->amount == 0x3E7) // set WHS Blower speed by Q value { if (WHS_Type == WHS_TYPE_NEW) { - Trigger_WHS_Set_Blower_Control_Closed_Loop (request->delay); + WHS_Set_Blower_Control_Closed_Loop (request->delay); response.progress = 0; - response.has_progress = true; - } //Trigger_WHS_Set_Volt_Blower_Control(request->delay); + response.has_progress = false; + } } - else if(request->amount == 0x3EA) - { - uint16_t tempu16 = 0; - if (WHS_Type == WHS_TYPE_NEW) - { - switch(request->delay )// set WHS Blower speed 0x00-0xfff - { - case 0: - get_orf_1(&tempu16); - break; - case 1: - get_orf_2(&tempu16); - break; - case 2: - get_orf_3(&tempu16); - break; - case 3: - get_vlev1(&tempu16); - break; - case 4: - get_vlev2(&tempu16); - break; - case 5: - get_gas_out(&tempu16); - break; - case 6: - get_cur_fan(&tempu16); - break; - case 7: - get_cur_vlv1(&tempu16); - break; - case 8: - tempu16 = 0; //get_cur_vlv2(&tempu16); - break; - default : - tempu16 = 0x500; //get_cur_vlv2(&tempu16); - break; + else + if(request->amount == 0x3EA) + { + uint16_t tempu16 = 0; + if (WHS_Type == WHS_TYPE_NEW) + { + switch(request->delay )// set WHS Blower speed 0x00-0xfff + { + case 0: + get_orf_1(&tempu16); + break; + case 1: + get_orf_2(&tempu16); + break; + case 2: + get_orf_3(&tempu16); + break; + case 3: + get_vlev1(&tempu16); + break; + case 4: + get_vlev2(&tempu16); + break; + case 5: + get_gas_out(&tempu16); + break; + case 6: + get_cur_fan(&tempu16); + break; + case 7: + get_cur_vlv1(&tempu16); + break; + case 8: + tempu16 = 0; //get_cur_vlv2(&tempu16); + break; + default : + tempu16 = 0x500; //get_cur_vlv2(&tempu16); + break; + } } - } response.progress = (double)tempu16; response.has_progress = true; } @@ -511,7 +512,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) if((request->amount == 0x0CE) && (request->delay == 0x0CE)) //Get Gas Sensor { LOG_ERROR(request->delay,"FlashInitAndLoad"); - FlashInitAndLoad(); + FlashInit(); response.progress = (double)OK; response.has_progress = true; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index fd48e799a..1dd101f82 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -28,6 +28,7 @@ #include "drivers/Heater/Heater.h" #include "drivers/Motors/Motor.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" +#include "drivers/FPGA/FPGA_SPI_Comm.h" #include "modules/heaters/heaters.h" #include "modules/General/process.h" #include "modules/ids/ids_ex.h" @@ -117,8 +118,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea if (Current_Read < Previous_Read) { - ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0); Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1; + ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,Time_Pass,(int)Current_Read,RpWarning,(int)Previous_Read,0); } else Time_Pass = Current_Read - Previous_Read; @@ -178,7 +179,10 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) initialpos = 0; } prevprev = PreviousPosition; - positionDiff = Control_Delta_Position_Pass(CurrentPosition,PreviousPosition); + if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction + positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition); + else + positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; PreviousPosition = CurrentPosition; @@ -268,7 +272,10 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) Poolerinitialpos = 0; } prevprev = PoolerPreviousPosition; - positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); + if (Extended_Motor_Param[ThreadMotorIdToMotorId[index]] == true) //powerstep driver reverses the direction + positionDiff = Control_Delta_Position_Pass(PoolerPreviousPosition,PoolerCurrentPosition); + else + positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; PoolerPreviousPosition = PoolerCurrentPosition; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index d1f667405..92ab2b43c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -28,6 +28,7 @@ #include "drivers/I2C_Communication/DAC/Blower.h" #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" +#include "drivers/adc_sampling/adc.h" #include "drivers/Valves/Valve.h" #include "heaters/heaters_ex.h" @@ -39,6 +40,7 @@ INIT_SEQUENCE_BUILT_IN_TEST, INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION, //INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST, + INIT_SEQUENCE_POWER_MANAGEMENT_INIT, INIT_SEQUENCE_WAIT_FOR_COOLER, INIT_SEQUENCE_THREAD_DETECTION, INIT_SEQUENCE_START_HEATING, @@ -208,6 +210,140 @@ uint32_t InitSequenceBlowerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //InitSequenceStateMachine(InitStages); return OK; } +/////////////////////////////////////////////////////////////////////////////////////////////////////// +#define MAX_CURRENT_READING 5 +#define CURRENT_READING_ERROR_UNSTABLE 100 +int Heater_Current[MAX_CURRENT_READING] ; +bool initial_wait = false; +int count_Heater_Current = 0; +int Maxcount_Heater_Current = 0; +bool MainHeaterStable = false,SecondaryHeaterStable = false; +double MainCurrent,SecondaryCurrent,StableCurrent; +double InitDrierAcVoltage = 0.0; +int InitDrierAcVoltageCount = 0; +double Zone2Resistance = 0.0; +void InitCurrentReadingStable(void) +{ + memset(Heater_Current,0,sizeof(Heater_Current)); + initial_wait = false; + count_Heater_Current = 0; + Maxcount_Heater_Current = 0; + StableCurrent = 0.0; +} + +bool DetectIfCurrentReadingStable(double HeaterCurrent) +{ + bool ret = false; + int i=0; + int sum = 0; + int average = 0; + + Maxcount_Heater_Current++; + Heater_Current[count_Heater_Current++] = HeaterCurrent; + if ( count_Heater_Current >= MAX_CURRENT_READING) + { + count_Heater_Current = 0; + initial_wait = true; + } + if (initial_wait == false) + return false; + for (i=0;i<MAX_CURRENT_READING;i++) + sum += Heater_Current[i]; + average = sum/MAX_CURRENT_READING; + if (fabs(average - HeaterCurrent)<0.2) + { + ret = true; + StableCurrent = average; + } + return ret; +} +double GetZone2RMSCurrent(double VAC) +{ + return (VAC/Zone2Resistance); +} +uint32_t PowerManagementCallBack(uint32_t IfIndex, uint32_t BusyFlag) +{ + ReportWithPackageFilter(InitFilter,"PowerManagementCallBack", __FILE__,MainHeaterStable,(int)(SecondaryHeaterStable), RpMessage, Maxcount_Heater_Current, 0); + ReportWithPackageFilter(InitFilter,"PowerManagementCallBack", __FILE__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(int)(GetHeaterState(HEATER_TYPE__DryerSecondaryHeater)), RpMessage, Maxcount_Heater_Current, 0); + + if ((MainHeaterStable == false)&&(Maxcount_Heater_Current<CURRENT_READING_ERROR_UNSTABLE)) + { + InitDrierAcVoltage += ReadVAC(); + InitDrierAcVoltageCount++; + ReportWithPackageFilter(InitFilter,"main heater current not stable", __FILE__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + MainHeaterStable = DetectIfCurrentReadingStable(Get_Heaters_Current(HEATER_DRYER_CURRENT_1)); + Read_Heaters_Current(HEATER_DRYER_CURRENT_1); + if (MainHeaterStable == true) + { + ReportWithPackageFilter(InitFilter,"main heater current stable", __FILE__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + InitDrierAcVoltage /= InitDrierAcVoltageCount; + MainCurrent = StableCurrent; + InitCurrentReadingStable(); + DeActivateHeater(HEATER_TYPE__DryerMainHeater); + ActivateHeater(HEATER_TYPE__DryerSecondaryHeater); + ReportWithPackageFilter(InitFilter,"starting secondary heater ", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + } + } + else + { + DeActivateHeater(HEATER_TYPE__DryerMainHeater); + if (Maxcount_Heater_Current>=CURRENT_READING_ERROR_UNSTABLE) + { + ReportWithPackageFilter(InitFilter,"drier heaters current not stable", __FILE__,GetHeaterState(HEATER_TYPE__DryerSecondaryHeater),(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + if (SafeRemoveControlCallback(HWControlId, PowerManagementCallBack )==OK) + HWControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)PowerManagementCallBack,0); + AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_HEATERS_ZONE_1_CURRENT_OUT_OF_RANGE,ON); + DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater); + DeActivateHeater(HEATER_TYPE__DryerMainHeater); + InitStages++; + } + else //go to secondary + { + if ((SecondaryHeaterStable == false)&&(Maxcount_Heater_Current<CURRENT_READING_ERROR_UNSTABLE)) + { + SecondaryHeaterStable = DetectIfCurrentReadingStable(Get_Heaters_Current(HEATER_DRYER_CURRENT_2)); + Read_Heaters_Current(HEATER_DRYER_CURRENT_2); + if (SecondaryHeaterStable == true) + { + ReportWithPackageFilter(InitFilter,"main heater current stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + SecondaryCurrent = StableCurrent; + InitCurrentReadingStable(); + DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater); + //do stuff for RMS 2 + Zone2Resistance = InitDrierAcVoltage/SecondaryCurrent; + } + } + else + { + if (SafeRemoveControlCallback(HWControlId, PowerManagementCallBack )==OK) + HWControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)PowerManagementCallBack,0); + DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater); + DeActivateHeater(HEATER_TYPE__DryerMainHeater); + if (Maxcount_Heater_Current>=CURRENT_READING_ERROR_UNSTABLE) + AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_HEATERS_ZONE_2_CURRENT_OUT_OF_RANGE,ON); + InitStages++; + } + } + } +return OK; +} +uint32_t InitSequencePowerManagementInit(void) +{ + if ((Head_Type >= HEAD_TYPE_SYLKO)&&(WHS_Type == WHS_TYPE_NEW)) + { + InitCurrentReadingStable(); + ActivateHeater(HEATER_TYPE__DryerMainHeater); + HWControlId = AddControlCallback("Init Power", PowerManagementCallBack, eHundredMillisecond, TemplateDataReadCBFunction,0,0, 0 ); + ReportWithPackageFilter(InitFilter,"starting main heater ", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + } + else + InitStages++; + return OK; +} uint32_t InitSequenceInitialBlowerActivation(void) { MachineStateDetail = MACHINE_STATE_INITIAL_BLOWER_ACTIVATION; @@ -260,13 +396,13 @@ uint32_t InitSequenceDispenserPressureBuildUpTest(void) } uint32_t InitSequenceWaitForCoolerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) { - InitStages++; MachineStateDetail = INIT_SEQUENCE_WAIT_FOR_COOLER; if (SafeRemoveControlCallback(HWControlId, InitSequenceWaitForCoolerCallBackFunction )==OK) HWControlId = 0xFF; else Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceWaitForCoolerCallBackFunction,0); + InitStages++; return OK; } uint32_t InitSequenceWaitForCooler(void) @@ -286,7 +422,8 @@ uint32_t InitSequenceWaitForCooler(void) else { //cold reset, wait 2 minutes for cooler start - HWControlId = AddControlCallback("Init Cooler", InitSequenceWaitForCoolerCallBackFunction, 2*eOneMinute, TemplateDataReadCBFunction,0,0, 0 ); +// HWControlId = AddControlCallback("Init Cooler", InitSequenceWaitForCoolerCallBackFunction, 2*eOneMinute, TemplateDataReadCBFunction,0,0, 0 ); + HWControlId = AddControlCallback("Init Cooler", InitSequenceWaitForCoolerCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); } //InitSequenceStateMachine(InitStages); return OK; @@ -385,6 +522,9 @@ uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue) case INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION: InitSequenceInitialBlowerActivation(); break; + case INIT_SEQUENCE_POWER_MANAGEMENT_INIT: + InitSequencePowerManagementInit(); + break; /*case INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST: InitSequenceDispenserPressureBuildUpTest(); break;*/ diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h index 105537721..f65329c4b 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h @@ -33,6 +33,7 @@ void StopInitSequence(void); MACHINE_STATE_STAGES_ENUM GetMachineState(void); void SetMachineState(MACHINE_STATE_STAGES_ENUM); void InitSequenceSetStartHeating(bool StartHeating); +double GetZone2RMSCurrent(double VAC); #endif /* STATEMACHINES_INITIALIZATION_INITSEQUENCE_H_ */ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt Binary files differindex a603ff06b..993ced97e 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index ac9082375..d21e2ee6f 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ <ROW Property="ARPNOREPAIR" Value="1" MultiBuildValue="DefaultBuild:1"/> <ROW Property="ARPSYSTEMCOMPONENT" Value="1"/> <ROW Property="Manufacturer" Value="Twine"/> - <ROW Property="ProductCode" Value="1033:{BBF28749-C123-45E3-BD2B-D51E370CFB69} " Type="16"/> + <ROW Property="ProductCode" Value="1033:{14D84E94-E7CF-45AC-BD73-E38F2678C828} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductName" Value="Tango"/> - <ROW Property="ProductVersion" Value="1.1.0.0" Type="32"/> + <ROW Property="ProductVersion" Value="1.1.1.0" Type="32"/> <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/> <ROW Property="UpgradeCode" Value="{F8EAB8B4-FD57-45B7-8307-D52DF760273D}"/> <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/> @@ -415,7 +415,7 @@ <ROW Action="AI_DetectSoftware" Sequence="101"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent"> - <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.1.0"/> + <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.1.1"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent"> <ROW Path="<AI_DICTS>ui.ail"/> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs index d277d0bdb..a1c67ee44 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; +using System.Windows.Input; using Tango.BL; using Tango.Core.DI; using Tango.FSE.Common.Authentication; @@ -198,6 +200,23 @@ namespace Tango.FSE.Common { } + + protected override void RaisePropertyChanged(string propName) + { + base.RaisePropertyChanged(propName); + + if (propName == nameof(IsFree)) + { + if (IsFree) + { + Mouse.OverrideCursor = null; + } + else + { + Mouse.OverrideCursor = Cursors.AppStarting; + } + } + } } /// <summary> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Images/twine_logo_colored.png b/Software/Visual_Studio/FSE/Tango.FSE.Common/Images/twine_logo_colored.png Binary files differnew file mode 100644 index 000000000..2204585dc --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Images/twine_logo_colored.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml index e3ac57536..8bb175e3e 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml @@ -5,7 +5,12 @@ <FontFamily x:Key="digital-7">../Fonts/#digital-7</FontFamily> <FontFamily x:Key="flexo">../Fonts/#flexo</FontFamily> - + + <sys:Double x:Key="FSE_DefaultFontSize">14</sys:Double> + <sys:Double x:Key="FSE_SmallFontSize">12</sys:Double> + <sys:Double x:Key="FSE_SmallerFontSize">10</sys:Double> + <sys:Double x:Key="FSE_LargeFontSize">16</sys:Double> + <sys:Double x:Key="FSE_LargerFontSize">18</sys:Double> <sys:Double x:Key="FSE_MessageBoxTitleFontSize">16</sys:Double> - + </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Images.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Images.xaml index f72ae5675..c46d10ce5 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Images.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Images.xaml @@ -6,5 +6,6 @@ <BitmapImage x:Key="FSE_Machine_Small" UriSource="../Images/machine_small.png" /> <BitmapImage x:Key="FSE_Machine_Full" UriSource="../Images/machine_full.png" /> <BitmapImage x:Key="FSE_Twine_Logo" UriSource="../Images/twine_logo.png" /> + <BitmapImage x:Key="FSE_Twine_Logo_Colored" UriSource="../Images/twine_logo_colored.png" /> </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index 2b8f0db0b..20c39d161 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -207,6 +207,9 @@ <ItemGroup> <Resource Include="Images\twine_logo.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\twine_logo_colored.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PreBuildEvent>nswag run "$(SolutionDir)Web\Tango.MachineService.Gateway\Nswag\GatewayClient.nswag" /variables:assembly="$(SolutionDir)Web\Tango.MachineService.Gateway\bin\Tango.MachineService.Gateway.dll",output="$(ProjectDir)Gateway\GatewayClient.cs"</PreBuildEvent> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Contracts/ILayoutView.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Contracts/ILayoutView.cs new file mode 100644 index 000000000..f6ba9f200 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Contracts/ILayoutView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; + +namespace Tango.FSE.UI.Contracts +{ + public interface ILayoutView : IFSEView + { + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-emulator.png b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-emulator.png Binary files differnew file mode 100644 index 000000000..254fc819a --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-emulator.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-signalr.png b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-signalr.png Binary files differnew file mode 100644 index 000000000..bda45ffd2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-signalr.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-tcp.png b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-tcp.png Binary files differnew file mode 100644 index 000000000..04e47f539 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-tcp.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-usb.png b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-usb.png Binary files differnew file mode 100644 index 000000000..07814e7de --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-usb.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/login_white.png b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/login_white.png Binary files differnew file mode 100644 index 000000000..10a054147 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/login_white.png diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml index 202476e90..059b2e277 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml @@ -13,7 +13,7 @@ TextElement.Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" TextElement.FontWeight="Medium" - TextElement.FontSize="14" + TextElement.FontSize="{StaticResource FSE_DefaultFontSize}" TitleCharacterCasing="Normal" UseNoneWindowStyle="True" EnableDWMDropShadow="True" MinWidth="800" MinHeight="600" BorderThickness="1" BorderBrush="Gray" FontFamily="{StaticResource flexo}" WindowTitleBrush="{StaticResource PrimaryHueMidBrush}"> <Grid> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml new file mode 100644 index 000000000..d309d3599 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml @@ -0,0 +1,94 @@ +<UserControl x:Class="Tango.FSE.UI.Panes.MachineConnectionPane" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.FSE.UI.Panes" + mc:Ignorable="d" + d:DesignHeight="600" d:DesignWidth="350" d:DataContext="{d:DesignInstance Type=local:MachineConnectionPaneVM, IsDesignTimeCreatable=False}"> + <Grid> + <DockPanel> + <Button Command="{Binding ConnectToMachineCommand}" DockPanel.Dock="Bottom" Height="50" Margin="5" material:ButtonAssist.CornerRadius="25"> + CONNECT + </Button> + <UniformGrid Rows="3"> + <Grid Margin="0 10"> + <DockPanel> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" DockPanel.Dock="Top" Text="Scanning for machines on local serial ports..."></TextBlock> + <ProgressBar DockPanel.Dock="Top" Height="2" IsIndeterminate="True" Margin="0 3 0 0" /> + <ListBox ItemsSource="{Binding UsbMachines}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" PreviewMouseDoubleClick="ListBox_PreviewMouseDoubleClick"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/Connections/external-bridge-usb.png" Height="35" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">Port:</Run> <Run Text="{Binding ComPort,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">Device:</Run> <Run Text="{Binding Device,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </DockPanel> + </Grid> + <Grid Margin="0 10"> + <DockPanel> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" DockPanel.Dock="Top" Text="Scanning for machines on your local network..."></TextBlock> + <ProgressBar DockPanel.Dock="Top" Height="2" IsIndeterminate="True" Margin="0 3 0 0" /> + <ListBox ItemsSource="{Binding TcpMachines}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" PreviewMouseDoubleClick="ListBox_PreviewMouseDoubleClick"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/Connections/external-bridge-tcp.png" Height="35" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">IP Address:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Machine.Organization.Name,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </DockPanel> + </Grid> + <Grid Margin="0 10"> + <DockPanel> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" DockPanel.Dock="Top" Text="Scanning for machines over the internet..."></TextBlock> + <ProgressBar DockPanel.Dock="Top" Height="2" IsIndeterminate="True" Margin="0 3 0 0" /> + <ListBox ItemsSource="{Binding SignalRMachines}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" PreviewMouseDoubleClick="ListBox_PreviewMouseDoubleClick"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/Connections/external-bridge-signalr.png" Height="35" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">Hub:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}"> + <Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Machine.Organization.Name,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </DockPanel> + </Grid> + </UniformGrid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml.cs new file mode 100644 index 000000000..6e0a5e74f --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI.Panes +{ + /// <summary> + /// Interaction logic for MachineConnectionPane.xaml + /// </summary> + public partial class MachineConnectionPane : UserControl + { + public MachineConnectionPane() + { + InitializeComponent(); + } + + private void ListBox_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + var vm = DataContext as MachineConnectionPaneVM; + if (vm != null) + { + vm.SelectedMachine = (sender as ListBox).SelectedItem as Integration.ExternalBridge.IExternalBridgeClient; + vm.ConnectToMachine(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs new file mode 100644 index 000000000..37cf9b70f --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.ExternalBridge; +using Tango.SharedUI; + +namespace Tango.FSE.UI.Panes +{ + public class MachineConnectionPaneVM : ViewModel + { + private ExternalBridgeScanner _scanner; + + public event EventHandler<IExternalBridgeClient> MachineSelected; + + public ObservableCollection<ExternalBridgeUsbClient> UsbMachines { get; set; } + + public ObservableCollection<ExternalBridgeTcpClient> TcpMachines { get; set; } + + public ObservableCollection<ExternalBridgeSignalRClient> SignalRMachines { get; set; } + + public RelayCommand ConnectToMachineCommand { get; set; } + + private IExternalBridgeClient _selectedMachine; + public IExternalBridgeClient SelectedMachine + { + get { return _selectedMachine; } + set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public MachineConnectionPaneVM() + { + ConnectToMachineCommand = new RelayCommand(ConnectToMachine, () => SelectedMachine != null); + + UsbMachines = new ObservableCollection<ExternalBridgeUsbClient>(); + TcpMachines = new ObservableCollection<ExternalBridgeTcpClient>(); + SignalRMachines = new ObservableCollection<ExternalBridgeSignalRClient>(); + + _scanner = new ExternalBridgeScanner(); + _scanner.MachineDiscovered += _scanner_MachineDiscovered; + _scanner.MachineLost += _scanner_MachineLost; + } + + internal void ConnectToMachine() + { + if (SelectedMachine != null) + { + MachineSelected?.Invoke(this, SelectedMachine); + } + } + + private void _scanner_MachineLost(object sender, IExternalBridgeClient machine) + { + InvokeUI(() => + { + if (machine is ExternalBridgeUsbClient) + { + UsbMachines.Remove(machine as ExternalBridgeUsbClient); + } + else if (machine is ExternalBridgeTcpClient) + { + TcpMachines.Remove(machine as ExternalBridgeTcpClient); + } + else if (machine is ExternalBridgeSignalRClient) + { + SignalRMachines.Remove(machine as ExternalBridgeSignalRClient); + } + }); + } + + private void _scanner_MachineDiscovered(object sender, IExternalBridgeClient machine) + { + InvokeUI(() => + { + if (machine is ExternalBridgeUsbClient) + { + UsbMachines.Add(machine as ExternalBridgeUsbClient); + } + else if (machine is ExternalBridgeTcpClient) + { + TcpMachines.Add(machine as ExternalBridgeTcpClient); + } + else if (machine is ExternalBridgeSignalRClient) + { + SignalRMachines.Add(machine as ExternalBridgeSignalRClient); + } + }); + } + + public void Start() + { + TcpMachines.Clear(); + SignalRMachines.Clear(); + SelectedMachine = null; + + _scanner.Start(); + } + + public void Stop() + { + _scanner.Stop(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index 825902774..2a242d226 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -84,6 +84,7 @@ <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="Contracts\ILayoutView.cs" /> <Compile Include="Gateway\DefaultGatewayService.cs" /> <Compile Include="InternalModule.cs" /> <Compile Include="Modules\DefaultFSEModuleLoader.cs" /> @@ -92,6 +93,10 @@ <Compile Include="Notifications\DefaultNotificationProvider.cs" /> <Compile Include="Notifications\DialogAndView.cs" /> <Compile Include="Notifications\PendingNotification.cs" /> + <Compile Include="Panes\MachineConnectionPane.xaml.cs"> + <DependentUpon>MachineConnectionPane.xaml</DependentUpon> + </Compile> + <Compile Include="Panes\MachineConnectionPaneVM.cs" /> <Compile Include="Threading\DefaultDispatcherProvider.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\DashboardViewVM.cs" /> @@ -130,6 +135,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> + <Page Include="Panes\MachineConnectionPane.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\DashboardView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -191,6 +200,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206AC58-3B57-4699-8835-90BF6DB01A61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> @@ -230,6 +243,15 @@ <ItemGroup> <Resource Include="Images\login.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\Connections\external-bridge-emulator.png" /> + <Resource Include="Images\Connections\external-bridge-signalr.png" /> + <Resource Include="Images\Connections\external-bridge-tcp.png" /> + <Resource Include="Images\Connections\external-bridge-usb.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\login_white.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> 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 13d2baff0..6623f7aba 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs @@ -1,14 +1,66 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; using Tango.FSE.Common; +using Tango.FSE.UI.Panes; +using Tango.Integration.ExternalBridge; namespace Tango.FSE.UI.ViewModels { public class LayoutViewVM : FSEViewModel { + private bool _isConnectionPaneOpened; + public bool IsConnectionPaneOpened + { + get { return _isConnectionPaneOpened; } + set { _isConnectionPaneOpened = value; RaisePropertyChangedAuto(); OnConnectionPaneToggleChanged(); } + } + + private MachineConnectionPaneVM _connectionPaneVM; + public MachineConnectionPaneVM ConnectionPaneVM + { + get { return _connectionPaneVM; } + set { _connectionPaneVM = value; RaisePropertyChangedAuto(); } + } + + private bool _isMenuOpened; + public bool IsMenuOpened + { + get { return _isMenuOpened; } + set { _isMenuOpened = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ToggleConnectionPaneCommand { get; set; } + + public LayoutViewVM() + { + ToggleConnectionPaneCommand = new RelayCommand(() => IsConnectionPaneOpened = !IsConnectionPaneOpened); + ConnectionPaneVM = new MachineConnectionPaneVM(); + ConnectionPaneVM.MachineSelected += ConnectionPaneVM_MachineSelected; + } + + private void ConnectionPaneVM_MachineSelected(object sender, IExternalBridgeClient machine) + { + IsConnectionPaneOpened = false; + Debug.WriteLine($"Machine selected for connection: {machine.ToString()}"); + } + + private void OnConnectionPaneToggleChanged() + { + if (IsConnectionPaneOpened) + { + ConnectionPaneVM.Start(); + } + else + { + ConnectionPaneVM.Stop(); + } + } + public override void OnApplicationStarted() { diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml index cd764c77d..4806ab006 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml @@ -4,21 +4,74 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.FSE.UI" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.FSE.UI.ViewModels" xmlns:local="clr-namespace:Tango.FSE.UI.Views" + xmlns:panes="clr-namespace:Tango.FSE.UI.Panes" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LayoutViewVM}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> - <Grid> + d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LayoutViewVM}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> + <Grid x:Name="gridMain"> <Grid Margin="70 0 0 0"> <Grid.RowDefinitions> <RowDefinition Height="90"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <controls:NavigationControl x:Name="NavigationControl" Grid.Row="1"> - </controls:NavigationControl> + <Grid Grid.Row="1"> + <controls:NavigationControl x:Name="NavigationControl"> + <!--MODULES--> + </controls:NavigationControl> + + <Grid x:Name="paneMask" Background="{StaticResource FSE_SemiTransparentBrush}" Visibility="{Binding IsConnectionPaneOpened,Converter={StaticResource BooleanToVisibilityConverter}}"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding ToggleConnectionPaneCommand}" /> + </i:EventTrigger> + </i:Interaction.Triggers> + </Grid> + + <!--Right Panes--> + <Border x:Name="paneConnection" Padding="5" BorderBrush="{StaticResource FSE_BorderBrush}" BorderThickness="1 0 0 0" Width="350" HorizontalAlignment="Right" Visibility="{Binding IsConnectionPaneOpened,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border.Background> + <ImageBrush ImageSource="/Images/abstracts/abstract1.png" Stretch="UniformToFill" Opacity="0.3" /> + </Border.Background> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsConnectionPaneOpened}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" To="450" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Border.Effect> + <DropShadowEffect Direction="-180" Opacity="0.5" /> + </Border.Effect> + + <panes:MachineConnectionPane DataContext="{Binding ConnectionPaneVM}" /> + </Border> + <!--Right Panes--> + </Grid> <!--Top Bar--> <Grid Background="{StaticResource FSE_PrimaryBackgroundLightBrush}"> @@ -26,33 +79,134 @@ <DropShadowEffect BlurRadius="10" /> </Grid.Effect> - <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> - <Button IsEnabled="{Binding NavigationManager.CanNavigateBack}" Command="{Binding NavigationManager.NavigateBackCommand}" Padding="25" Height="Auto" Width="90" Style="{StaticResource MaterialDesignToolForegroundButton}"> - <material:PackIcon Kind="ArrowBack" Width="Auto" Height="Auto" /> - </Button> - <!--<TextBlock Margin="10 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20">Tango FSE</TextBlock>--> - </StackPanel> + <Polygon HorizontalAlignment="Right" Points="220,0 300,0 300,100 0,100" Width="350" Stretch="Fill"> + <Polygon.Fill> + <ImageBrush Viewport="0 0 800 300" ViewportUnits="Absolute" ImageSource="/Images/abstracts/abstract1.png" Stretch="None" Opacity="0.6" /> + </Polygon.Fill> + </Polygon> + + <DockPanel> + <StackPanel DockPanel.Dock="Left" HorizontalAlignment="Left" Orientation="Horizontal"> + <Button IsEnabled="{Binding NavigationManager.CanNavigateBack}" Command="{Binding NavigationManager.NavigateBackCommand}" Padding="20" Height="Auto" Width="90" Style="{StaticResource MaterialDesignToolForegroundButton}"> + <material:PackIcon Kind="ArrowBack" Width="Auto" Height="Auto" /> + </Button> + </StackPanel> + <StackPanel DockPanel.Dock="Left" Margin="10 0 0 0" Orientation="Horizontal" VerticalAlignment="Center"> + <Image Source="/Images/login_white.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> + <StackPanel Margin="0 5 0 0"> + <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> + <TextBlock FontSize="12" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" Margin="10 5 0 0" VerticalAlignment="Center"> + <Run Text="{Binding AuthenticationProvider.CurrentUser.Organization.Name}"></Run> + , + <Run Text="{Binding AuthenticationProvider.CurrentUser.Roles[0].Name}"> + <Run.ToolTip> + <ItemsControl ItemsSource="{Binding AuthenticationProvider.CurrentUser.Roles}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="2"> + <material:PackIcon Kind="AccountKey" Width="16" Height="16" /> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Run.ToolTip> + </Run> + <Run>...</Run> + </TextBlock> + </StackPanel> + </StackPanel> + <StackPanel DockPanel.Dock="Right" Margin="0 40 80 15" Orientation="Horizontal"> + <Button Command="{Binding ToggleConnectionPaneCommand}" Style="{StaticResource MaterialDesignRaisedLightButton}" VerticalAlignment="Center" Height="Auto"> + <StackPanel Orientation="Horizontal"> + <Image Source="{StaticResource FSE_Machine_Small}" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center">Machine Connection</TextBlock> + </StackPanel> + </Button> + </StackPanel> + <Grid> + <Image HorizontalAlignment="Center" Source="{StaticResource FSE_Twine_Logo_Colored}" RenderOptions.BitmapScalingMode="Fant" Margin="5 5 5 10"></Image> + </Grid> + </DockPanel> </Grid> <!--Top Bar--> - <Grid x:Name="gridMask" Visibility="Hidden" Grid.RowSpan="2" Background="{StaticResource FSE_SemiTransparentBrush}" Opacity="0" IsHitTestVisible="False"> - + <Grid x:Name="gridMask" Visibility="Hidden" Grid.RowSpan="2" Background="{StaticResource FSE_SemiTransparentBrush}" IsHitTestVisible="False"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Opacity" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMenuOpened}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> </Grid> </Grid> - <Grid HorizontalAlignment="Left" x:Name="gridMenu" Width="70" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <!-- Side Menu--> + <Grid HorizontalAlignment="Left" x:Name="gridMenu" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Width" Value="70"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMenuOpened}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Width" To="200" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Width" To="70" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> <Grid.RowDefinitions> <RowDefinition Height="90"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Image x:Name="imgBack" Source="/Images/abstracts/abstract1.png" Grid.RowSpan="2" Stretch="None" Opacity="0.6"></Image> - + <Image x:Name="imgBack" Source="/Images/abstracts/abstract1.png" Grid.RowSpan="2" VerticalAlignment="Top" Stretch="UniformToFill" Opacity="0.6" Height="{Binding ElementName=gridMain,Path=ActualHeight}"></Image> + + <Path Grid.RowSpan="2" VerticalAlignment="Top" Height="500" Fill="{StaticResource FSE_PrimaryBackgroundLightBrush}"> + <Path.Data> + <PathGeometry> + <PathFigure StartPoint="0,0" IsClosed="True"> + <LineSegment x:Name="polyTopRight" Point="70,0" /> + <LineSegment x:Name="polyBottomRight" Point="70,300" /> + <LineSegment x:Name="polyBottomLeft" Point="0,100" /> + </PathFigure> + </PathGeometry> + </Path.Data> + </Path> + <Grid> <Image Source="{StaticResource FSE_Machine_Full}" Stretch="Uniform" RenderOptions.BitmapScalingMode="Fant" Margin="10" /> </Grid> - <Rectangle HorizontalAlignment="Right" Grid.RowSpan="2" StrokeThickness="1" Stroke="{StaticResource FSE_BorderBrush}" StrokeDashArray="5" /> + <Rectangle HorizontalAlignment="Right" Grid.RowSpan="2" StrokeThickness="1" Stroke="{StaticResource FSE_BorderBrush}" StrokeDashArray="5" Margin="0 90 0 0" /> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs index fdafee3b1..2ec734c71 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs @@ -9,24 +9,31 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.FSE.UI.Contracts; +using Tango.FSE.UI.ViewModels; namespace Tango.FSE.UI.Views { /// <summary> /// Interaction logic for LayoutView.xaml /// </summary> - public partial class LayoutView : UserControl + public partial class LayoutView : UserControl, ILayoutView { public static LayoutView Instance { get; set; } + private LayoutViewVM _vm; + public LayoutView() { Instance = this; InitializeComponent(); + Loaded += (_, __) => _vm = DataContext as LayoutViewVM; + gridMask.Visibility = Visibility.Visible; gridMenu.MouseEnter += GridMenu_MouseEnter; gridMenu.MouseLeave += GridMenu_MouseLeave; @@ -34,16 +41,26 @@ namespace Tango.FSE.UI.Views private void GridMenu_MouseLeave(object sender, MouseEventArgs e) { - gridMenu.StartDoubleAnimation(Grid.WidthProperty, TimeSpan.FromSeconds(0.2), 70); - imgBack.StartDoubleAnimation(Image.OpacityProperty, TimeSpan.FromSeconds(0.2), 0.6); - gridMask.StartDoubleAnimation(Image.OpacityProperty, TimeSpan.FromSeconds(0.2), 0); + _vm.IsMenuOpened = false; + + StartPointAnimation(polyTopRight, new Point(70, 0)); + StartPointAnimation(polyBottomRight, new Point(70, 300)); } private void GridMenu_MouseEnter(object sender, MouseEventArgs e) { - gridMenu.StartDoubleAnimation(Grid.WidthProperty, TimeSpan.FromSeconds(0.2), 200); - imgBack.StartDoubleAnimation(Image.OpacityProperty, TimeSpan.FromSeconds(0.2), 0.2); - gridMask.StartDoubleAnimation(Image.OpacityProperty, TimeSpan.FromSeconds(0.2), 1); + _vm.IsMenuOpened = true; + + StartPointAnimation(polyTopRight, new Point(200, 0)); + StartPointAnimation(polyBottomRight, new Point(200, 400)); + } + + private void StartPointAnimation(LineSegment segment, Point to) + { + PointAnimation ani = new PointAnimation(); + ani.Duration = TimeSpan.FromSeconds(0.2); + ani.To = to; + segment.BeginAnimation(LineSegment.PointProperty, ani); } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index defd65d6e..abe2fab7d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -42,10 +42,35 @@ <Image Source="../Images/JobView/error.png" Stretch="None" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}" /> <Ellipse Width="60" Height="60" Margin="20 0 0 0" Fill="{Binding InvalidBrushStop.Brush}" /> <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="RGB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run Text="{Binding InvalidBrushStop.Red}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Green}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Blue}"></Run> </TextBlock> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="LAB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + <Run Text="{Binding InvalidBrushStop.L,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding InvalidBrushStop.A,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding InvalidBrushStop.B,StringFormat=0.00}"></Run> + </TextBlock> </StackPanel> <DockPanel Grid.Row="2" Margin="0 0 0 0"> 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 f07c20aa9..c394bbfa1 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 @@ -760,15 +760,8 @@ namespace Tango.PPC.Jobs.ViewModels { draggedSegment.SegmentIndex = droppedSegment.SegmentIndex + 1; } - - int index = 1; - - foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) - { - segment.SegmentIndex = index++; - } - - SegmentsCollectionView.Refresh(); + + ArrangeSegmentsIndices(); } /// <summary> @@ -831,10 +824,14 @@ namespace Tango.PPC.Jobs.ViewModels private void ArrangeSegmentsIndices() { - for (int i = 0; i < Job.Segments.Count; i++) + int index = 1; + + foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) { - Job.Segments[i].SegmentIndex = i + 1; + segment.SegmentIndex = index++; } + + SegmentsCollectionView.Refresh(); } #endregion @@ -982,7 +979,7 @@ namespace Tango.PPC.Jobs.ViewModels [HandleProcessCorruptedStateExceptions] public void OnBrushStopFieldValueChanged(BrushStop stop) { - if (stop != null) + if (stop != null && stop.ColorSpace != null) { stop.Corrected = false; stop.OutOfGamutChecked = false; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index c04c13ea1..557576d22 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -631,7 +631,6 @@ <touch:TouchToggleImageButton x:Name="toggleEdit" UncheckedImage="../Images/pencil-gray.png" CheckedImage="../Images/pencil-blue.png" DockPanel.Dock="Right" - IsChecked="{Binding IsSelected}" Padding="8" CornerRadius="30" Width="40" Height="40"> </touch:TouchToggleImageButton> <!--<touch:TouchToggleIconButton x:Name="toggleEdit" DockPanel.Dock="Right" Icon="Pencil" CheckedIcon="Pencil" Padding="8" CornerRadius="20" />--> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml index f6fc7704a..d6db3d124 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -14,16 +14,24 @@ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Thread Loading</TextBlock> <Grid Height="283"> - <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" TextAlignment="Center"> + <StackPanel Visibility="{Binding IsPreparing,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" TextAlignment="Center"> The machine is ready for thread loading. Please load the thread as instructed and press 'continue'. - </TextBlock> - <touch:TouchComboBox Margin="0 40 0 0" Width="300" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name" Title="Select thread type"></touch:TouchComboBox> - <touch:TouchButton Command="{Binding ContinueCommand}" Margin="0 50 0 50" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="60 15" CornerRadius="25">CONTINUE</touch:TouchButton> + </TextBlock> + <touch:TouchComboBox Margin="0 40 0 0" Width="300" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name" Title="Select thread type"></touch:TouchComboBox> + <touch:TouchButton Command="{Binding ContinueCommand}" Margin="0 50 0 50" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="60 15" CornerRadius="25">CONTINUE</touch:TouchButton> + </StackPanel> + <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" TextWrapping="Wrap" TextAlignment="Center"> + The machine is now loading the thread. please wait... + </TextBlock> + <touch:TouchBusyIndicator Margin="0 100 0 0" Width="100" Height="100" IsIndeterminate="True" /> + </StackPanel> </StackPanel> - <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Visibility="{Binding IsPreparing,Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" TextWrapping="Wrap" TextAlignment="Center"> - The machine is now loading the thread. please wait... + The machine is now preparing for thread loading. please wait... </TextBlock> <touch:TouchBusyIndicator Margin="0 100 0 0" Width="100" Height="100" IsIndeterminate="True" /> </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs index 5e5370416..5c4d003a1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs @@ -40,6 +40,13 @@ namespace Tango.PPC.UI.Dialogs set { _isFinalizing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private bool _isPreparing; + public bool IsPreparing + { + get { return _isPreparing; } + set { _isPreparing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + public List<Rml> Rmls { get; set; } private Rml _selectedRml; @@ -51,15 +58,28 @@ namespace Tango.PPC.UI.Dialogs public RelayCommand ContinueCommand { get; set; } - public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs) + public ThreadLoadingViewVM(IMachineProvider machineProvider) { CanClose = true; - _confirmationArgs = confirmationArgs; + IsPreparing = true; ContinueCommand = new RelayCommand(ContinueThreadLoading, () => !IsFinalizing && SelectedRml != null); MachineProvider = machineProvider; MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingCompleted += MachineOperator_ThreadLoadingCompleted; MachineProvider.MachineOperator.ThreadLoadingFailed += MachineOperator_ThreadLoadingFailed; + MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; + } + + public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs) : this(machineProvider) + { + _confirmationArgs = confirmationArgs; + IsPreparing = false; + } + + private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + { + _confirmationArgs = e; + IsPreparing = false; } private async void ContinueThreadLoading() @@ -125,7 +145,7 @@ namespace Tango.PPC.UI.Dialogs { Status = e; - if(Status.State == ThreadLoadingState.Finalizing) + if (Status.State == ThreadLoadingState.Finalizing) { IsFinalizing = true; } @@ -150,6 +170,7 @@ namespace Tango.PPC.UI.Dialogs MachineProvider.MachineOperator.ThreadLoadingStatusChanged -= MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingCompleted -= MachineOperator_ThreadLoadingCompleted; MachineProvider.MachineOperator.ThreadLoadingFailed -= MachineOperator_ThreadLoadingFailed; + MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired -= MachineOperator_ThreadLoadingConfirmationRequired; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index cfe0a03a0..f5b3d427f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.1.1.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index f926a0f4c..e280d5f9d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -96,12 +96,14 @@ namespace Tango.PPC.UI.ViewModels LogManager.Log($"Application started. Single user/Auto login detected ({user.Email}). Skipping LoginView..."); await AuthenticationProvider.Login(user.Email, user.Password, false); + await Task.Delay(1000); IsLoading = false; } else { LogManager.Log("Application started. Navigating to LoginView..."); await NavigationManager.NavigateTo(NavigationView.LoginView); + await Task.Delay(1000); IsLoading = false; } } 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 5c518f60d..048234949 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -32,6 +32,7 @@ namespace Tango.PPC.UI.ViewModels { private DispatcherTimer _date_timer; private bool _isPowerUpDialogShown; + private bool _isThreadLoadingShown; private DateTime _currentDateTime; /// <summary> @@ -64,6 +65,7 @@ namespace Tango.PPC.UI.ViewModels base.OnApplicationReady(); MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted; + MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; } @@ -187,12 +189,30 @@ namespace Tango.PPC.UI.ViewModels }); } - private async void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + private void MachineOperator_ThreadLoadingStatusChanged(object sender, PMR.ThreadLoading.StartThreadLoadingResponse e) { - LogManager.Log("Thread loading confirmation detected, showing thread loading screen..."); + if (e.State == PMR.ThreadLoading.ThreadLoadingState.Preparing) + { + DisplayThreadLoading(); + } + } + + private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + { + DisplayThreadLoading(e); + } + + private async void DisplayThreadLoading(ThreadLoadingConfirmationRequiredEventArgs confirmationArgs = null) + { + if (_isThreadLoadingShown) return; + + _isThreadLoadingShown = true; + + LogManager.Log("Thread loading preparation/finalization detected, showing thread loading screen..."); if (!Settings.DisplayAutomaticThreadLoadingScreen) { + _isThreadLoadingShown = false; LogManager.Log("Thread loading screen disabled. skipping..."); return; } @@ -212,12 +232,21 @@ namespace Tango.PPC.UI.ViewModels var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid); - vm = new ThreadLoadingViewVM(MachineProvider, e); + if (confirmationArgs == null) + { + vm = new ThreadLoadingViewVM(MachineProvider); + } + else + { + vm = new ThreadLoadingViewVM(MachineProvider, confirmationArgs); + } + vm.Rmls = rmls; vm.SelectedRml = selectedRml != null ? selectedRml : rmls.FirstOrDefault(); } catch (Exception ex) { + _isThreadLoadingShown = false; LogManager.Log(ex, "Error initializing thread loading screen."); return; } @@ -226,6 +255,8 @@ namespace Tango.PPC.UI.ViewModels { await NotificationProvider.ShowDialog<ThreadLoadingViewVM>(vm); + _isThreadLoadingShown = false; + LogManager.Log("Thread loading screen closed."); if (!vm.DialogResult) @@ -257,7 +288,6 @@ namespace Tango.PPC.UI.ViewModels } }); } - #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 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/Resources/Software Release Notes (4.1, 1.1).docx b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx Binary files differindex 7e6ff1e00..d6ebf5330 100644 --- a/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx +++ b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx diff --git a/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx Binary files differnew file mode 100644 index 000000000..849600e3e --- /dev/null +++ b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs index acead4157..1875dcd2d 100644 --- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs +++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs @@ -69,7 +69,7 @@ namespace Tango.Core /// <param name="propName">Name of the property.</param> protected virtual void RaisePropertyChangedAuto([CallerMemberName] string caller = null) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller)); + RaisePropertyChanged(caller); } /// <summary> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index b901bd224..17a7fbe58 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -1543,7 +1543,17 @@ namespace Tango.Emulations.Emulators public async void StartThreadLoading() { - await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Preparing }, _threadLoadingToken); + await Task.Delay(2000); + + if (_rnd.Next(0, 100) > 50) + { + await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.PreparationError, ErrorReason = "Emulator preparation random error." }, _threadLoadingToken); + } + else + { + await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + } } public async void FinalizeThreadLoading() @@ -1557,7 +1567,7 @@ namespace Tango.Emulations.Emulators } else { - await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken); + await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator finalization random error." }, _threadLoadingToken); } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs index ff045a9e5..f158af53f 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs @@ -39,6 +39,10 @@ namespace Tango.Integration.ExternalBridge private HubConnection _connection; private IHubProxy _proxy; + public event EventHandler<IExternalBridgeClient> MachineDiscovered; + + public event EventHandler<IExternalBridgeClient> MachineLost; + private SynchronizedObservableCollection<IExternalBridgeClient> _availableMachines; /// <summary> /// Gets the available machines. @@ -97,6 +101,11 @@ namespace Tango.Integration.ExternalBridge AvailableMachines.Remove(machine); } + foreach (var machine in AvailableMachines.OfType<ExternalBridgeSignalRClient>().ToList()) + { + AvailableMachines.Remove(machine); + } + _tcpDiscoveryThread = new Thread(TcpDiscoveryThreadMethod); _tcpDiscoveryThread.IsBackground = true; _tcpDiscoveryThread.Start(); @@ -166,7 +175,9 @@ namespace Tango.Integration.ExternalBridge LogManager.Log("Found a new machine via USB " + device.Description); ThreadsHelper.InvokeUINow(() => { - AvailableMachines.Add(new ExternalBridgeUsbClient(device.Port, device.Description, _settings.EmbeddedSerialBaudRate)); + var machine = new ExternalBridgeUsbClient(device.Port, device.Description, _settings.EmbeddedSerialBaudRate); + AvailableMachines.Add(machine); + MachineDiscovered?.Invoke(this, machine); }); } } @@ -209,6 +220,7 @@ namespace Tango.Integration.ExternalBridge { LogManager.Log("Disconnected machine detected via TCP: " + disconnected_machine.SerialNumber); AvailableMachines.Remove(disconnected_machine); + MachineLost?.Invoke(this, disconnected_machine); } continue; @@ -223,6 +235,7 @@ namespace Tango.Integration.ExternalBridge ThreadsHelper.InvokeUINow(() => { AvailableMachines.Insert(1, newMachine); + MachineDiscovered?.Invoke(this, newMachine); }); } } @@ -246,6 +259,7 @@ namespace Tango.Integration.ExternalBridge foreach (var machine in AvailableMachines.OfType<ExternalBridgeSignalRClient>().ToList().Where(x => !machines.Exists(y => y.SerialNumber == x.SerialNumber))) { AvailableMachines.Remove(machine); + MachineLost?.Invoke(this, machine); } foreach (var machine in machines.Where(x => !AvailableMachines.OfType<ExternalBridgeSignalRClient>().ToList().Exists(y => y.SerialNumber == x.SerialNumber))) @@ -255,6 +269,7 @@ namespace Tango.Integration.ExternalBridge ThreadsHelper.InvokeUINow(() => { AvailableMachines.Insert(1, newMachine); + MachineDiscovered?.Invoke(this, newMachine); }); } } @@ -291,6 +306,7 @@ namespace Tango.Integration.ExternalBridge { LogManager.Log("External bridge client failed or disposed. Removing from available machines..."); AvailableMachines.Remove(sender as IExternalBridgeClient); + MachineLost?.Invoke(this, sender as IExternalBridgeClient); } } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 80ba87ce1..5711882a3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -949,6 +949,7 @@ namespace Tango.Integration.Operation ThreadLoadingCompleted?.Invoke(this, ThreadLoadingStatus); break; case ThreadLoadingState.FinalizationError: + case ThreadLoadingState.PreparationError: ThreadLoadingFailed?.Invoke(this, ThreadLoadingStatus); break; } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index ffe3d19dd..8a5367234 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -66,7 +66,7 @@ <Grid Background="#9E000000"> <i:Interaction.Triggers> - <i:EventTrigger EventName="MouseDown"> + <i:EventTrigger EventName="MouseUp"> <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentDialog.DataContext.CloseCommand}" /> </i:EventTrigger> </i:Interaction.Triggers> |
