diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-02-06 13:52:11 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-02-06 13:52:11 +0200 |
| commit | 039dce35bccc0d690e06c8cb0fbaad04483661fc (patch) | |
| tree | ae2d241fd67a5e2bdc8c78795631311bcf6892fc /Software/Embedded_SW/Embedded/Modules | |
| parent | 5bf44be1121abf9dd36c948c19ca0650f5571c3e (diff) | |
| parent | 67f576c95d1eed3846611a008253bdba35b5767c (diff) | |
| download | Tango-039dce35bccc0d690e06c8cb0fbaad04483661fc.tar.gz Tango-039dce35bccc0d690e06c8cb0fbaad04483661fc.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
6 files changed, 112 insertions, 160 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 828961d17..35065cc2a 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -150,9 +150,10 @@ uint32_t HWConfigurationInit(void) IDS_Dispenser_Content_Init(); //ProcessParamsInit(); Buttons_Init(); - WHS_init(); if (WHS_Type == WHS_TYPE_NEW) newWHS_init(); + WHS_init(); + ADC_MUX_Init(); GeneralHwReady = true; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 96ce9331d..2de6b0641 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -807,7 +807,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) if (abs(readValue - HeaterPreviousRead[index])>2000) { ReportWithPackageFilter(HeatersFilter,"Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); - if (HeaterSpikeRead[index] = 0) + if (HeaterSpikeRead[index] == 0) { HeaterSpikeRead[index] = readValue; } @@ -993,7 +993,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) ReportWithPackageFilter(HeatersFilter,"AC Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); if (readValue > HeaterCmd[index].targettemperatue) { - if (HeaterSpikeRead[index] = 0) + if (HeaterSpikeRead[index] == 0) { HeaterSpikeRead[index] = readValue; } @@ -1200,7 +1200,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { DeActivateHeater(index); HeaterRecalculateHeaterParams(index, 0); - if (HeaterSpikeRead[index] = 0) + if (HeaterSpikeRead[index] == 0) { HeaterSpikeRead[index] = readValue; } diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c index 7f99a2a92..a98cc173e 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c @@ -317,19 +317,19 @@ bool CartridgeValidationResponseFunc(MessageContainer* requestContainer) // 2. the index is out of rang if (response == NULL) { - REPORT_MSG(WHS_filling," ------------ IFS_filling message from PPC is null!!! ----------------- "); // write to log error + ReportWithPackageFilter(WHS_filling,"------------ IFS_filling message from PPC is null!!! -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); return ret; } if (response->index < NUM_OF_MIDTANKS) { IFS_info.Ink.cart_color = response->index; // midtank 1-8 - ReportWithPackageFilter(WasteFilter,"------------ IFS get message response->index is -----------------", __FILE__, __LINE__, response->index, RpMessage, 0, 0); + ReportWithPackageFilter(WHS_filling,"------------ IFS get message response->index is -----------------", __FILE__, __LINE__, response->index, RpMessage, 0, 0); WHS_info.event = IFS_INK_authentication_pass; } else { - ReportWithPackageFilter(WasteFilter,"------------ IFS get message response->index is out of rang -----------------", __FILE__, __LINE__, response->index, RpMessage, 0, 0); + ReportWithPackageFilter(WHS_filling,"------------ IFS get message response->index is out of rang -----------------", __FILE__, __LINE__, response->index, RpMessage, 0, 0); WHS_info.event = IFS_INK_authentication_fail; } diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index e6e5923c0..2e5afa59c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -158,7 +158,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) else // if(request->amount == 0x3EB) { - uint16_t tempu16=0; + uint16_t tempu16 = 0; if (WHS_Type == WHS_TYPE_NEW) { if (request->delay <= 0x03FF) @@ -220,17 +220,24 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) { uint8_t Write_Buf[2] = {0,0}; uint8_t Script_Slave_Add = request -> delay >> 16; - Write_Buf[0] = request -> delay >> 8; + Write_Buf[0] = (request -> delay & 0x00FF00) >> 8; Write_Buf[1] = request -> delay & 0x0000FF; Select_Main_Head_Mux_Channel(); - I2C_Write(I2C_ID_HEAD_CARD, Script_Slave_Add, Write_Buf, 2); + if(Write_Buf[0] < 2) + { + I2C_Write(I2C_ID_HEAD_CARD, Script_Slave_Add, Write_Buf, 1); + } + else + { + I2C_Write(I2C_ID_HEAD_CARD, Script_Slave_Add, Write_Buf, 2); + } delayms(1); - uint8_t Read_Buf[2] = {0,0}; - I2C_Read(I2C_ID_HEAD_CARD, Script_Slave_Add + 1, Read_Buf, 2); - response.progress = Read_Buf[1] << 8 | Read_Buf[0]; + uint8_t Read_Buf[2] = {0};//,0}; + I2C_Read(I2C_ID_HEAD_CARD, Script_Slave_Add + 1, Read_Buf, 1);//2 ? + response.progress = /*Read_Buf[1] << 8 | */Read_Buf[0]; response.has_progress = true; } diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index 5fcab9c13..094df16cf 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -328,23 +328,30 @@ bool SetWastePump( bool power) if ( power == OPEN ) { if (WHS_Type == WHS_TYPE_UNKNOWN) - Pumps_Control(WHS_WTANKPUMP2, OPEN); //waste_pump_power_on(); - else //new WHS - Trigger_SetWHSPump(OPEN); - - REPORT_MSG(WHS_empty," ------------ WHS WHS_empty start PUMP ----------------- "); + { + Pumps_Control(WHS_WTANKPUMP2, OPEN); //waste_pump_power_on(); + } + else //new WHS + { + Trigger_SetWHSPump(OPEN); + } WHS_info.WHS_pump.status = OPEN; + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_empty start PUMP -----------------", __FILE__, __LINE__, WHS_info.WHS_pump.status, RpMessage, 0, 0); WHS_info.WHS_pump.time = STARTCOUNT; ret = OPEN; } else { if (WHS_Type == WHS_TYPE_UNKNOWN) - Pumps_Control(WHS_WTANKPUMP2, CLOSE); //waste_pump_power_on(); - else //new WHS - Trigger_SetWHSPump(CLOSE); - REPORT_MSG(WHS_empty," ------------ WHS WHS_empty stop PUMP ----------------- "); - WHS_info.WHS_pump.status = CLOSE; + { + Pumps_Control(WHS_WTANKPUMP2, CLOSE); //waste_pump_power_on(); + } + else //new WHS + { + Trigger_SetWHSPump(CLOSE); + } + WHS_info.WHS_pump.status = CLOSE; + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_empty stop PUMP -----------------", __FILE__, __LINE__, WHS_info.WHS_pump.status, RpMessage, 0, 0); WHS_info.WHS_pump.time = STOPCOUNT; ret = CLOSE; } @@ -366,12 +373,14 @@ bool SetValveDirection() if (WHS_info.active_cartridge == waste_cartridge1) { WHS_info.WHS_valve = VALVE_DIR_WASTE_CARTRIDGE1; - } + ReportWithPackageFilter(WasteFilter,"------------WHS_info.WHS_valve VALVE_DIR_WASTE_CARTRIDGE1 -----------------", __FILE__, __LINE__, WHS_info.WHS_valve, RpMessage, 0 ,0); +} else { WHS_info.WHS_valve = VALVE_DIR_WASTE_CARTRIDGE2; + ReportWithPackageFilter(WasteFilter,"------------WHS_info.WHS_valve VALVE_DIR_WASTE_CARTRIDGE2 -----------------", __FILE__, __LINE__, WHS_info.WHS_valve, RpMessage, 0 ,0); } - ReportWithPackageFilter(WasteFilter,"------------WHS_info.WHS_valve -----------------", __FILE__,__LINE__,WHS_info.WHS_valve, RpMessage, 0 ,0); + if (WHS_Type == WHS_TYPE_UNKNOWN) Valve_Set(VALVE_WASTE_TANK, WHS_info.WHS_valve); @@ -396,7 +405,6 @@ U8 CartridgeWasteFilling(bool status) //Pannel_Leds(PANEL_BUTTON_OR_CRAT_ID Pannel_Led_Id, OPERATION_MODE LED_Mode); //set cartridge led color slow blink SetWastePump(OPEN); //WHS_info.WHS_pump.time = 0; - REPORT_MSG(WHS_empty," ------------ WHS WHS_empty start PUMP ----------------- "); AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); ret=OK; } @@ -416,16 +424,16 @@ U8 CartridgeWasteFilling(bool status) case waste_cartridge1: Pannel_Leds( CART_2, MODE_OFF); //set led color cart2.color = colorOFF; - REPORT_MSG(WHS_empty," ------------ WHS waste_cartridge1 is used please replace it ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS waste_cartridge1 is used please replace it -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); break; case waste_cartridge2: Pannel_Leds( CART_3, MODE_OFF); //set led color cart3.color = colorOFF; - REPORT_MSG(WHS_empty," ------------ WHS waste_cartridge2 is used please replace it ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS waste_cartridge2 is used please replace it -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); break; case no_waste_cartridge: - REPORT_MSG(WHS_empty," ------------ !!!!!WHS No waste cartridge !!!!! ----------------- "); - REPORT_MSG(WHS_empty," ------------ !!!! WHS insert cartridge!!!! ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ !!!!!WHS No waste cartridge !!!!! -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ !!!! WHS insert cartridge!!!! -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); ret = ERROR; break; default: @@ -479,40 +487,20 @@ WHS_sttMachin UpdateStateMachine() if ( WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORnotFULL) { WHS_info.sttMachine = WHS_empty ; - REPORT_MSG(WHS_empty," ------------ WHS WHS_empty ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_empty -----------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_tank_full_sensor, RpMessage, WHS_info.WHS_sensors.waste_tank_empty_sensor, 0); } - else if ((WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL) && - (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY)) + else if ((WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL) && + (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY)) { WHS_info.sttMachine = WHS_full ; - REPORT_MSG(WHS_full," ------------ WHS WHS_full ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_full -----------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_tank_full_sensor, RpMessage, WHS_info.WHS_sensors.waste_tank_empty_sensor, 0); } else { WHS_info.sttMachine = WHS_sttError ; - REPORT_MSG(WHS_sttError," ------------ WHS sensor Error ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS sensor Error -----------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_tank_full_sensor, RpMessage, WHS_info.WHS_sensors.waste_tank_empty_sensor, 0); } - -/* if (//(WHS_info.WHS_sensors.waste_tank_over_flow_sensor == SENSORnotOVERFLOW) && - ( WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORnotFULL) && - ((WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY) || - (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSOREMPTY))) - WHS_info.sttMachine = WHS_empty ; - else if (//(WHS_info.WHS_sensors.waste_tank_over_flow_sensor == SENSORnotOVERFLOW) && - (WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL) && - (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY)) - WHS_info.sttMachine = WHS_full ; - else if (//(WHS_info.WHS_sensors.waste_tank_over_flow_sensor == SENSOROVERFLOW) && - (WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL) && - (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY)) - WHS_info.sttMachine = WHS_overflow ; - else - { - WHS_info.sttMachine = WHS_sttError ; - REPORT_MSG(WHS_sttError," ------------ WHS sensor Error ----------------- "); - } -*/ - return OK; + return WHS_info.sttMachine; } @@ -526,20 +514,6 @@ bool initWHS_WasteTank() } -/* -WHS_sensor OverflowSensorEvent() -{ - WHS_sensor ret = WHS_no_event; - if (RdWasteTankOverFlowSensor() != WHS_info.WHS_sensors.waste_tank_over_flow_sensor) - { - WHS_info.event = WHS_overflow_sensor; - ret = WHS_overflow_sensor; - WHS_info.WHS_sensors.waste_tank_over_flow_sensor = !(WHS_info.WHS_sensors.waste_tank_over_flow_sensor); - } - return ret; -} -*/ - WHS_sensor EmptySensorEvent() { WHS_sensor ret = WHS_no_event; @@ -548,6 +522,7 @@ WHS_sensor EmptySensorEvent() WHS_info.event = WHS_empty_sensor; ret = WHS_empty_sensor; WHS_info.WHS_sensors.waste_tank_empty_sensor = !WHS_info.WHS_sensors.waste_tank_empty_sensor; + ReportWithPackageFilter(WasteFilter,"------------ WHS EmptySensorEvent (status) -----------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_tank_full_sensor, RpMessage, WHS_info.WHS_sensors.waste_tank_empty_sensor, 0); } return ret; } @@ -560,6 +535,7 @@ WHS_sensor FullSensorEvent() WHS_info.event = WHS_full_sensor; ret = WHS_full_sensor; WHS_info.WHS_sensors.waste_tank_full_sensor = 1-WHS_info.WHS_sensors.waste_tank_full_sensor; + ReportWithPackageFilter(WasteFilter,"------------ WHS FullSensorEvent (status) -----------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_tank_full_sensor, RpMessage, WHS_info.WHS_sensors.waste_tank_empty_sensor, 0); } return ret; } @@ -578,6 +554,7 @@ WHS_sensor WasteTankCallBackFunction() { WHS_info.WHS_pump.time = 0; AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_EMPTYING_TIMEOUT, false); + ReportWithPackageFilter(WasteFilter,"------------ WHS PUMPTIMEOUT -----------------", __FILE__, __LINE__, PUMPTIMEOUT, RpMessage, 0, 0); return WHS_info.event = WHS_Timeout; } if ( FullSensorEvent()) @@ -595,7 +572,6 @@ WHS_sensor WasteTankCallBackFunction() bool WasteTankCBFunction() { - uint8_t parameter = 7; bool ret = notOK; static bool pump_on_flag = CLOSE; //uint32_t Cartridge_Cover_device_Id = 0; @@ -609,11 +585,11 @@ bool WasteTankCBFunction() if (WHS_info.sttMachine == WHS_empty) { WHS_info.sttMachine = WHS_filling; - REPORT_MSG(WHS_filling," ------------ WHS_filling ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_filling ------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); } else { - REPORT_MSG(WHS_filling," ------------ WHS EMPTY sensor failed !!!!!!! ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS EMPTY sensor failed !!!!!!! ------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); } } else //SENSOREMPTY @@ -621,7 +597,7 @@ bool WasteTankCBFunction() if (WHS_info.sttMachine == WHS_emptying) { WHS_info.sttMachine = WHS_empty; - REPORT_MSG(WHS_filling," ------------ WHS_empty ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS_empty -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); ret = CartridgeWasteFilling(OFF); WHS_info.Cartridge_Cover_device_Id = RemoveControlCallback(WHS_info.Cartridge_Cover_device_Id, WasteTankCBFunction ); WHS_info.Cartridge_Cover_device_Id = AddControlCallback("Cartridge Cover Door", WasteTankCBFunction, CartridgeCoverCallBackTime, CartridgeCoverCallBackFunction, 0,0,0 );//eOneSecond @@ -629,7 +605,7 @@ bool WasteTankCBFunction() } else { - REPORT_MSG(WHS_emptying," ------------ WHS EMPTY sensor failed !!!!!!! ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS WHS EMPTY sensor failed !!!!!!! -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); } } break; @@ -639,9 +615,9 @@ bool WasteTankCBFunction() break; if ((WHS_info.WHS_sensors.cartridge_cover == OPEN) && (WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL)) { - ReportWithPackageFilter(WasteFilter,"------------ WHS_full , cartridge cover is open cant start the pump!!!! ----------------- ", __FILE__,__LINE__,(int)(WHS_emptying), RpMessage, (int)(WHS_info.WHS_sensors.cartridge_cover), 0); - ReportWithPackageFilter(WasteFilter,"------------ close the cartridge cover to start the pump!!!! ----------------- ", __FILE__,__LINE__,(int)(WHS_emptying), RpMessage, (int)(WHS_info.WHS_sensors.cartridge_cover), 0); - //pump_on_flag = OPEN; + ReportWithPackageFilter(WasteFilter,"------------ WHS_full , cartridge cover is open cant start the pump!!!! -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.cartridge_cover, 0); + ReportWithPackageFilter(WasteFilter,"------------ WHS, close the cartridge cover to start the pump!!!! -------------" , __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.cartridge_cover, 0); + AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, true); WHS_info.WHS_sensors.waste_tank_full_sensor = SENSORnotFULL; @@ -650,7 +626,7 @@ bool WasteTankCBFunction() if (WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL) { WHS_info.sttMachine = WHS_full; - REPORT_MSG(WHS_emptying," ------------ WHS_full ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, WHS_full -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.waste_tank_full_sensor, 0); WHS_info.Cartridge_Cover_device_Id = RemoveControlCallback(WHS_info.Cartridge_Cover_device_Id, WasteTankCBFunction ); WHS_info.Cartridge_Cover_device_Id = AddControlCallback("Cartridge Cover Door", WasteTankCBFunction, CartridgeCoverCallBackFastTime , CartridgeCoverCallBackFunction, 0,0,0 );//eTenMillisecond if (RdRFIDStatus (WHS_info.active_cartridge) == WasteEmpty) @@ -668,7 +644,7 @@ bool WasteTankCBFunction() if (ret != OK) { - //recreate the full event until cartridge is inserted or atontocation + //recreate the full event until cartridge is inserted or authentication WHS_info.WHS_sensors.waste_tank_full_sensor = 1-WHS_info.WHS_sensors.waste_tank_full_sensor; } @@ -679,34 +655,21 @@ bool WasteTankCBFunction() if (WHS_info.sttMachine == WHS_full) { WHS_info.sttMachine = WHS_emptying; - REPORT_MSG(WHS_emptying," ------------ WHS_emptying ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, WHS_emptying -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.waste_tank_full_sensor, 0); // can start a new JOB } else { - REPORT_MSG(WHS_full," ------------ WHS FULL sensor failed !!!!!!! ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, WHS FULL sensor failed !!!!!!! -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.waste_tank_full_sensor, 0); } } break; -/* case WHS_overflow_sensor: - if (WHS_info.WHS_sensors.waste_tank_empty_sensor) - { - - // 1.StopMacine - WHS_info.sttMachine = WHS_overflow; - } - else - { - WHS_info.sttMachine = WHS_full; - } - break; -*/ case WHS_cartridge_cover_sensor: if ( WHS_info.WHS_sensors.cartridge_cover == OPEN ) { - REPORT_MSG(parameter," Cartridge cover open ");//popup message :"Cartridge cover open" //todo + ReportWithPackageFilter(WasteFilter,"------------ WHS, Cartridge cover open -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.cartridge_cover, 0);//popup message :"Cartridge cover open" //todo if ( WHS_info.WHS_pump.status == OPEN) { CartridgeWasteFilling(CLOSE); @@ -726,7 +689,7 @@ bool WasteTankCBFunction() } else { - REPORT_MSG(parameter,"Power down in process");//popup message :"Cartridge cover open" //todo + ReportWithPackageFilter(WasteFilter,"------------ WHS, Power down in process -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, WHS_info.WHS_sensors.cartridge_cover, 0);//popup message :"Cartridge cover open" //todo } @@ -755,7 +718,7 @@ bool WasteTankCBFunction() if ( IFS_info.INK_isOK_flag ) { IFS_info.INK_isOK_flag = false;//0 - REPORT_MSG(WHS_full," ------------ change INK cartridge status to color Used ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, change INK cartridge status to color Used -------------", __FILE__, __LINE__, IFS_info.INK_isOK_flag, RpMessage, 0, 0); // test the Mid-tank capacity is not at Nadav sequence MidTank_Pressure = Get_MidTank_Pressure_Sensor(IFS_info.Ink.cart_color); if ( MidTank_Pressure > MidTank_Pressure_EMPTY ) @@ -763,11 +726,10 @@ bool WasteTankCBFunction() ReportWithPackageFilter(WasteFilter,"------------ close door MidTank_Pressure > MidTank_Pressure_EMPTY -----------------", __FILE__,__LINE__,(int)(MidTank_Pressure_EMPTY*1000), RpMessage, (int)(MidTank_Pressure*1000), 0); MidTankValvesAction(Cartridge_MidTank_OFF); //Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); - REPORT_MSG(WHS_full," ------------ Mid-tank not empty ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, Mid-tank not empty -------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); break; } IFS_info.MidTank_capacity = MidTank_Pressure; - REPORT_MSG(WHS_full," ------------ Mid-tank filling in process ----------------- "); ReportWithPackageFilter(WasteFilter,"------------ Mid-tank filling in process -----------------", __FILE__,__LINE__,(int)(MidTank_Pressure_EMPTY*1000), RpMessage, (int)(MidTank_Pressure*1000), 0); Pannel_Leds(CART_1, MODE_ON); cart1.color = BLINK; @@ -797,7 +759,7 @@ bool WasteTankCBFunction() if (IFS_info.IFS_Ink_precense_sensor == CarteidgePrecense) { // is power down in process?? //todo - if ( !PowerOffInProcessGetState() ) // not in power down proccess + if ( !PowerOffInProcessGetState() ) // not in power down process { Pannel_Leds(CART_1, MODE_ON); cart1.color = colorON; @@ -806,10 +768,8 @@ bool WasteTankCBFunction() else { // print: "power down in process"; - REPORT_MSG(WHS_full," ------------ power down in process ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, Power down in process -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, IFS_info.IFS_Ink_precense_sensor, 0); } - - } else // Cartridge is out { @@ -822,14 +782,13 @@ bool WasteTankCBFunction() IFS_info.Ink.time_out = 0; IFS_info.Cartridge_Ink_TimeOut_device_Id = RemoveControlCallback(IFS_info.Cartridge_Ink_TimeOut_device_Id, WasteTankCBFunction ); } - } break; case IFS_INK_authentication_pass: if (!ColorMatch()) { - REPORT_MSG(WHS_full," ------------ cartridge color does not match ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, cartridge color does not match -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); Pannel_Leds(CART_1, MODE_ON); cart1.color = BLINK; break; @@ -918,7 +877,7 @@ bool WasteTankCBFunction() break; case WHS_Timeout: - REPORT_MSG(WHS_emptying," ------------ WHS_Timeout ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, WHS_Timeout -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_EMPTYING_TIMEOUT, true); CartridgeWasteFilling(OFF); break; @@ -938,12 +897,12 @@ bool WasteTankCBFunction() case IFS_Timeout_Second: // Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); IFS_info.Cartridge_Ink_TimeOut_device_Id = RemoveControlCallback(IFS_info.Cartridge_Ink_TimeOut_device_Id, WasteTankCBFunction ); - REPORT_MSG(WHS_full," ------------ Change cartridge status to Fail ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS, Change cartridge status to Fail -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); MidTankValvesAction(Cartridge_MidTank_OFF); cart1.color = fastBILNK; - REPORT_MSG(WHS_full," ------------ Display Mid-tank # filling fail ----------------- "); - REPORT_MSG(WHS_full," ------------ call customer support ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ Display Mid-tank # filling fail -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ call customer support -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); Pannel_Leds(CART_1, MODE_ON); cart1.color = fastBILNK; IFS_TimeOutAlarm(true); @@ -952,11 +911,11 @@ bool WasteTankCBFunction() case IFS_MidTankFull: // Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); IFS_info.Cartridge_Ink_TimeOut_device_Id = RemoveControlCallback(IFS_info.Cartridge_Ink_TimeOut_device_Id, WasteTankCBFunction ); - REPORT_MSG(WHS_full," ------------ Change cartridge status to Waste Empty ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ Change cartridge status to Waste Empty -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); Pannel_Leds(CART_1, MODE_OFF); cart1.color = colorOFF; MidTankValvesAction(Cartridge_MidTank_OFF); - REPORT_MSG(WHS_full," ------------ Display Mid-tank # filling done ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ Display Mid-tank # filling done -------------", __FILE__, __LINE__, WHS_info.sttMachine, RpMessage, 0, 0); break; @@ -977,7 +936,6 @@ bool WasteTankCBFunction() bool RdCartridgeCoverSensor() { - uint32_t parameter = 6 ; //REPORT_MSG(parameter," ------------ RD Cartridge Cover Sensor ----------------- "); bool ret = notOK; @@ -987,11 +945,11 @@ bool RdCartridgeCoverSensor() ret = Get_COVER_1_State(CartridgesDoor); if ((ret == OPEN ) && (ret != WHS_info.WHS_sensors.cartridge_cover)) { - Report(" ------------ RD Cartridge Cover Sensor is = OPEN(1) ----------------- ",__FILE__,__LINE__,ret,RpWarning,ret,0); + ReportWithPackageFilter(WasteFilter,"------------ RD Cartridge Cover Sensor is = OPEN(1) -------------", __FILE__, __LINE__, ret, RpMessage, 0, 0); } if ((ret == CLOSE ) && (ret != WHS_info.WHS_sensors.cartridge_cover)) { - REPORT_MSG(parameter," ------------ RD Cartridge Cover Sensor is = CLOSE(0) ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ RD Cartridge Cover Sensor is = CLOSE(0) -------------", __FILE__, __LINE__, ret, RpMessage, 0, 0); } return ret; } @@ -1001,21 +959,18 @@ bool RdCartridgeCoverSensor() WHS_sensor CartridgeCoverCallBackFunction() { - uint32_t parameter = 6 ; - - WHS_sensor ret = WHS_no_event; //ret = RdCartridgeCoverSensor(); if ( WHS_info.WHS_sensors.cartridge_cover != RdCartridgeCoverSensor() ) { - REPORT_MSG(parameter," ------------ find : WHS_cartridge_cover_sensor event ----------------- "); WHS_info.event = WHS_cartridge_cover_sensor; WHS_info.WHS_sensors.cartridge_cover = !WHS_info.WHS_sensors.cartridge_cover; + ReportWithPackageFilter(WasteFilter,"------------ find : WHS_cartridge_cover_sensor event -------------", __FILE__, __LINE__, WHS_info.WHS_sensors.cartridge_cover, RpMessage, 0, 0); ret = WHS_cartridge_cover_sensor; //todo } else if (( IFS_info.INK_isOK_flag ) && ( WHS_info.WHS_sensors.cartridge_cover == WHS_CartridgeCoverOPEN))// for Mid-tank filling { - REPORT_MSG(parameter," ------------ Mid-tank Filling : Close cartridge cover ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ Mid-tank Filling : Close cartridge cover -------------", __FILE__, __LINE__, WHS_info.WHS_sensors.cartridge_cover, RpMessage, 0, 0); } /*else if(WHS_info.WHS_sensors.cartridge_cover == WHS_CartridgeCoverOPEN) { @@ -1087,15 +1042,13 @@ WHS_sensor CartridgeCoverCallBackFunction() WHS_sensor CartridgeWaste1CallBackFunction() { - uint32_t parameter = 6 ; - WHS_sensor ret = WHS_no_event; //ret = RdCartridgeCoverSensor(); if (WHS_info.WHS_sensors.waste_cartridge1_precense_sensor != RdWasteCartridge1Sensor()) { - REPORT_MSG(parameter," ------------ find : WHS_waste1_presence_sensor event ----------------- "); WHS_info.event = WHS_waste1_presence_sensor; WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = !WHS_info.WHS_sensors.waste_cartridge1_precense_sensor; + ReportWithPackageFilter(WasteFilter,"------------ find : WHS_waste1_presence_sensor event -------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_cartridge1_precense_sensor, RpMessage, 0, 0); ret = WHS_waste1_presence_sensor; } return ret; @@ -1103,15 +1056,13 @@ WHS_sensor CartridgeWaste1CallBackFunction() WHS_sensor CartridgeWaste2CallBackFunction() { - uint32_t parameter = 6 ; - WHS_sensor ret = WHS_no_event; - //ret = RdCartridgeCoverSensor(); + if (WHS_info.WHS_sensors.waste_cartridge2_precense_sensor != RdWasteCartridge2Sensor()) { - REPORT_MSG(parameter," ------------ find : WHS_waste2_presence_sensor event ----------------- "); WHS_info.event = WHS_waste2_presence_sensor; WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = !WHS_info.WHS_sensors.waste_cartridge2_precense_sensor; + ReportWithPackageFilter(WasteFilter,"------------ find : WHS_waste2_presence_sensor event -------------", __FILE__, __LINE__, WHS_info.WHS_sensors.waste_cartridge2_precense_sensor, RpMessage, 0, 0); ret = WHS_waste2_presence_sensor; } return ret; @@ -1120,42 +1071,40 @@ WHS_sensor CartridgeWaste2CallBackFunction() /*------------------------------- Waste Cartridge + IFS Cartridge -----------------------------------------*/ bool InitCartStatus() { - uint32_t parameter = 6 ; - WHS_info.WHS_sensors.cartridge_cover = RdCartridgeCoverSensor(); /* INK => CART_1 */ - REPORT_MSG(parameter," ------------------------------------------------------------------------------------------ "); - REPORT_MSG(parameter," ------------!!!!!!! at INIT what to do if IFS_INK is presence !!!!!!! ----------------- "); - REPORT_MSG(parameter," ------------------------------------------------------------------------------------------ "); + ReportWithPackageFilter(WasteFilter,"------------------------------------------------------------------------------------------", __FILE__,__LINE__,0, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ !!!!!!! at INIT what to do if IFS_INK is presence !!!!!!! -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------------------------------------------------------------------------------------", __FILE__,__LINE__,0, RpMessage, 0, 0); if (RdInkCartridgeSensor()) { - REPORT_MSG(parameter," ------------ INIT : IFS_INK is presence ----------------- "); - IFS_info.IFS_Ink_precense_sensor = CarteidgePrecense; - Pannel_Leds( CART_1, MODE_ON); - cart1.color = colorON; + IFS_info.IFS_Ink_precense_sensor = CarteidgePrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : IFS_INK is presence -----------------", __FILE__,__LINE__, IFS_info.IFS_Ink_precense_sensor, RpMessage, 0, 0); + Pannel_Leds( CART_1, MODE_ON); + cart1.color = colorON; } else { - REPORT_MSG(parameter," ------------ INIT : IFS_INK is NOT presence ----------------- "); - IFS_info.IFS_Ink_precense_sensor = CarteidgeNotPrecense; - Pannel_Leds( CART_1, MODE_OFF); - cart1.color = colorOFF; + IFS_info.IFS_Ink_precense_sensor = CarteidgeNotPrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : IFS_INK is NOT presence -----------------", __FILE__,__LINE__, IFS_info.IFS_Ink_precense_sensor, RpMessage, 0, 0); + Pannel_Leds( CART_1, MODE_OFF); + cart1.color = colorOFF; } /* waste_cartridge1 => CART_2 */ if (RdWasteCartridge1Sensor()) { - REPORT_MSG(parameter," ------------ INIT : WHS_waste1 cart is presence ----------------- "); WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = CarteidgePrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : WHS_waste1 cart is presence -----------------", __FILE__,__LINE__, WHS_info.WHS_sensors.waste_cartridge1_precense_sensor, RpMessage, 0, 0); Pannel_Leds( CART_2, MODE_ON); cart2.color = colorON; } else { - REPORT_MSG(parameter," ------------ INIT : WHS_waste1 cart is NOT presence !!! ----------------- "); WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = CarteidgeNotPrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : WHS_waste1 cart is NOT presence !!! -----------------", __FILE__,__LINE__,WHS_info.WHS_sensors.waste_cartridge1_precense_sensor, RpMessage, 0, 0); Pannel_Leds( CART_2, MODE_OFF); cart2.color = colorOFF; } @@ -1163,21 +1112,19 @@ bool InitCartStatus() /* waste_cartridge2 => CART_3 */ if (RdWasteCartridge2Sensor()) { - REPORT_MSG(parameter," ------------ INIT : WHS_waste2 cart is presence ----------------- "); WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = CarteidgePrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : WHS_waste2 cart is presence -----------------", __FILE__,__LINE__, WHS_info.WHS_sensors.waste_cartridge2_precense_sensor, RpMessage, 0, 0); Pannel_Leds( CART_3, MODE_ON); cart3.color = colorON; } else { - REPORT_MSG(parameter," ------------ INIT : WHS_waste2 cart is NOT presence_sensor !!! ----------------- "); WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = CarteidgeNotPrecense; + ReportWithPackageFilter(WasteFilter,"------------ INIT : WHS_waste2 cart is NOT presence_sensor !!! -----------------", __FILE__,__LINE__, WHS_info.WHS_sensors.waste_cartridge2_precense_sensor, RpMessage, 0, 0); Pannel_Leds( CART_3, MODE_OFF); cart3.color = colorOFF; } - - if (IFS_info.IFS_Ink_precense_sensor == CarteidgePrecense) CartridgeAuthentication(INK_cartridge); if (WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == CarteidgePrecense) CartridgeAuthentication(waste_cartridge1); if (WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == CarteidgePrecense) CartridgeAuthentication(waste_cartridge2); @@ -1185,7 +1132,7 @@ bool InitCartStatus() if (WHS_info.WHS_sensors.cartridge_cover == WHS_CartridgeCoverOPEN) { - REPORT_MSG(parameter," ------------ WHS_CartridgeCoverOPEN : add callback for cart1 and cart 2 ----------------- "); + ReportWithPackageFilter(WasteFilter,"------------ WHS_CartridgeCoverOPEN : add callback for cart1 and cart 2 -----------------", __FILE__,__LINE__, WHS_info.WHS_sensors.cartridge_cover, RpMessage, 0, 0); IFS_info.Cartridge_Ink_device_Id = AddControlCallback("Ink Cartridge CB" , WasteTankCBFunction, eOneSecond, CartridgeInkCallBackFunction , 0,0,0 ); WHS_info.Cartridge_Waste1_device_Id = AddControlCallback("Waste1 Cartridge CB", WasteTankCBFunction, eOneSecond, CartridgeWaste1CallBackFunction, 0,0,0 ); WHS_info.Cartridge_Waste2_device_Id = AddControlCallback("Waste2 Cartridge CB", WasteTankCBFunction, eOneSecond, CartridgeWaste2CallBackFunction, 0,0,0 ); @@ -1199,8 +1146,6 @@ bool RdInkCartridgeSensor() { bool ret = notOK; WHS_Read_GPI_Registers(); - //WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = Is_Cartridge_Present(CART_2); - //ret = WHS_info.WHS_sensors.waste_cartridge1_precense_sensor; ret = Is_Cartridge_Present(CART_1); return ret; } @@ -1209,8 +1154,6 @@ bool RdWasteCartridge1Sensor() { bool ret = notOK; WHS_Read_GPI_Registers(); - //WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = Is_Cartridge_Present(CART_2); - //ret = WHS_info.WHS_sensors.waste_cartridge1_precense_sensor; ret = Is_Cartridge_Present(CART_2); return ret; } @@ -1219,37 +1162,34 @@ bool RdWasteCartridge2Sensor() { bool ret = notOK; WHS_Read_GPI_Registers(); - //WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = Is_Cartridge_Present(CART_3); - //ret = WHS_info.WHS_sensors.waste_cartridge2_precense_sensor; ret = Is_Cartridge_Present(CART_3); return ret; } bool SetActiveWastCartridge() { - uint8_t parameter = 5; - bool ret = notOK; + if (( WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == PRECENSE ) && (WHS_info.cartridge_1.autheticate == PASSED) && (WHS_info.cartridge_1.status == WasteEmpty)) { - REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 1 ----------------- "); WHS_info.active_cartridge = waste_cartridge1; + ReportWithPackageFilter(WasteFilter,"------------ WHS : active_cartridge = waste_cartridge 1 -----------------", __FILE__,__LINE__, WHS_info.active_cartridge, RpMessage, 0, 0); AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } else if (( WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == PRECENSE) && (WHS_info.cartridge_2.autheticate == PASSED) && (WHS_info.cartridge_2.status == WasteEmpty)) { - REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 2 ----------------- "); WHS_info.active_cartridge = waste_cartridge2; + ReportWithPackageFilter(WasteFilter,"------------ WHS : active_cartridge = waste_cartridge 2 -----------------", __FILE__,__LINE__, WHS_info.active_cartridge, RpMessage, 0, 0); AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } else { - REPORT_MSG(parameter," ------------ WHS : NO active_cartridge ----------------- "); WHS_info.active_cartridge = no_waste_cartridge; + ReportWithPackageFilter(WasteFilter,"------------ WHS : NO active_cartridge -----------------", __FILE__,__LINE__, WHS_info.active_cartridge, RpMessage, 0, 0); AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, true); } return ret; diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c index a255f55a0..99b96ddf3 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c @@ -9,13 +9,13 @@ #include <Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.h> #include <Drivers/I2C_Communication/I2C.h> #include "Drivers/I2C_Communication/WHS_Card/WHS_data.h" -#include <Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h> #include <Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.h> #include <Drivers/I2C_Communication/I2C_Task.h> #include <Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h> #include <Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h> #include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h> #include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h> +#include <Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.h> #include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h> bool test_9555(void); @@ -24,17 +24,21 @@ bool WHS_I2C_EEprom_Write_Ch_shai_taest(void); bool newWHS_init(void) { bool status = OK; - Main_Mux_Flag = 0; + + //Main_Mux_Flag = 0; // delayms(4000); // status = Select_Main_WHS_Mux_Channel(); + + //Trigger_Check_WHS_Type_Via_EEPROM(); Trigger_WHS_init_IO(); Trigger_WHS_init_fan(); Trigger_WHS_init_PT100(); Trigger_WHS_init_Blower(); Trigger_WHS_MAX11614_Init(); Trigger_WHS_Rheostat_init(); + //status |= WHS_IO_Init(); //status |= init_WHS_fan(); // |
