From 63a7b55a394c99048e6662823b8c4ead962e3eab Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 1 Jun 2020 20:06:06 +0300 Subject: head eeprom failure causes bit failure and red activity led whs eeprom failure causes bit failure and orange activity led secondary heater deactivated when not active file system control failures --- .../Embedded/Common/SWUpdate/FileSystem.c | 19 ++++++++++++++++ .../Head_Card/EEPROM/Head_EEPROM.c | 2 ++ .../I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c | 8 +++++++ .../Embedded/Modules/Heaters/Heaters_print.c | 26 ++++++++++++++++++++-- .../Embedded/Modules/Thread/Thread_print.c | 17 +++++++++++++- .../StateMachines/Initialization/InitSequence.c | 3 ++- 6 files changed, 71 insertions(+), 4 deletions(-) (limited to 'Software/Embedded_SW') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 794ef6d37..1b53a826b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -35,6 +35,7 @@ #include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" +#include "Modules/Control/Control.h" #include "StateMachines/Printing/PrintingSTM.h" @@ -152,6 +153,20 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) return OK; } FRESULT lFresult = FR_OK; +uint32_t Chunk_ControlId = 0xFF; +uint32_t FileChunkUploadCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + Report("chunk timeout error",__FILE__,IfIndex,FileReceivedLength,RpWarning,BusyFlag,0); + f_close(UploadFileHandle); + my_free (UploadFileHandle); + UploadFileHandle = 0; + FileReceivedLength = 0; + FileDone = true; + if (SafeRemoveControlCallback(Chunk_ControlId, FileChunkUploadCallBackFunction )==OK) + Chunk_ControlId = 0xFF; + +} + uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { //uint32_t status = OK; @@ -184,6 +199,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { KeepAliveOneSecondCounter = 0; save_milisec = msec_millisecondCounter; + Chunk_ControlId = AddControlCallback("chunk", FileChunkUploadCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,request->buffer.len, WrittenBytes ); + Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes ); lFresult = Fresult; if(Fresult != FR_OK) @@ -195,6 +212,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { FileReceivedLength += WrittenBytes; ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,FileLength,FileReceivedLength, RpMessage,msec_millisecondCounter-save_milisec, 0); + RemoveControlCallback(Chunk_ControlId, FileChunkUploadCallBackFunction ); + Chunk_ControlId = 0xFF; //REPORT_MSG (FileReceivedLength,"file upload chunk"); if (FileReceivedLength == FileLength) 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 17e8cfb46..fa584a683 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 @@ -7,6 +7,7 @@ #include "include.h" #include "Head_EEPROM.h" #include +#include "PMR/Diagnostics/EventType.pb-c.h" #include "../I2C_Head_Mux.h" #include "driverlib/i2c.h" @@ -119,6 +120,7 @@ uint32_t Check_Head_Type_Via_EEPROM() if (status == 0xFF) { ACTIVITY_RED_LED_ON; + AlarmHandlingSetAlarm(EVENT_TYPE__POWER_UP_BIT_FAILURE, true); } if((Head_i2c_status == I2C_MASTER_ERR_ADDR_ACK)||(status == 0xFF)) 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 86a88197c..4e889f58c 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 @@ -16,6 +16,8 @@ #include "PMR/stubs/StubWhsEEpromData.pb-c.h" #include "PMR/stubs/StubWhsEEpromRequest.pb-c.h" #include "PMR/stubs/StubWhsEEpromResponse.pb-c.h" +#include "PMR/Diagnostics/EventType.pb-c.h" + //EEPROM M24M01-DFMN6TP //uint32_t I2C_WHS_EEPROM_SLAVE_ADD = 0xA0; @@ -95,6 +97,12 @@ uint32_t Check_WHS_Type_Via_EEPROM() Select_Main_WHS_Mux_Channel(); status = WHS_I2C_EEprom_Write_Byte(WHS_TYPE_ADDR, &data); + if (status == 0xFF) + { + ACTIVITY_RED_LED_ON; + ACTIVITY_GREEN_LED_ON; + AlarmHandlingSetAlarm(EVENT_TYPE__POWER_UP_BIT_FAILURE, true); + } if (status) //if(I2CMasterErr(I2C_ID_WHS_CARD) == I2C_MASTER_ERR_NONE) diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 1f1976e0e..95441d1a6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1191,6 +1191,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } */ // if ((readValue > (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target + if ( (readValue > (HeaterCmd[index].targettemperatue * ((100-HeaterControl[index].outputproportionalband)/100))) && (readValue < (HeaterCmd[index].targettemperatue * ((100+HeaterControl[index].outputproportionalband)/100)))) { @@ -1200,7 +1201,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) HeaterRecalculateSharedHeatersParams(HEATER_TYPE__DryerSecondaryHeater, 0); HeatersControlStart(); AlarmHandlingSetAlarm(HeaterUnderEventType[index], false); - if (BlowerCfg.enabled == true) + /*if (BlowerCfg.enabled == true) { if(Head_Type > HEAD_TYPE_SYLKO_WITHOUT_CARD) { @@ -1212,7 +1213,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) if (BlowerCfg.voltage) Control_Voltage_To_Blower(BlowerCfg.voltage); } - } + }*/ HeaterReady[index] = true; //Disable_Reading_Heaters_Current(HeaterId2CurrentId[HEATER_TYPE__DryerMainHeater]); //Disable_Reading_Heaters_Current(HeaterId2CurrentId[HEATER_TYPE__DryerSecondaryHeater]); @@ -1230,6 +1231,23 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) HeaterPrepareReady(); } } + if ( (readValue > (HeaterCmd[index].targettemperatue * ((100-HeaterControl[index].outputproportionalband+2)/100))) + && (readValue < (HeaterCmd[index].targettemperatue * ((100+HeaterControl[index].outputproportionalband)/100)))) + { + if (BlowerCfg.enabled == true) + { + if(Head_Type > HEAD_TYPE_SYLKO_WITHOUT_CARD) + { + WHS_Set_SetPoint_Q_value(headairflow); + } + else + { + Turn_the_Blower_On();//Turn on with the Default_Voltage + if (BlowerCfg.voltage) + Control_Voltage_To_Blower(BlowerCfg.voltage); + } + } + } if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0)) { HeaterPIDConfig[index].m_mesuredParam = readValue; @@ -1680,6 +1698,10 @@ uint32_t HeatersControlLoop(uint32_t tick) //DeActivate HEATER_TYPE__DryerSecondaryHeater //DeActivateHeater (HEATER_TYPE__DryerSecondaryHeater); } + else + { + DeActivateHeater (HEATER_TYPE__DryerSecondaryHeater); + } } /*else if (TimeSliceAllocation[SliceCounter] == HEATER_TYPE__DryerSecondaryHeater) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index edfc517bf..386b34f49 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -961,7 +961,7 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) } MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, Hard_Stop); - if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) != LIMIT) + /*if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) != LIMIT) { ReportWithPackageFilter(ThreadFilter,"Dyeing head is open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpFatalError,LIMIT,0); //JobEndReason = JOB_LIDS_OPEN; @@ -974,6 +974,21 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) //JobEndReason = JOB_LIDS_OPEN; //PrepareReady(Module_Thread,ModuleFail); //return ERROR; + }*/ + + if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) == LIMIT) + { + ReportWithPackageFilter(ThreadFilter,"Dyeing head is wide open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpFatalError,LIMIT,0); + JobEndReason = JOB_LIDS_OPEN; + PrepareReady(Module_Thread,ModuleFail); + return ERROR; + } + if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID]) == LIMIT) + { + ReportWithPackageFilter(ThreadFilter,"Dryer lid is wide open!!!",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DRYER_LID,RpFatalError,LIMIT,0); + JobEndReason = JOB_LIDS_OPEN; + PrepareReady(Module_Thread,ModuleFail); + return ERROR; } //start thread control for all motors diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index d8367316b..fb5cd884d 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -573,7 +573,7 @@ void InitSequenceSetStartHeating(bool StartHeating) uint32_t InitSequenceStartHeating(void) { SetMachineReadyForHeating(true); - SetMachineStatus(MACHINE_STATE__Ready); //prevent job while waiting for the cooler + //SetMachineStatus(MACHINE_STATE__Ready); //prevent job while waiting for the cooler if (InitialHeating) { @@ -594,6 +594,7 @@ uint32_t InitSequenceStartHeating(void) else { REPORT_MSG(InitialHeating,"InitSequenceStateMachine InitialHeating is OFF"); + SetMachineStatus(MACHINE_STATE__Ready); SetMachineState(MACHINE_STATE_MACHINE_READY_TO_DYE); InitStages++; } -- cgit v1.3.1