From b14dc1bc35994c4da27bd64e7de65ff66ae7ee0d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 18 Feb 2020 10:19:36 +0200 Subject: preparing rapid release --- .../Embedded/Common/SWUpdate/FileSystem.c | 28 +++-- Software/Embedded_SW/Embedded/DataDef.h | 4 +- .../Head_Card/EEPROM/Head_EEPROM.c | 4 +- .../Head_Card/PT100/Head_PT100_ADC.c | 88 +++++++------- Software/Embedded_SW/Embedded/Main.c | 6 +- .../Embedded/Modules/Control/MillisecTask.c | 2 +- .../Embedded/Modules/IDS/IDS_dispenser.c | 6 +- .../StateMachines/Initialization/InitSequence.c | 131 +++++++++++++++++++++ .../StateMachines/Initialization/InitSequence.h | 1 + 9 files changed, 200 insertions(+), 70 deletions(-) (limited to 'Software') 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..4f7a5d2dc 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -26,8 +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 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 I2C_2_Data_Transfer_Rate_400kbps 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..25c264755 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 @@ -128,12 +128,12 @@ uint32_t Check_Head_Type_Via_EEPROM() } //temporary - #ifdef Use_Head_Card +/* #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/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c index 47bbb7b60..4d8965de8 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_MAIN_CARD_TEMPERATURE_SENSOR_ID) Sensor_Read = 0; if(Machine_Idle_Mode == true) 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/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index d1f667405..ba3a3e1a7 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,132 @@ 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 >= 5) + { + count_Heater_Current = 0; + initial_wait = true; + } + if (initial_wait == false) + return false; + for (i=0;i=CURRENT_READING_ERROR_UNSTABLE) + { + ReportWithPackageFilter(InitFilter,"drier heaters current not stable", __FILE__,__LINE__,(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) + AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_HEATERS_ZONE_2_CURRENT_OUT_OF_RANGE,ON); + InitStages++; + } + } + } +return OK; +} +uint32_t InitSequencePowerManagementInit(void) +{ + 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); + return OK; +} uint32_t InitSequenceInitialBlowerActivation(void) { MachineStateDetail = MACHINE_STATE_INITIAL_BLOWER_ACTIVATION; @@ -385,6 +513,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_ */ -- cgit v1.3.1 From 22b961e296ebfeaf75d55987af8a4937d3d11217 Mon Sep 17 00:00:00 2001 From: Shai Frieder Date: Tue, 18 Feb 2020 10:57:08 +0200 Subject: remove WHS_FAN prints add print to tachboard avarage flow --- .../Embedded/Drivers/I2C_Communication/I2C_Task.c | 31 ++++--- .../Embedded/Drivers/I2C_Communication/I2C_Task.h | 2 +- .../WHS_Card/D_EMC2302_Fan/WHS_Fan.c | 4 +- .../WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c | 14 +-- .../WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c | 89 +++++++++++++------ .../WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c | 2 +- .../Embedded/Modules/Control/MillisecTask.c | 2 +- .../Embedded/Modules/Stubs_Handler/Progress.c | 99 +++++++++++----------- 8 files changed, 144 insertions(+), 99 deletions(-) (limited to 'Software') 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..a606a475d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c @@ -302,17 +302,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) @@ -514,11 +514,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_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..bf95c8444 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 @@ -181,16 +181,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 +274,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 +294,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/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e5064ef70..a36a19928 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -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/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 677d3fa5f..c84566659 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; } -- cgit v1.3.1 From b6586404105311d0b0536d0537a7084b1a37c7c0 Mon Sep 17 00:00:00 2001 From: Shai Frieder Date: Tue, 18 Feb 2020 11:14:39 +0200 Subject: merge --- .../Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Software') 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 bf95c8444..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 #include #include +#include MAX11614 U20_MAX11614 ; -- cgit v1.3.1 From 90eac4ff06b785d9caa284a27d380b50766ce07b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 18 Feb 2020 11:57:57 +0200 Subject: fix diagnostics and I2C handling --- .../Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 12 +++++------- Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c | 5 +++++ .../I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c | 9 --------- .../Drivers/I2C_Communication/Head_Card/Fan/fan_click.c | 12 ++---------- .../Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h | 6 +----- .../I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c | 6 +----- .../Embedded/Drivers/I2C_Communication/I2C_Task.c | 13 +++++-------- Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c | 4 ++-- .../Embedded/Modules/Diagnostics/Diagnostics.c | 17 +++++++++++------ .../StateMachines/Initialization/InitSequence.c | 14 +++++++++----- 10 files changed, 41 insertions(+), 57 deletions(-) (limited to 'Software') 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 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(); 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/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 4f5bec4f0..63fe510c4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -314,11 +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; - 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(); @@ -407,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) { @@ -443,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; @@ -793,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/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index ba3a3e1a7..8905a635d 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -240,7 +240,7 @@ bool DetectIfCurrentReadingStable(double HeaterCurrent) Maxcount_Heater_Current++; Heater_Current[count_Heater_Current++] = HeaterCurrent; - if ( count_Heater_Current >= 5) + if ( count_Heater_Current >= MAX_CURRENT_READING) { count_Heater_Current = 0; initial_wait = true; @@ -263,16 +263,19 @@ double GetZone2RMSCurrent(double VAC) } 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) { - ReportWithPackageFilter(InitFilter,"drier heaters current not stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + 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 @@ -388,13 +391,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) @@ -414,7 +417,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; -- cgit v1.3.1 From b7f4088f257c3c9c816f680c97a652f6f73de940 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Feb 2020 14:31:24 +0200 Subject: Several bug fixes on PPC. --- .../FSE/Tango.FSE.UI/Views/LayoutView.xaml | 4 ++-- .../Dialogs/AdvancedColorCorrectionView.xaml | 25 ++++++++++++++++++++++ .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 21 ++++++++---------- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 1 - .../PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs | 2 ++ 5 files changed, 38 insertions(+), 15 deletions(-) (limited to 'Software') 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..3ea648ff1 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml @@ -10,7 +10,7 @@ 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}"> - + @@ -46,7 +46,7 @@ - + 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 @@ + + + , , + + + + + , + , + + 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(); } /// @@ -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 @@ 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; } } -- cgit v1.3.1 From dd5962457761b0a9afe7037b201d0628d726a698 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 18 Feb 2020 16:04:26 +0200 Subject: preparations and fixes for 1.4.6.12 --- Software/Embedded_SW/Embedded/DataDef.h | 1 - .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 10 +- .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 12 +- .../Embedded_SW/Embedded/Drivers/Heater/Heater.c | 5 + .../Head_Card/EEPROM/Head_EEPROM.c | 9 - .../I2C_Communication/Head_Card/Fan/fan_click.c | 12 +- .../I2C_Communication/Head_Card/I2C_Head_Mux.h | 6 +- .../Head_Card/PT100/Head_PT100_ADC.c | 6 +- .../Embedded/Drivers/I2C_Communication/I2C_Task.c | 13 +- .../WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c | 6 +- .../WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c | 646 --------------------- .../I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c | 3 - .../Embedded_SW/Embedded/Drivers/Valves/Valve.c | 4 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 17 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 24 +- .../Embedded/Modules/Stubs_Handler/Progress.c | 2 +- .../Embedded/Modules/Thread/Thread_print.c | 13 +- .../StateMachines/Initialization/InitSequence.c | 27 +- 18 files changed, 85 insertions(+), 731 deletions(-) (limited to 'Software') diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 4f7a5d2dc..716ae7fe4 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -28,7 +28,6 @@ //#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 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 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(); 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)) -// 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)) -// 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)) -// 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/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/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 4f5bec4f0..63fe510c4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -314,11 +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; - 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(); @@ -407,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) { @@ -443,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; @@ -793,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_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 677d3fa5f..e0728945d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -511,7 +511,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 ba3a3e1a7..92ab2b43c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -240,7 +240,7 @@ bool DetectIfCurrentReadingStable(double HeaterCurrent) Maxcount_Heater_Current++; Heater_Current[count_Heater_Current++] = HeaterCurrent; - if ( count_Heater_Current >= 5) + if ( count_Heater_Current >= MAX_CURRENT_READING) { count_Heater_Current = 0; initial_wait = true; @@ -263,16 +263,19 @@ double GetZone2RMSCurrent(double VAC) } 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) { - ReportWithPackageFilter(InitFilter,"drier heaters current not stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); + 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 @@ -330,10 +333,15 @@ return OK; } uint32_t InitSequencePowerManagementInit(void) { - 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); + 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) @@ -388,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) @@ -414,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; -- cgit v1.3.1 From 00b7de2653058bd9657217075eae834f6a1a4ec5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Feb 2020 16:26:46 +0200 Subject: Implemented PPC thread loading from preparation.. --- .../Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml | 22 ++++++++---- .../Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs | 27 +++++++++++++-- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 38 ++++++++++++++++++--- .../Software Release Notes (4.1, 1.1).docx | Bin 0 -> 9504602 bytes .../Release Notes/Transparent Colors.docx | Bin 0 -> 214687 bytes .../Software Release Notes (4.1, 1.1).docx | Bin 9706563 -> 0 bytes .../Tango.Emulations/Emulators/MachineEmulator.cs | 14 ++++++-- .../Tango.Integration/Operation/MachineOperator.cs | 1 + .../Tango.Touch/Controls/TouchPanel.xaml | 2 +- 9 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx create mode 100644 Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx delete mode 100644 Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx (limited to 'Software') 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 @@ Thread Loading - - + + + The machine is ready for thread loading. Please load the thread as instructed and press 'continue'. - - - CONTINUE + + + CONTINUE + + + + The machine is now loading the thread. please wait... + + + - + - The machine is now loading the thread. please wait... + The machine is now preparing for thread loading. please wait... 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 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/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; /// @@ -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(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/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx new file mode 100644 index 000000000..d6ebf5330 Binary files /dev/null and b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx differ diff --git a/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx new file mode 100644 index 000000000..849600e3e Binary files /dev/null and b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx differ diff --git a/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx b/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx deleted file mode 100644 index 7e6ff1e00..000000000 Binary files a/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx and /dev/null differ 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(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Preparing }, _threadLoadingToken); + await Task.Delay(2000); + + if (_rnd.Next(0, 100) > 50) + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.PreparationError, ErrorReason = "Emulator preparation random error." }, _threadLoadingToken); + } + else + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + } } public async void FinalizeThreadLoading() @@ -1557,7 +1567,7 @@ namespace Tango.Emulations.Emulators } else { - await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken); + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator finalization random error." }, _threadLoadingToken); } } 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 @@ - + -- cgit v1.3.1 From 96691cea7e86b1df3f6cd5b3f45ae614e5f09821 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Feb 2020 21:06:18 +0200 Subject: FSE... --- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 6 +- .../FSE/Tango.FSE.Common/FSEViewModel.cs | 19 +++ .../Tango.FSE.Common/Images/twine_logo_colored.png | Bin 0 -> 27285 bytes .../FSE/Tango.FSE.Common/Resources/Fonts.xaml | 9 +- .../FSE/Tango.FSE.Common/Resources/Images.xaml | 1 + .../FSE/Tango.FSE.Common/Tango.FSE.Common.csproj | 3 + .../FSE/Tango.FSE.UI/Contracts/ILayoutView.cs | 14 ++ .../Connections/external-bridge-emulator.png | Bin 0 -> 6412 bytes .../Images/Connections/external-bridge-signalr.png | Bin 0 -> 5399 bytes .../Images/Connections/external-bridge-tcp.png | Bin 0 -> 5653 bytes .../Images/Connections/external-bridge-usb.png | Bin 0 -> 5669 bytes .../FSE/Tango.FSE.UI/Images/login_white.png | Bin 0 -> 3308 bytes .../Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml | 2 +- .../Tango.FSE.UI/Panes/MachineConnectionPane.xaml | 94 +++++++++++ .../Panes/MachineConnectionPane.xaml.cs | 38 +++++ .../Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs | 108 ++++++++++++ .../FSE/Tango.FSE.UI/Tango.FSE.UI.csproj | 22 +++ .../FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs | 52 ++++++ .../FSE/Tango.FSE.UI/Views/LayoutView.xaml | 182 +++++++++++++++++++-- .../FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs | 31 +++- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Visual_Studio/Tango.Core/ExtendedObject.cs | 2 +- .../ExternalBridge/ExternalBridgeScanner.cs | 18 +- 25 files changed, 574 insertions(+), 31 deletions(-) create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Images/twine_logo_colored.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Contracts/ILayoutView.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-emulator.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-signalr.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-tcp.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-usb.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Images/login_white.png create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPane.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/MachineConnectionPaneVM.cs (limited to 'Software') 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 index a603ff06b..993ced97e 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ 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 @@ - + - + @@ -415,7 +415,7 @@ - + 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; + } + } + } } /// 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 new file mode 100644 index 000000000..2204585dc Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.Common/Images/twine_logo_colored.png differ 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 @@ ../Fonts/#digital-7 ../Fonts/#flexo - + + 14 + 12 + 10 + 16 + 18 16 - + \ 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 @@ + \ 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 @@ + + + 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" 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 new file mode 100644 index 000000000..254fc819a Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-emulator.png differ 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 new file mode 100644 index 000000000..bda45ffd2 Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-signalr.png differ 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 new file mode 100644 index 000000000..04e47f539 Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-tcp.png differ 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 new file mode 100644 index 000000000..07814e7de Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/Connections/external-bridge-usb.png differ 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 new file mode 100644 index 000000000..10a054147 Binary files /dev/null and b/Software/Visual_Studio/FSE/Tango.FSE.UI/Images/login_white.png differ 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}"> 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 @@ + + + + + + + + + + + + + + + + + Port: + + + Device: + + + + + + + + + + + + + + + + + + + + S/N: + + + IP Address: + + + Organization: + + + + + + + + + + + + + + + + + + + + S/N: + + + Hub: + + + Organization: + + + + + + + + + + + + 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 +{ + /// + /// Interaction logic for MachineConnectionPane.xaml + /// + 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 MachineSelected; + + public ObservableCollection UsbMachines { get; set; } + + public ObservableCollection TcpMachines { get; set; } + + public ObservableCollection 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(); + TcpMachines = new ObservableCollection(); + SignalRMachines = new ObservableCollection(); + + _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 @@ Designer + @@ -92,6 +93,10 @@ + + MachineConnectionPane.xaml + + @@ -130,6 +135,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -191,6 +200,10 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {4206AC58-3B57-4699-8835-90BF6DB01A61} + Tango.Integration + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging @@ -230,6 +243,15 @@ + + + + + + + + + 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 3ea648ff1..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}"> + 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}"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26,33 +79,134 @@ - - - - + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + ... + + + + + + + + + + - - + + + + - + + + + + - + + + + + + + + + + + + + - + 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 { /// /// Interaction logic for LayoutView.xaml /// - 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/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/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. --> - + 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 /// Name of the property. protected virtual void RaisePropertyChangedAuto([CallerMemberName] string caller = null) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller)); + RaisePropertyChanged(caller); } /// 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 MachineDiscovered; + + public event EventHandler MachineLost; + private SynchronizedObservableCollection _availableMachines; /// /// Gets the available machines. @@ -97,6 +101,11 @@ namespace Tango.Integration.ExternalBridge AvailableMachines.Remove(machine); } + foreach (var machine in AvailableMachines.OfType().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().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().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); } } } -- cgit v1.3.1