From 5baa36de16ba1e55cd8dd735e8e83caaf56a358e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 1 Jun 2020 10:48:22 +0300 Subject: fix head identification; remove adc interrupt --- Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 84d8fa725..794ef6d37 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -177,7 +177,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) if (ReceivedFileHandle==NULL) { Fresult = FR_DENIED; - Report("file chunk uplad rejected - file not created", __FILE__, __LINE__, 4, RpWarning, (int)0, 0); + Report("file chunk upload rejected - file not created", __FILE__, __LINE__, 4, RpWarning, (int)0, 0); FileDone = true; } else -- cgit v1.3.1 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/Embedded/Common/SWUpdate/FileSystem.c') 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 From bfc8d0cc2055b7fa5171aeace011435e23f71359 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 9 Jun 2020 15:56:31 +0300 Subject: fixing some bugs in version 30 --- .../Embedded/Common/SWUpdate/FileSystem.c | 14 +++- .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 1 - .../PMR/Diagnostics/DiagnosticsMonitors.pb-c.c | 32 +++++++- .../PMR/Diagnostics/DiagnosticsMonitors.pb-c.h | 6 +- .../PMR/Hardware/HardwareBlowerType.pb-c.c | 14 ++-- .../PMR/Hardware/HardwareBlowerType.pb-c.h | 4 +- Software/Embedded_SW/Embedded/DataDef.h | 3 + .../Drivers/ADC_Sampling/ADC_DispPressSens.c | 2 +- .../Flash_Memory/FATFS/Control_File_System.c | 3 +- .../WHS_Card/D_EMC2302_Fan/WHS_Fan.c | 2 + .../WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c | 4 +- Software/Embedded_SW/Embedded/Embedded.cfg | 6 ++ Software/Embedded_SW/Embedded/Main.c | 5 ++ .../Modules/Diagnostics/DiagnosticsJogging.c | 17 ++++- .../Embedded/Modules/General/GeneralHardware.c | 16 ++++ .../Embedded_SW/Embedded/Modules/General/process.c | 5 ++ .../Embedded/Modules/Heaters/Heaters_print.c | 5 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 5 ++ .../Embedded/Modules/Thread/ThreadLoad.c | 5 +- .../Embedded/Modules/Thread/Thread_Winder.c | 4 +- .../Embedded/Modules/Thread/Thread_ex.h | 1 + .../Embedded/Modules/Thread/Thread_print.c | 19 +++-- .../StateMachines/Initialization/InitSequence.c | 22 +++++- .../StateMachines/Initialization/InitSequence.h | 1 + .../Initialization/PowerOffSequence.c | 89 ++++++++++++++++------ .../Embedded/StateMachines/Printing/JobSTM.c | 4 +- .../Embedded/StateMachines/Printing/PrintingSTM.c | 2 - 27 files changed, 228 insertions(+), 63 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 1b53a826b..65328efb3 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -60,6 +60,7 @@ uint32_t ReadBytes = 0; Task_Handle CommRxTaskHandle; extern Semaphore_Handle FFS_Sem; +extern Semaphore_Handle FileUpload_sem_param; ErrorCode getErrorCode(FRESULT Fresult) { @@ -101,7 +102,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (Semaphore_pend(FileUpload_sem_param, BIOS_NO_WAIT)) { CommRxTaskHandle = Task_self(); Task_setPri(CommRxTaskHandle, 2); @@ -125,7 +126,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) { my_free (UploadFileHandle); UploadFileHandle = 0; - Semaphore_post(FFS_Sem); + Semaphore_post(FileUpload_sem_param); } } else @@ -162,9 +163,14 @@ uint32_t FileChunkUploadCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; + Task_setPri(CommRxTaskHandle, 9); + Semaphore_post(FileUpload_sem_param); + //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); if (SafeRemoveControlCallback(Chunk_ControlId, FileChunkUploadCallBackFunction )==OK) Chunk_ControlId = 0xFF; + return OK; + } uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) @@ -257,7 +263,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) if (FileDone == true) { Task_setPri(CommRxTaskHandle, 9); - Semaphore_post(FFS_Sem); + Semaphore_post(FileUpload_sem_param); //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); } return OK; @@ -273,7 +279,7 @@ void FileChunkUploadError(void) FileReceivedLength = 0; FileDone = true; Task_setPri(CommRxTaskHandle, 9); - Semaphore_post(FFS_Sem); + Semaphore_post(FileUpload_sem_param); } } uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer) diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index f39f6a5eb..013a06e22 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -32,7 +32,6 @@ #include "Modules/AlarmHandling/AlarmHandling.h" #include "modules/General/process.h" -extern Semaphore_Handle FFS_Sem; int NumberOfFiles = 0,CurrentRunningFile; int CurrentFileSize = 0; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.c index f8b36e663..14b93a98c 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.c @@ -52,7 +52,7 @@ void diagnostics_monitors__free_unpacked assert(message->base.descriptor == &diagnostics_monitors__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor diagnostics_monitors__field_descriptors[88] = +static const ProtobufCFieldDescriptor diagnostics_monitors__field_descriptors[90] = { { "", @@ -1110,6 +1110,30 @@ static const ProtobufCFieldDescriptor diagnostics_monitors__field_descriptors[88 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "", + 89, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(DiagnosticsMonitors, n_headblower1airflow), + offsetof(DiagnosticsMonitors, headblower1airflow), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "", + 90, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(DiagnosticsMonitors, n_headblower2airflow), + offsetof(DiagnosticsMonitors, headblower2airflow), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned diagnostics_monitors__field_indices_by_name[] = { 38, /* field[38] = BlowerVoltage */ @@ -1150,6 +1174,8 @@ static const unsigned diagnostics_monitors__field_indices_by_name[] = { 25, /* field[25] = FilterDeltaPressure */ 85, /* field[85] = GasSensor */ 13, /* field[13] = HeadAirFlow */ + 88, /* field[88] = HeadBlower1AirFlow */ + 89, /* field[89] = HeadBlower2AirFlow */ 78, /* field[78] = HeadBlowerVoltage1 */ 79, /* field[79] = HeadBlowerVoltage2 */ 80, /* field[80] = HeadCoverHeater1Current */ @@ -1204,7 +1230,7 @@ static const unsigned diagnostics_monitors__field_indices_by_name[] = { static const ProtobufCIntRange diagnostics_monitors__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 88 } + { 0, 90 } }; const ProtobufCMessageDescriptor diagnostics_monitors__descriptor = { @@ -1214,7 +1240,7 @@ const ProtobufCMessageDescriptor diagnostics_monitors__descriptor = "", "", sizeof(DiagnosticsMonitors), - 88, + 90, diagnostics_monitors__field_descriptors, diagnostics_monitors__field_indices_by_name, 1, diagnostics_monitors__number_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.h index 172fb5e24..a6a28e4d0 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/DiagnosticsMonitors.pb-c.h @@ -203,10 +203,14 @@ struct _DiagnosticsMonitors double *incomingvoltage; size_t n_wastelevel; double *wastelevel; + size_t n_headblower1airflow; + double *headblower1airflow; + size_t n_headblower2airflow; + double *headblower2airflow; }; #define DIAGNOSTICS_MONITORS__INIT \ { PROTOBUF_C_MESSAGE_INIT (&diagnostics_monitors__descriptor) \ - , 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL } + , 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL } /* DiagnosticsMonitors methods */ diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.c index 0cc200a76..079666ee2 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.c @@ -7,22 +7,26 @@ #endif #include "HardwareBlowerType.pb-c.h" -static const ProtobufCEnumValue hardware_blower_type__enum_values_by_number[4] = +static const ProtobufCEnumValue hardware_blower_type__enum_values_by_number[6] = { { "", "", 0 }, { "", "", 1 }, { "", "", 2 }, { "", "", 3 }, + { "", "", 4 }, + { "", "", 5 }, }; static const ProtobufCIntRange hardware_blower_type__value_ranges[] = { -{0, 0},{0, 4} +{0, 0},{0, 6} }; -static const ProtobufCEnumValueIndex hardware_blower_type__enum_values_by_name[4] = +static const ProtobufCEnumValueIndex hardware_blower_type__enum_values_by_name[6] = { { "", 0 }, { "", 1 }, { "", 2 }, { "", 3 }, + { "", 5 }, + { "", 4 }, }; const ProtobufCEnumDescriptor hardware_blower_type__descriptor = { @@ -31,9 +35,9 @@ const ProtobufCEnumDescriptor hardware_blower_type__descriptor = "", "", "", - 4, + 6, hardware_blower_type__enum_values_by_number, - 4, + 6, hardware_blower_type__enum_values_by_name, 1, hardware_blower_type__value_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.h index b530430ff..84beee442 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareBlowerType.pb-c.h @@ -23,7 +23,9 @@ typedef enum _HardwareBlowerType { HARDWARE_BLOWER_TYPE__DefaultBlower = 0, HARDWARE_BLOWER_TYPE__HeadBlower1 = 1, HARDWARE_BLOWER_TYPE__HeadBlower2 = 2, - HARDWARE_BLOWER_TYPE__WHSBlower2 = 3 + HARDWARE_BLOWER_TYPE__WHSBlower2 = 3, + HARDWARE_BLOWER_TYPE__WHSSmallFans = 4, + HARDWARE_BLOWER_TYPE__WHSLargeFans = 5 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(HARDWARE_BLOWER_TYPE) } HardwareBlowerType; diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index a50889e47..ca8217683 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -165,6 +165,7 @@ enum #define STOPPED 0 #define MOVING 1 +extern int InitFailures; /* #define CurrentMotDriver 0x08 @@ -391,6 +392,8 @@ typedef enum }WHS_TYPE; extern uint8_t WHS_Type; +extern uint8_t SmallFansCfg; +extern uint8_t LargeFansCfg; bool Is_PP_Machine(void); diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC_DispPressSens.c b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC_DispPressSens.c index b1fbcbf44..f2cc8d093 100644 --- a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC_DispPressSens.c +++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC_DispPressSens.c @@ -71,7 +71,7 @@ float CalculateDispenserPressure (int DispenserId) if(data 0.05) + if (tmp > 0.02) { volt = getBlowerState(); //volt = g_MAX5805_device.CODE; @@ -486,7 +486,7 @@ void WHS_Set_SetPoint_Q_value(double value) SetPoint_Q = value; CofigurationFlow = 0; WHS_Start_Blower_Control_Closed_Loop(); - Report("------------ SetPoint_Q_value :-----------------", __FILE__,__LINE__, (int)(SetPoint_Q*100), RpMessage, (int)CofigurationFlow, 0); + Report("------------ SetPoint_Q_value :-----------------", __FILE__,__LINE__, (int)(SetPoint_Q*100), RpMessage, (int)close_loop_time, 0); } void WHS_enable_control_loop(bool value) // 0=disable 1= enable diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index 666d9f9b3..10f94e08c 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -86,6 +86,12 @@ semaphore6Params.instance.name = "FFS_Sem"; semaphore6Params.mode = Semaphore.Mode_BINARY; Program.global.FFS_Sem = Semaphore.create(null, semaphore6Params); +var semaphore8Params = new Semaphore.Params(); +semaphore8Params.instance.name = "FileUpload_sem_param"; +semaphore8Params.mode = Semaphore.Mode_BINARY; +Program.global.FileUpload_sem_param = Semaphore.create(null, semaphore8Params); + + var semaphore7Params = new Semaphore.Params(); semaphore7Params.instance.name = "ReconnectSem"; semaphore7Params.mode = Semaphore.Mode_BINARY; diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index a5ddb694b..ed4948a28 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -135,6 +135,10 @@ Void errHook(Error_Block *eb) COMM_GREEN_LED_OFF; STATUS_RED_LED_ON; + //MCU_E2PromRead(EEPROM_INIT_FAILURE_COUNTER,&InitFailures); + InitFailures++; + MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,InitFailures); + ACTIVITY_RED_LED_ON; COMM_RED_LED_ON; @@ -249,6 +253,7 @@ int main(void) LOG_ERROR(Version.m_minor,"Version change, do stuff"); FlashInit(); MCU_E2PromEmbeddedVersionProgram(); + MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,0); } #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c index 5b8866a28..0bb16c623 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c @@ -39,6 +39,7 @@ uint32_t MotorJoggingRequestFunc(MessageContainer* requestContainer) { uint32_t status = OK; + bool allowedInJob =true; MessageContainer responseContainer; @@ -51,9 +52,23 @@ uint32_t MotorJoggingRequestFunc(MessageContainer* requestContainer) int speed = request->speed; if (speed == 0) speed = 150; + if (JobIsActive() == true) + { + switch (MotorId) + { + case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_2:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_3:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_4: + case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_5:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_6:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_7:case HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8: + case HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING:case HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM:case HARDWARE_MOTOR_TYPE__MOTO_SCREW:case HARDWARE_MOTOR_TYPE__MOTO_WINDER: + case HARDWARE_MOTOR_TYPE__MOTO_LDRIVING:case HARDWARE_MOTOR_TYPE__MOTO_LLOADING:case HARDWARE_MOTOR_TYPE__MOTO_RDRIVING:case HARDWARE_MOTOR_TYPE__MOTO_RLOADING: + allowedInJob = false; + break; + default: + break; + } + } if (MotorId <= NUM_OF_MOTORS) { - if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) + if ((allowedInJob == true)&&(isMotorConfigured(MotorId) == true)) { { switch (request->direction) diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 39d10bfc2..d0470a11b 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -396,6 +396,13 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) LOG_ERROR (0, "Wrong Data Allocation"); return ERROR; } + if (InitFailures > 3) + { + Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); + AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON); + return ERROR; + } + HardwareConfiguration *request = UploadRequest->hardwareconfiguration; if (JobIsActive()) @@ -528,6 +535,15 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) break; } + if((request->blowers[Dispenser_i]->enabled)&&(request->blowers[Dispenser_i]->hardwareblowertype == HARDWARE_BLOWER_TYPE__WHSSmallFans)) + { + SmallFansCfg = request->blowers[Dispenser_i]->voltage; + } + if((request->blowers[Dispenser_i]->enabled)&&(request->blowers[Dispenser_i]->hardwareblowertype == HARDWARE_BLOWER_TYPE__WHSLargeFans)) + { + LargeFansCfg = request->blowers[Dispenser_i]->voltage; + } + } } ControlStart(); diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 1e04ccb83..7bf72ba8c 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -125,6 +125,11 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams,bool saveData) ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH+4, Bytes, ProcessParams); REPORT_MSG(Bytes,"Bytes write to flash"); } + else + { + ProcessParams->headairflow = headairflow; + ReportWithPackageFilter(InitFilter,"HandleProcessParameters temp off blower on",__FILE__,(int)__LINE__,(int)ProcessParams->headairflow,RpWarning,(int)ProcessParametersKeep.headairflow,0); + } } HeatersStopControlOnHeatersOff(ProcessParams); dyeingspeed = ProcessParams->dyeingspeed; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 380eb99ca..53501e3db 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1149,7 +1149,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) if ((readValue>(HeaterCmd[index].targettemperatue+800))&&(getIdleState() == false)) { - ReportWithPackageFilter(HeatersFilter, "AC OverHeating in progress",__FILE__,readValue,HeaterReady[index],RpError, HeaterAtTemp[index],0); + ReportWithPackageFilter(HeatersFilter, "AC OverHeating in progress",__FILE__,readValue,GetHeaterState(HEATER_TYPE__DryerMainHeater),RpError, GetHeaterState(HEATER_TYPE__DryerSecondaryHeater),0); ReportWithPackageFilter(HeatersFilter, "AC OverHeating PID",__FILE__,(int)HeaterPIDConfig[index].m_calculatedError,(int)HeaterPIDConfig[index].m_SetParam,RpError, (int)HeaterPIDConfig[index].m_integral,0); } // check if the read value is within the proportional band @@ -1636,9 +1636,10 @@ uint32_t DrierHeaterVoltageSetup(void) } else { - Z1Current = Get_Heaters_Current(HEATER_DRYER_CURRENT_1); + Z1Current = GetZone1RMSCurrent(DrierAcVoltage); //changed to assumed current as calculated on init Z2AssumedCurrent = GetZone2RMSCurrent(DrierAcVoltage); LimitCurrent = TotalCurrentLimit(DrierAcVoltage); + //hysteresis: activate if ((Z2AssumedCurrent+Z1Current)>LimitCurrent) { UseSecondaryDrierHeater = false; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 1c43872cc..a713ce355 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -725,6 +725,11 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) Report("Setting pressure from RML feeder tension",__FILE__,__LINE__,(int)(cleanerFlow),RpWarning,(int)CleaningDispenserSpeed,0); CleaningDispenserSpeed = cleanerFlow; } + else if (cleanerFlow <= 10) + { + CleaningDispenserSpeed = 0; + EnableCleaning = false; + } for (Motor_i = 0;Motor_i < MAX_SYSTEM_DISPENSERS;Motor_i++) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 349215d7d..50750a49e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -190,6 +190,9 @@ ProcessParametersClear.lblowerflow = 0; ProcessParametersClear.dyeingspeed = 40; ProcessParametersClear.dryerbufferlength = ProcessParametersKeep.dryerbufferlength; + ProcessParametersClear.pullertension = ProcessParametersKeep.pullertension; + ProcessParametersClear.windertension = ProcessParametersKeep.windertension; + if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) { LOG_ERROR (LoadStages, "Thread_Load_Reduce_Heat failed"); @@ -286,7 +289,7 @@ { TimeoutsCounter = 0; load.color = fastBILNK; - usnprintf(LoadErrorMsg, 100, "Stage %s - motor %s timeout",LoadStagesStr[LoadStages], MotorStr[MotorId]); + usnprintf(LoadErrorMsg, 100, "Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[MotorId]); Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0); LoadStatus = ERROR; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 9ee2e1f37..ca41a8e70 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -149,12 +149,12 @@ uint32_t Winder_Prepare(void *JobDetails) if (FPGA_Read_limit_Switches(GPI_SW_SPOOL_EXISTS)==LIMIT) { REPORT_MSG(LIMIT, "No cone in winder"); - if (Is_PP_Machine()) + /*if (Is_PP_Machine()) { PrepareReady(Module_Winder,ModuleFail); AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true); return ERROR; - } + }*/ } #ifdef READ_SCREW_ENCODER diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 1e730e252..5c9b360f6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -81,6 +81,7 @@ void ThreadLoadRequest(MessageContainer* requestContainer); uint32_t StartThreadLoadingFunc(MessageContainer* requestContainer); uint32_t ContinueThreadLoadingFunc(MessageContainer* requestContainer); uint32_t StopThreadLoadingFunc(MessageContainer* requestContainer); +uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer); uint32_t Thread_Load_End(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 545fb40e6..efcbd5030 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -217,6 +217,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) if (FeederSpeedIndex>=SPEED_STORE_SIZE) { FeederSpeedIndex = 0; + FeederSpeedAverage = 0; for (Speed_i = 0;Speed_i=SPEED_STORE_SIZE) { PullerSpeedIndex = 0; + PullerSpeedAverage = 0; for (Speed_i = 0;Speed_i 100) { InitFailures = 0; @@ -114,7 +117,7 @@ uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) if (InitFailures > 3) { Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); - SetMachineState(status); + SetMachineState(MACHINE_STATE_HW_CONFIG_FAILED); AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON); SetMachineStatus(MACHINE_STATE__Error); return ERROR; @@ -173,7 +176,6 @@ void InitSequenceBuiltInTestCallBack(uint32_t IfIndex, uint32_t BusyFlag) InitStages++; //InitSequenceStateMachine(InitStages); AlarmHandlingSetAlarm(EVENT_TYPE__POWER_UP_BIT_FAILURE,false); - MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,0); } else { @@ -262,6 +264,7 @@ double MainCurrent,SecondaryCurrent,StableCurrent; double InitDrierAcVoltage = 0.0; int InitDrierAcVoltageCount = 0; double Zone2Resistance = 0.0; +double Zone1Resistance = 0.0; int WaitForCurrentRaise = 0;//let the heater current raise void InitCurrentReadingStable(void) { @@ -302,6 +305,11 @@ bool DetectIfCurrentReadingStable(double HeaterCurrent) } return ret; } + +double GetZone1RMSCurrent(double VAC) +{ + return (VAC/Zone1Resistance); +} double GetZone2RMSCurrent(double VAC) { return (VAC/Zone2Resistance); @@ -326,6 +334,7 @@ uint32_t PowerManagementCallBack(uint32_t IfIndex, uint32_t BusyFlag) InitDrierAcVoltage /= InitDrierAcVoltageCount; MainCurrent = StableCurrent; InitCurrentReadingStable(); + Zone1Resistance = InitDrierAcVoltage/MainCurrent; DeActivateHeater(HEATER_TYPE__DryerMainHeater); ActivateHeater(HEATER_TYPE__DryerSecondaryHeater); ReportWithPackageFilter(InitFilter,"starting secondary heater ", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0); @@ -518,6 +527,12 @@ uint32_t InitSequenceWaitForCoolerCallBackFunction(uint32_t IfIndex, uint32_t Bu } uint32_t InitSequenceWaitForCooler(void) { + Trigger_SetWHSFanSpeed(FAN1, SmallFansCfg); + Trigger_SetWHSFanSpeed(FAN2, SmallFansCfg); + Trigger_SetWHSFanSpeed(FAN3, SmallFansCfg); + Trigger_SetWHSFanSpeed(FAN4, SmallFansCfg); + Trigger_SetWHSFanSpeed(FAN5, LargeFansCfg); + Trigger_SetWHSFanSpeed(FAN6, LargeFansCfg); if (WHS_Type == WHS_TYPE_UNKNOWN) { InitStages++; @@ -574,6 +589,7 @@ uint32_t InitSequenceStartHeating(void) { SetMachineReadyForHeating(true); //SetMachineStatus(MACHINE_STATE__Ready); //prevent job while waiting for the cooler + MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,0); if (InitialHeating) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h index 8ce835a06..d0157ed47 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h @@ -37,6 +37,7 @@ MACHINE_STATE_STAGES_ENUM GetMachineState(void); void SetMachineState(MACHINE_STATE_STAGES_ENUM); void InitSequenceSetStartHeating(bool StartHeating); double GetZone2RMSCurrent(double VAC); +double GetZone1RMSCurrent(double VAC); uint32_t PowerUpUpdateFunc(MessageContainer* requestContainer); uint32_t AbortPowerUpFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index 4b6eb93f3..169772480 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -251,6 +251,7 @@ uint32_t PowerOffHeatersOff(void) ProcessParametersClear.rblowerflow = 0; ProcessParametersClear.rblowerflow = 0; ProcessParametersClear.dyeingspeed = 40; + ProcessParametersClear.headairflow = 8.0; if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) { LOG_ERROR (PowerOffMachineState, "Turn Off Heaters failed"); @@ -361,30 +362,69 @@ uint32_t PowerOffWaitForTemperatureCallback(uint32_t IfIndex, uint32_t BusyFlag) { uint32_t readTemp; MaxTemp = 0; - readTemp = MillisecGetTemperatures( MIXER_PT100); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DYEINGH_TEMP1); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DYEINGH_TEMP2); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DYEINGH_TEMP3); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DYEINGH_TEMP4); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DYEINGH_TEMP5); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( HEAD6_PT100); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; - readTemp = MillisecGetTemperatures( TEMP_SENSE_ANALOG_DRYER_TEMP1); - if ((readTemp>= MaxTemp)&&(readTemp < 28000)) - MaxTemp = readTemp; + /*if (Head_Type == HEAD_TYPE_SYLKO_WITHOUT_CARD) + { + readTemp = MillisecGetTemperatures( MIXER_PT100); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP2); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP3); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP4); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP5); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD6_PT100); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + } + if (Head_Type == HEAD_TYPE_SYLKO) + { + readTemp = MillisecGetTemperatures( HEAD_PT100_MIXER_0X8E_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_1_0X80_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_2_0X80_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_3_0X82_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_4_0X82_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_5_0X84_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_6_0X84_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_7_0X86_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_8_0X86_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_9_0X88_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_10_0X88_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_11_0X8A_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_12_0X8A_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + } + if (Head_Type == HEAD_TYPE_STAPLE_SPUN) + { + readTemp = MillisecGetTemperatures( HEAD_PT100_MIXER_0X8E_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_1_0X80_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_2_0X80_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_ZONE_3_0X82_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_2_0X8C_1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + readTemp = MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_1_0X8C_0); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; + }*/ + readTemp = MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1); + if ((readTemp>= MaxTemp)&&(readTemp < 27000)) MaxTemp = readTemp; if (StoreMax == 500) StoreMax = MaxTemp; @@ -409,6 +449,7 @@ uint32_t PowerOffWaitForTemperature(void) { Report("PowerOff Wait For Temperature",__FILE__,__LINE__,(int)PowerOffTemperatureThreshold,RpWarning,(int)3600,0); StoreMax = 500; + WHS_Set_IFS_Clearing_Suction(NUM_OF_MIDTANKS); if (WaitForProcessControlId == 0xFF) { WaitForProcessCounter = 0; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index be3b64f0a..97247f90b 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -382,7 +382,6 @@ uint32_t ThreadJoggingFunc(int speed) //usnprintf(ErrorMsg, 80,"Copy Configured T %d W %d I %d H %d W %d",CopyConfigured[Module_Thread],CopyConfigured[Module_Winder],CopyConfigured[Module_IDS],CopyConfigured[Module_Heaters],CopyConfigured[Module_Waste]); //Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); - JoggingJobActive = true; //set the job handler to ignore heaters, ids and waste in the state machine Configured[Module_Thread] = true; Configured[Module_Winder] = true; @@ -419,6 +418,7 @@ uint32_t ThreadJoggingFunc(int speed) Ticket.spool = Tspool; CurrentJob = &Ticket; InternalWindingConfigMessage(Tspool); + JoggingJobActive = true; StartJob(&Ticket); } } @@ -537,7 +537,6 @@ uint32_t ThreadCleaningJob(int speed) else { //memcpy(&CopyConfigured,&Configured,sizeof(CopyConfigured)); - CleaningJobActive = true; //usnprintf(ErrorMsg, 80,"Copy Configured T %d W %d I %d H %d W %d",CopyConfigured[Module_Thread],CopyConfigured[Module_Winder],CopyConfigured[Module_IDS],CopyConfigured[Module_Heaters],CopyConfigured[Module_Waste]); //Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); @@ -607,6 +606,7 @@ uint32_t ThreadCleaningJob(int speed) } InternalWindingConfigMessage(Tspool); + CleaningJobActive = true; StartJob(&Ticket); } } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 982687201..61561c6a9 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -138,11 +138,9 @@ FRESULT RewindJobFile() } return Fresult; } -extern Semaphore_Handle FFS_Sem; FRESULT CloseJobFile() { Fresult = f_close(JobRequestFileHandle); - //Semaphore_post(FFS_Sem); #warning trying not to hold the semaphore and enable the PPC/MS to work on several files simultaneously readbBytes = 0; -- cgit v1.3.1 From 9ddb8965c11f48b83a523d5aa9eae8ba431b082e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Fri, 19 Jun 2020 16:09:05 +0300 Subject: Version1.4.6.32; semaphores removed from file system for now --- .../Embedded/Common/SWUpdate/FileSystem.c | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 65328efb3..6bb40b215 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -82,7 +82,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) //uint32_t status = OK; FRESULT Fresult = FR_OK; - + bool sem_ok = false; MessageContainer responseContainer; FileUploadRequest* request = file_upload_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); @@ -102,7 +102,17 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - if (Semaphore_pend(FileUpload_sem_param, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FileUpload_sem_param, BIOS_NO_WAIT)) + { + sem_ok = true; + } + else + { + Semaphore_post(FileUpload_sem_param); + Report("semaphore was not free", __FILE__, __LINE__, request->length, RpWarning, (int)MAX_CHUNK_LENGTH, 0); + sem_ok = true; + } + if (sem_ok == true) { CommRxTaskHandle = Task_self(); Task_setPri(CommRxTaskHandle, 2); @@ -264,7 +274,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { Task_setPri(CommRxTaskHandle, 9); Semaphore_post(FileUpload_sem_param); - //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); + Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); } return OK; } @@ -311,7 +321,7 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_open(DownloadFileHandle,request->filename,FA_READ ); if (Fresult == FR_OK) @@ -495,7 +505,7 @@ uint32_t CreateRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); if (Fresult == FR_OK) @@ -553,7 +563,7 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer) //int NumOfFiles = 0; FRESULT Fresult = FR_OK; - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_unlink(request->path); Semaphore_post(FFS_Sem); @@ -659,7 +669,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Report(curTime, __FILE__, ltm->tm_hour,ltm->tm_min , RpWarning, ltm->tm_sec, 0); */ - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult |= f_opendir(&dir, g_cCwdBuf); if(Fresult != FR_OK) @@ -781,7 +791,7 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout) Fresult = FR_DENIED; else { - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_open(FileHandle,path,FA_WRITE | FA_OPEN_ALWAYS|FA_CREATE_ALWAYS); if (Fresult == FR_OK) @@ -836,7 +846,7 @@ FRESULT FileRead(char *path, uint32_t *Size, void **Buffer) Fresult = FR_DENIED; else { - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_open(FileHandle,path,FA_READ); if (Fresult == FR_OK) @@ -899,7 +909,7 @@ FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle) if (FileHandle == 0) Fresult = FR_DENIED; else - if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) + if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { Fresult = f_open(FileHandle,path,FA_READ); Semaphore_post(FFS_Sem); //will be closed with the f_close, in the job -- cgit v1.3.1 From f3c163e96a9fd733922ce56e37025e2dff0d47e6 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 17 Sep 2020 16:39:26 +0300 Subject: some bug fixes and changes --- .../Embedded/Common/SWUpdate/FileSystem.c | 6 +- .../Embedded/Communication/CommunicationTask.c | 13 ++-- .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 5 +- .../Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c | 4 + .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 9 ++- .../Embedded/Modules/IDS/IDS_Cleaning.c | 88 +++++++++++++++------- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 13 +++- .../Embedded/Modules/Thread/ThreadLoad.c | 4 +- .../StateMachines/Initialization/PowerIdle.c | 11 ++- 10 files changed, 104 insertions(+), 51 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 6bb40b215..72693f391 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -115,7 +115,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) if (sem_ok == true) { CommRxTaskHandle = Task_self(); - Task_setPri(CommRxTaskHandle, 2); + Task_setPri(CommRxTaskHandle, 4); // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); //Report("FileUploadRequestFunc 2", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); @@ -284,7 +284,7 @@ void FileChunkUploadError(void) { REPORT_MSG (FileReceivedLength,"file upload too much data!"); f_close(UploadFileHandle); - my_free (UploadFileHandle); + //my_free (UploadFileHandle); CAN NOT CALL FREE() FROM INTERRUPT UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; @@ -922,7 +922,7 @@ FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle) } else { - LOG_ERROR (Fresult,"f_stat error"); + Report("f_stat error", __FILE__, __LINE__,Fresult, RpWarning, (int)0, 0); } my_free(fno); return Fresult; diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index 4874e82c3..aa514d17a 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -37,16 +37,15 @@ struct serialBuffer { } typedef SerialBuffer; #define SHORT_BUFFER_SIZE 100 char CommShortRxBuffer[10][SHORT_BUFFER_SIZE]; -char CommRxBuffer[COMM_MAX_BUFFER_SIZE]; -SerialBuffer inBuffer[11]; -bool SerialBufferUsed[11] = {false,false,false,false,false,false,false,false,false,false,false}; +char CommRxBuffer[2][COMM_MAX_BUFFER_SIZE]; +SerialBuffer inBuffer[12]; +bool SerialBufferUsed[12] = {false,false,false,false,false,false,false,false,false,false,false,false}; uint32_t initArray(size_t initialSize) { if (initialSize >= COMM_MAX_BUFFER_SIZE) return 0xFF; if (initialSize > SHORT_BUFFER_SIZE) { - //if ((SerialBufferUsed[10] == true)&&(SerialBufferUsed[11] == true)) - if (SerialBufferUsed[10] == true) + if ((SerialBufferUsed[10] == true)&&(SerialBufferUsed[11] == true)) { return 0xFF; } @@ -61,7 +60,7 @@ uint32_t initArray(size_t initialSize) //Report("initArray", __FILE__, 10, inBuffer[10].size, RpWarning, (int)0, 0); return 10; } - /*else if (SerialBufferUsed[11] == false) + else if (SerialBufferUsed[11] == false) { SerialBufferUsed[11] = true; inBuffer[11].buffer = CommRxBuffer; @@ -69,7 +68,7 @@ uint32_t initArray(size_t initialSize) inBuffer[11].size = initialSize; //Report("initArray", __FILE__, 10, inBuffer[10].size, RpWarning, (int)0, 0); return 11; - }*/ + } else return 0xFF; } } 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 9759dfb16..431843d15 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 @@ -442,8 +442,11 @@ bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch) break; case I2C_HEADCARD_COVER_LS_FRONT: case I2C_HEADCARD_ARC_LS_ACTUATOR: + if (Head_Type == HEAD_TYPE_ARC) LM_Status = Head_I2C_EXP4_0x46.bits.INPUT_LS_FRONT_ARC_ACT; - break; + else + LM_Status = !(Head_I2C_EXP4_0x46.bits.INPUT_LS_FRONT_ARC_ACT); + break; case I2C_HEADCARD_COVER_LS_REAR: case I2C_HEADCARD_COVER_LS_ARC: LM_Status = !(Head_I2C_EXP4_0x46.bits.INPUT_LS_REAR_ARC_COVER); diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c index f8622e241..cc0d3bc72 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c @@ -138,6 +138,7 @@ typedef struct FPGALoadMessage{ }FPGALoadMessageStruc; char FPGAFullPath[MAX_FPGA][50]; +Task_Handle FpgaTaskHandle; FRESULT FPGA_Programming_Request(FPGA_ID FPGA_Id, char * FullPath, bool IncludeReboot) { FPGALoadMessageStruc FPGALoadMessage; @@ -147,6 +148,8 @@ FRESULT FPGA_Programming_Request(FPGA_ID FPGA_Id, char * FullPath, bool IncludeR FPGALoadMessage.FPGA_Id = FPGA_Id; FPGALoadMessage.FullPath = FPGAFullPath[FPGA_Id]; FPGALoadMessage.IncludeReboot = IncludeReboot; + Task_setPri(FpgaTaskHandle, 6); + if (FPGALoadMsgQ != NULL) Mailbox_post(FPGALoadMsgQ , &FPGALoadMessage, BIOS_NO_WAIT); return FR_OK; @@ -158,6 +161,7 @@ void FPGALoadTask(UArg arg0, UArg arg1) FPGALoadMessageStruc FPGALoadMessage; Error_Block eb; Error_init(&eb); + FpgaTaskHandle = Task_self(); FPGALoadMsgQ = Mailbox_create(sizeof(FPGALoadMessageStruc), 4, NULL,&eb); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 78398119b..b5c24835a 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -835,7 +835,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) if (n_segments == 0) { ReportWithPackageFilter(AlarmFilter,"no segments in the job", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, 222, 0); - return JOB_OK; + return JOB_FILE_PROBLEM; } if (AlarmItem == NULL) { diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index a6b7bff86..57a684ef1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -400,12 +400,12 @@ uint32_t HeatersTestInternalAlarmsCBFunction(uint32_t IfIndex, uint32_t readValu { if (InternalAlarmActive[index] == false) { - if(InternalOverHeatCounter[index]++ >=Overheat_Count_Limit) + ReportWithPackageFilter(HeatersFilter,"Internal Over the max temperature",__FILE__,index,readValue,RpWarning, InternalOverHeatCounter[index],0); + if(InternalOverHeatCounter[index]++ >=Overheat_Count_Limit*10) { InternalOverHeatCounter[index] = Overheat_Count_Limit; InternalAlarmActive[index] = true; - ReportWithPackageFilter(HeatersFilter,"Internal Over the max temperature, heater turned off",__FILE__,index,readValue,RpWarning, 0,0); AlarmHandlingSetAlarm(InternalTempEventType[index], true); if (JobIsActive()) { @@ -424,11 +424,12 @@ uint32_t HeatersTestInternalAlarmsCBFunction(uint32_t IfIndex, uint32_t readValu { if (InternalAlarmActive[index] == true) { + ReportWithPackageFilter(HeatersFilter,"Internal Under the max temperature",__FILE__,index,readValue,RpWarning, InternalOverHeatCounter[index],0); if(InternalOverHeatCounter[index]-- <= 0) { InternalOverHeatCounter[index] = 0; - InternalAlarmActive[index] = true; + InternalAlarmActive[index] = false; ReportWithPackageFilter(HeatersFilter,"Internal Under the max temperature, alarm turned off",__FILE__,index,readValue,RpWarning, 0,0); AlarmHandlingSetAlarm(InternalTempEventType[index], false); } @@ -1301,7 +1302,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { if ((HeaterMaxTempFlag[HEATER_TYPE__DryerSecondaryHeater] == false)&&(HeaterMaxTempFlag[HEATER_TYPE__DryerMainHeater] == false)) { - ReportWithPackageFilter(HeatersFilter,"AC Activating",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); + //ReportWithPackageFilter(HeatersFilter,"AC Activating",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); ActivateHeater(HEATER_TYPE__DryerSecondaryHeater); ActivateHeater(HEATER_TYPE__DryerMainHeater); HeaterRecalculateSharedHeatersParams(HEATER_TYPE__DryerMainHeater,100); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index 256d25aa5..c1fa37942 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -28,6 +28,7 @@ typedef enum CleaningStageActuatorDown, CleaningStageDelay2, }CleaningStageEnum; +TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DH_LID; /* *Cleaning sequence: @@ -51,42 +52,68 @@ int CleaningStageCounter = 8;//Tdelay1 - 1 to start with stage moving down void Init_CleaningStageCounter() { - CleaningStageCounter = Tdelay1 - 1; + if(Head_Type == HEAD_TYPE_FLAT) { + CleaningStageCounter = Tdelay1 - 1; + } else { + CleaningStageCounter = 0; + } } +uint32_t cleaningMotorCBFunction (uint32_t deviceID, uint32_t Parameter1) +{ + CleaningStageCounter = 0; + return 0; +} + +uint32_t IDS_Cleaning_Move_Actuators_Test() +{ + while (CleaningStageCounter <= Tdelay2) + { + IDS_Cleaning_Move_Actuators(); + delayms(50); + } + +} uint32_t IDS_Cleaning_Move_Actuators() { - if(Head_Type != HEAD_TYPE_FLAT) + if((Head_Type != HEAD_TYPE_FLAT) && (Head_Type != HEAD_TYPE_ARC)) return OK; - if (CleaningStageCounter == 1) - { - Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); - //Trigger_Head_Actuators_Control(ACTIN, LOW,true); - ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Move_ActuatorUp", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); + if(Head_Type == HEAD_TYPE_FLAT) { + if (CleaningStageCounter == 1) + { + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); + //Trigger_Head_Actuators_Control(ACTIN, LOW,true); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Move_ActuatorUp", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tup) + { + Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); + //Trigger_Head_Actuators_Disable(); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_Actuator", __FILE__, __LINE__, Tup, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tdelay1) + { + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); + //Trigger_Head_Actuators_Control(ACTIN, LOW,false); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_MoveDown", __FILE__, __LINE__, Tdelay1, RpWarning, CleaningStageCounter, 0); + } + else if (CleaningStageCounter == Tdelay2) + { + CleaningStageCounter = 0; + Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_delay", __FILE__, __LINE__, Tdelay2, RpWarning, CleaningStageCounter, 0); + } + } else { //arc + if (CleaningStageCounter == 1) { + //MotorSetSpeed(MotorId, 1000); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Motor_Run", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); + } /*else if (CleaningStageCounter == Tdelay2) { + MotorStop(MotorId,Hard_Hiz); + MotorMovetoLimitSwitch(MotorId,1-MotorsCfg[MotorId].directionthreadwize, 50, Motor_Id_to_LS_IdDown[MotorId], cleaningMotorCBFunction,30000); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Motor_Homing", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); + }*/ } - else if (CleaningStageCounter == Tup) - { - Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); - //Trigger_Head_Actuators_Disable(); - ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_Actuator", __FILE__, __LINE__, Tup, RpWarning, CleaningStageCounter, 0); - } - else if (CleaningStageCounter == Tdelay1) - { - Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); - //Trigger_Head_Actuators_Control(ACTIN, LOW,false); - ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_MoveDown", __FILE__, __LINE__, Tdelay1, RpWarning, CleaningStageCounter, 0); - } - else if (CleaningStageCounter == Tdelay2) - { - CleaningStageCounter = 0; - Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); - ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_delay", __FILE__, __LINE__, Tdelay2, RpWarning, CleaningStageCounter, 0); - } - - - CleaningStageCounter++; - return OK; } /*uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) @@ -137,6 +164,9 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback) ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, status, 0); HeadCard_Actuators_Relocate(); Init_CleaningStageCounter(); + MotorStop(MotorId,Hard_Hiz); + MotorMovetoLimitSwitch(MotorId,1-MotorsCfg[MotorId].directionthreadwize, 50, Motor_Id_to_LS_IdDown[MotorId], cleaningMotorCBFunction,30000); + ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Motor_Homing", __FILE__, __LINE__, 1, RpWarning, CleaningStageCounter, 0); CleaningStage = CleaningStageIdle; ReportWithPackageFilter(IDSFilter,"IDS_Cleaning_Stop_Cleaning_Solution actuator relocate", __FILE__, __LINE__, CleaningStage, RpWarning, CleaningStageCounter, 0); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index d40f3c00b..d508c2ed2 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -348,6 +348,11 @@ JobDescriptionFileBrushStop *FirstBrushStop = NULL; FreeSegmentFileData(Segment); CloseJobFile(); } + else + { + ReportWithPackageFilter(IDSFilter,"Error Opening the file", __FILE__, __LINE__, Fresult, RpWarning, 0, 0); + return false; + } //GeneralHwReady = true; int ActiveDispensers = 0; for (Dispenser_i = 0; Dispenser_i < MAX_DYE_DISPENSERS; Dispenser_i++) @@ -529,7 +534,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl updatedSpeed = tempSpeed*0.98; MotorSetSpeed(HW_Motor_Id, updatedSpeed); CurrentDispenserSpeed[DispenserId] = updatedSpeed; - ReportWithPackageFilter(IDSFilter,"IDS decrease speed",__FILE__,DispenserId,(int)updatedSpeed,RpWarning,(int)(pressure*100),0); + //ReportWithPackageFilter(IDSFilter,"IDS decrease speed",__FILE__,DispenserId,(int)updatedSpeed,RpWarning,(int)(pressure*100),0); //return true; //ready } else if (pressure < RefMaxPressure*0.97) @@ -539,7 +544,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl updatedSpeed = (tempSpeed * 1.02 < InitialDispenserSpeed) ? tempSpeed * 1.02 : InitialDispenserSpeed; MotorSetSpeed(HW_Motor_Id, updatedSpeed); CurrentDispenserSpeed[DispenserId] = updatedSpeed; - ReportWithPackageFilter(IDSFilter,"IDS increase speed",__FILE__,DispenserId,(int)updatedSpeed,RpWarning,(int)(pressure*100),0); + //ReportWithPackageFilter(IDSFilter,"IDS increase speed",__FILE__,DispenserId,(int)updatedSpeed,RpWarning,(int)(pressure*100),0); //return false; //not ready } if ((pressure>RefMaxPressure)&&(pressure<(RefMaxPressure+0.1))) @@ -599,7 +604,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl if (AdjustDispenserSpeedToPressure(i,DispenserPreparePressure,pressure) == true) NumofReadyDispensers++; } - ReportWithPackageFilter(IDSFilter,"IDS prepare",__FILE__,i,(int)DispenserTotalPrepareSteps[i],RpWarning,(int)(CurrentDispenserSpeed[i]*100),0); + //ReportWithPackageFilter(IDSFilter,"IDS prepare",__FILE__,i,(int)DispenserTotalPrepareSteps[i],RpWarning,(int)(CurrentDispenserSpeed[i]*100),0); } } pressure = GetDispenserPressure(CLEANER_DISPENSER); @@ -1312,7 +1317,7 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) /* wait for all dispensers to get to the required pressure * move the presegment ready when all dispensers are ready. */ - REPORT_MSG(Segment->n_brushstops,"IDSPreSegmentState"); + ReportWithPackageFilter(IDSFilter,"IDSPreSegmentState",__FILE__,__LINE__,(int)Segment->n_brushstops,RpError,(int)SegmentId,0); if (JobBrushStopId>=Segment->n_brushstops) { ReportWithPackageFilter(IDSFilter,"Error JobBrushStopId",__FILE__,__LINE__,(int)Segment->n_brushstops,RpError,(int)0,0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 554e4d1ef..d5c186893 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -1407,6 +1407,8 @@ uint32_t ThreadLoadingReport(void) if (ThreadLoadingToken[0] == 0) return OK; + if (LoadStages == THREAD_LOAD_INIT) + return OK; if (MessageState == 0) { @@ -1485,7 +1487,7 @@ uint32_t ThreadLoadingRestartReport(void) //sending after a failure in the final response.has_state = true; response.state = THREAD_LOADING_STATE__ReadyForLoading; response.errorreason = DefaultErrSrt; - Report("ThreadLoadingReport",__FILE__,MessageState,response.state,RpWarning,(int)LoadStages,0); + Report("ThreadLoadingRestartReport",__FILE__,MessageState,response.state,RpWarning,(int)LoadStages,0); //------------------------------------------------------------------------------------------- responseContainer = createContainer(MESSAGE_TYPE__StartThreadLoadingResponse, ThreadLoadingToken, false, &response, &start_thread_loading_response__pack, &start_thread_loading_response__get_packed_size); responseContainer.has_continuous = true; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c index 5d512cb9b..7a1a3cae5 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c @@ -82,6 +82,7 @@ uint32_t PowerIdleToPowerDownCallBackFunction(uint32_t IfIndex, uint32_t BusyFla } void PowerIdleSetIdle(void) { + int i; Report("PowerIdle Set ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0); memcpy (&ActiveProcessParameters,&ProcessParametersKeep,sizeof(ProcessParameters)); ProcessParameters ProcessParametersClear; @@ -120,13 +121,21 @@ void PowerIdleSetIdle(void) Control_Voltage_To_Blower(BlowerCfg.heatingvoltage); else Control_Voltage_To_Blower(BlowerCfg.voltage-500); - WHS_Set_SetPoint_Q_value(headairflow); + WHS_Set_SetPoint_Q_value(headairflow*2/3); } SetMachineStatus(MACHINE_STATE__Sleep); if (Auto_Shutdown_Bypass == false) { IdleToPowerDownControlId = AddControlCallback("IdleToPowerDown",PowerIdleToPowerDownCallBackFunction, eOneHour*2, TemplateDataReadCBFunction,0,0, 0 ); } + if (AutoHoming_Config >= AutoHoming_PowerOn_off ) + { + for (i=0;i Date: Sun, 18 Oct 2020 15:02:09 +0300 Subject: task priorities --- .../Embedded/Common/SWUpdate/FileSystem.c | 17 +++++++----- .../Embedded/Common/Utilities/idle_task.c | 2 +- .../Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c | 2 +- Software/Embedded_SW/Embedded/Embedded.cfg | 32 +++++++++++----------- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 2 +- .../Embedded/Modules/Stubs_Handler/Progress.c | 2 +- 6 files changed, 30 insertions(+), 27 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 72693f391..b9c87cd66 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -77,6 +77,8 @@ bool FileUploadGetState(void) { return FileDone; } +int CommRxpri; + uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) { //uint32_t status = OK; @@ -115,8 +117,9 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) if (sem_ok == true) { CommRxTaskHandle = Task_self(); - Task_setPri(CommRxTaskHandle, 4); - // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); + CommRxpri = Task_getPri(CommRxTaskHandle); + Task_setPri(CommRxTaskHandle, 11); + Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); //Report("FileUploadRequestFunc 2", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); if (Fresult == FR_OK) @@ -173,9 +176,9 @@ uint32_t FileChunkUploadCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; - Task_setPri(CommRxTaskHandle, 9); + Task_setPri(CommRxTaskHandle, CommRxpri); Semaphore_post(FileUpload_sem_param); - //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); + Report("Task_setPri", __FILE__, __LINE__, CommRxpri, RpWarning, (int)CommRxTaskHandle, 0); if (SafeRemoveControlCallback(Chunk_ControlId, FileChunkUploadCallBackFunction )==OK) Chunk_ControlId = 0xFF; @@ -272,9 +275,9 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__FileChunkUploadResponse); if (FileDone == true) { - Task_setPri(CommRxTaskHandle, 9); + Task_setPri(CommRxTaskHandle, CommRxpri); Semaphore_post(FileUpload_sem_param); - Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); + Report("Task_setPri", __FILE__, __LINE__, CommRxpri, RpWarning, (int)CommRxTaskHandle, 0); } return OK; } @@ -288,7 +291,7 @@ void FileChunkUploadError(void) UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; - Task_setPri(CommRxTaskHandle, 9); + Task_setPri(CommRxTaskHandle, CommRxpri); Semaphore_post(FileUpload_sem_param); } } diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c b/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c index 54e186b28..0f4ce4244 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/idle_task.c @@ -27,7 +27,7 @@ #include "Modules/Control/Control.h" #include "Modules/Control/MillisecTask.h" #define MAX_PRIORITY 15 -#define SECOND_MAX_PRIORITY 14 +#define SECOND_MAX_PRIORITY 24 #define MIN_PRIORITY 0 #define SECOND_MIN_PRIORITY 1 #define TICKS_IN_SECOND 1000 diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c index ec5e26e4c..5ba5834dc 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c @@ -148,7 +148,7 @@ FRESULT FPGA_Programming_Request(FPGA_ID FPGA_Id, char * FullPath, bool IncludeR FPGALoadMessage.FPGA_Id = FPGA_Id; FPGALoadMessage.FullPath = FPGAFullPath[FPGA_Id]; FPGALoadMessage.IncludeReboot = IncludeReboot; - Task_setPri(FpgaTaskHandle, 5); + Task_setPri(FpgaTaskHandle, 8); if (FPGALoadMsgQ != NULL) Mailbox_post(FPGALoadMsgQ , &FPGALoadMessage, BIOS_NO_WAIT); diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index f79d85b99..cf0313d5e 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -23,7 +23,7 @@ BIOS.heapSize = 60000; // bios heapmem //Memory.defaultHeapSize = 20000; //Program.heap = 40000; //Program.stack = 4096; - +Task.numPriorities = 25; Clock.timerId = 7; //var hwi0Params = new Hwi.Params(); @@ -107,89 +107,89 @@ Task.addHookSet({ var MillisecTaskParams = new Task.Params(); MillisecTaskParams.instance.name = "MilliSecond"; MillisecTaskParams.stackSize = 4096; -MillisecTaskParams.priority = 14; +MillisecTaskParams.priority = 23; Program.global.millisec = Task.create("&MillisecTask", MillisecTaskParams); var ControlTaskParams = new Task.Params(); ControlTaskParams.instance.name = "control"; ControlTaskParams.stackSize = 4096; -ControlTaskParams.priority = 13; +ControlTaskParams.priority = 22; Program.global.control = Task.create("&controlTask", ControlTaskParams); var CommTxTaskParams = new Task.Params(); CommTxTaskParams.instance.name = "communicationTx"; -CommTxTaskParams.priority = 12; +CommTxTaskParams.priority = 21; CommTxTaskParams.stackSize = 4096; Program.global.communicationTx = Task.create("&communicationTxTask", CommTxTaskParams); var CommRxTaskParams = new Task.Params(); CommRxTaskParams.instance.name = "communicationRx"; -CommRxTaskParams.priority = 11; +CommRxTaskParams.priority = 20; CommRxTaskParams.stackSize = 8192; Program.global.communication = Task.create("&communicationTask", CommRxTaskParams); var AlarmHandlingTaskParams = new Task.Params(); AlarmHandlingTaskParams.instance.name = "AlarmHandling"; AlarmHandlingTaskParams.stackSize = 4096; -AlarmHandlingTaskParams.priority = 10; +AlarmHandlingTaskParams.priority = 19; Program.global.AlarmHandling = Task.create("&AlarmHandlingTask", AlarmHandlingTaskParams); var ProcessTaskParams = new Task.Params(); ProcessTaskParams.instance.name = "process"; ProcessTaskParams.stackSize = 4096; -ProcessTaskParams.priority = 9; +ProcessTaskParams.priority = 18; Program.global.process = Task.create("&jobTask", ProcessTaskParams); /*var I2C_Reading = new Task.Params(); I2C_Reading.instance.name = "I2C_Reading"; I2C_Reading.stackSize = 2048; -I2C_Reading.priority = 8; +I2C_Reading.priority = 17; Program.global.I2C_Reading = Task.create("&I2C_ReadingTask", I2C_Reading); */ var HeaterControlTaskParams = new Task.Params(); HeaterControlTaskParams.instance.name = "HeatersControl"; -HeaterControlTaskParams.priority = 7; +HeaterControlTaskParams.priority = 16; Program.global.HeatersControl = Task.create("&HeatersControlTask", HeaterControlTaskParams); var ReportTaskParams = new Task.Params(); ReportTaskParams.instance.name = "report"; ReportTaskParams.stackSize = 4096; -ReportTaskParams.priority = 6; +ReportTaskParams.priority = 15; Program.global.report = Task.create("&reportService", ReportTaskParams); var ControlLowTaskParams = new Task.Params(); ControlLowTaskParams.instance.name = "controlLow"; ControlLowTaskParams.stackSize = 4096; -ControlLowTaskParams.priority = 5; +ControlLowTaskParams.priority = 14; Program.global.controlLow = Task.create("&controlLowTask", ControlLowTaskParams); var DiagnosticsTaskParams = new Task.Params(); DiagnosticsTaskParams.instance.name = "Diagnostics"; -DiagnosticsTaskParams.priority = 4; +DiagnosticsTaskParams.priority = 13; DiagnosticsTaskParams.stackSize = 8192; Program.global.Diagnostics = Task.create("&DiagnosticsTask", DiagnosticsTaskParams); var MillisecLowTaskParams = new Task.Params(); MillisecLowTaskParams.instance.name = "MilliSecondLow"; MillisecLowTaskParams.stackSize = 4096; -MillisecLowTaskParams.priority = 3; +MillisecLowTaskParams.priority = 12; Program.global.millisecLow = Task.create("&MillisecLowTask", MillisecLowTaskParams); var ADCProcessTaskParams = new Task.Params(); ADCProcessTaskParams.instance.name = "adcProcess"; ADCProcessTaskParams.stackSize = 512; -ADCProcessTaskParams.priority = 2; +ADCProcessTaskParams.priority = 10; Program.global.adcProcess = Task.create("&ADCProcessTask", ADCProcessTaskParams); var FPGALoad = new Task.Params(); FPGALoad.instance.name = "FPGALoad"; FPGALoad.stackSize = 4096; -FPGALoad.priority = 2; +FPGALoad.priority = 5; Program.global.FPGALoad = Task.create("&FPGALoadTask", FPGALoad); var updateTaskParams = new Task.Params(); updateTaskParams.instance.name = "update"; -updateTaskParams.priority = 2; +updateTaskParams.priority = 4; Program.global.update = Task.create("&updateTask", updateTaskParams); /* ================ Text configuration ================ */ diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 990465fb1..5d1361898 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -827,7 +827,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) int pri = Task_getPri(TaskHandle1); ACTIVITY_GREEN_LED_ON; - Task_setPri(TaskHandle1, 2); + Task_setPri(TaskHandle1, 11); Task_sleep(10); Report("Task_setPri", __FILE__, pri, 3, RpWarning, (int)TaskHandle1, 0); IDS_MapDispenserUsedinJob(CurrentJob); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index ed5f5e560..9b700bf4f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -1226,7 +1226,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) else { LOG_ERROR(request->delay,"Resume"); - Task_setPri (I2C_Task_Handle,8); + Task_setPri (I2C_Task_Handle,17); } response.progress = request->delay; response.has_progress = true; -- cgit v1.3.1 From 1c089e07b393722183acaee32b903df630b32862 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 22 Oct 2020 13:02:11 +0300 Subject: memory saving, version 1.5.0.2 --- .../Embedded/Common/CheckSum/Checksum.c | 134 ---- .../Embedded/Common/CheckSum/Checksum.h | 14 - .../Embedded/Common/SWUpdate/FileSystem.c | 2 +- .../Embedded/Common/Software_CRC/sw_crc.c | 723 --------------------- .../Embedded/Common/Software_CRC/sw_crc.h | 40 -- .../Embedded/Common/Utilities/ustdlib.c | 40 +- .../Embedded/Common/report/reportInit.c | 2 +- .../Embedded_SW/Embedded/Communication/Container.c | 13 - Software/Embedded_SW/Embedded/DataDef.h | 6 +- .../Embedded/Drivers/Flash_Memory/Flash_Memory.c | 16 +- .../Embedded/Drivers/Flash_Memory/Flash_Memory.h | 7 +- .../Embedded/Drivers/Heater/TemperatureSensor.c | 2 +- .../WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c | 12 +- .../WHS_Controller_Comm/WHS_UART/WHS_Uart.c | 30 +- .../Embedded_SW/Embedded/Drivers/Valves/Valve.c | 1 + Software/Embedded_SW/Embedded/Main.c | 2 +- .../Embedded/Modules/Control/MillisecTask.c | 62 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 4 +- .../Modules/Diagnostics/DiagnosticsJogging.c | 2 +- .../Embedded/Modules/General/GeneralHardware.c | 2 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 4 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 1 + .../Embedded/Modules/Waste/newWHS_init.c | 3 + .../StateMachines/Initialization/InitSequence.c | 2 +- .../Embedded/StateMachines/Printing/JobSTM.c | 8 +- 25 files changed, 118 insertions(+), 1014 deletions(-) delete mode 100644 Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c delete mode 100644 Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h delete mode 100644 Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.c delete mode 100644 Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.h (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c deleted file mode 100644 index 5e7e7a0b5..000000000 --- a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Checksum.c - * - * Created on: May 7, 2020 - * Author: avi - */ - -#include -#include -#include "Include.h" -#include "driverlib/crc.h" -//***************************************************************************** -// -//! CheckSum() Calculates an 8 bit checksum -//! -//! \param pui8Data is a pointer to an array of 8 bit data of size ui8Size. -//! \param ui8Size is the size of the array that will run through the checksum -//! algorithm. -//! -//! This function simply calculates an 8 bit checksum on the data passed in. -//! -//! \return The function returns the calculated checksum. -// -//***************************************************************************** -uint8_t -CheckSum8bit(uint8_t *pui8Data, uint8_t ui8Size) -{ - int32_t i; - uint8_t ui8CheckSum; - - ui8CheckSum = 0; - - for(i = 0; i < ui8Size; ++i) - { - ui8CheckSum += pui8Data[i]; - } - return(ui8CheckSum); -} - - -//***************************************************************************** -// -//! Calculates an 8-bit checksum -//! -//! \param pui8Data is a pointer to an array of 8-bit data of size ui32Size. -//! \param ui32Size is the size of the array that will run through the checksum -//! algorithm. -//! -//! This function simply calculates an 8-bit checksum on the data passed in. -//! -//! \return Returns the calculated checksum. -// -//***************************************************************************** -uint32_t -CheckSum32bit(const uint8_t *pui8Data, uint32_t ui32Size) -{ - uint32_t ui32CheckSum; - - // - // Initialize the checksum to zero. - // - ui32CheckSum = 0; - - // - // Add up all the bytes, do not do anything for an overflow. - // - while(ui32Size--) - { - ui32CheckSum += *pui8Data++; - } - - // - // Return the calculated check sum. - // - return(ui32CheckSum & 0xff); -} - -void -InitCRC32(void) -//http://e2e.ti.com/support/microcontrollers/other/f/908/t/360408 -//C:\TI\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c129x\crc32 -{ - // - // Enable the CRC module. - // - SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0); - // - // Wait for the CRC module to be ready. - // - while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0)) - { - } - // - // Configure the CRC module. - // - CRCConfigSet(CCM0_BASE, - CRC_CFG_INIT_SEED | - CRC_CFG_TYPE_P4C11DB7 | - CRC_CFG_SIZE_32BIT); - // - // Set the seed value. - // - CRCSeedSet(CCM0_BASE, 0x5a5a5a5a); -} - - -bool Test_CRC32() -{ - - uint32_t g_ui32Result; - // Random data for generating CRC. - // - uint32_t g_ui32RandomData[16] = - { - 0x8a5f1b22, 0xcb935d29, 0xcc1ac092, 0x5dad8c9e, - 0x6a83b39f, 0x8607dc60, 0xda0ba4d2, 0xf49b0fa2, - 0xaf35d524, 0xffa8001d, 0xbcc931e8, 0x4a2c99ef, - 0x7fa297ab, 0xab943bae, 0x07c61cc4, 0x47c8627d - }; - - InitCRC32(); - // - // Process the data and get the result. The result should be - // 0x75fd6f5c. - // - g_ui32Result = CRCDataProcess(CCM0_BASE, g_ui32RandomData, (sizeof(g_ui32RandomData) / sizeof(uint32_t)), false); - - if(g_ui32Result == 0x75fd6f5c) - { - return OK; - } - - return ERROR; -} diff --git a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h deleted file mode 100644 index 2d245f81a..000000000 --- a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Checksum.h - * - * Created on: May 7, 2020 - * Author: avi - */ - -#ifndef CHECKSUM_H_ -#define CHECKSUM_H_ - -uint8_t CheckSum8bit(uint8_t *pui8Data, uint8_t ui8Size); -uint32_t CheckSum32bit(const uint8_t *pui8Data, uint32_t ui32Size); - -#endif /* CHECKSUM_H_ */ diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index b9c87cd66..56888b742 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -31,7 +31,7 @@ #include #include -#include "drivers/Flash_Memory/Flash_Memory.h" + #include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" diff --git a/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.c b/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.c deleted file mode 100644 index 76f9c0398..000000000 --- a/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.c +++ /dev/null @@ -1,723 +0,0 @@ - -//***************************************************************************** -// -//! \addtogroup sw_crc_api -//! @{ -// -//***************************************************************************** -#include "Common/Software_CRC/sw_crc.h" - -//***************************************************************************** -// -// The CRC table for the polynomial C(x) = x^8 + x^2 + x + 1 (CRC-8-CCITT). -// -//***************************************************************************** -static const uint8_t g_pui8Crc8CCITT[256] = -{ - 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, - 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D, - 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, - 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, - 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, - 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, - 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, - 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD, - 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, - 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, - 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, - 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, - 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, - 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A, - 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, - 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, - 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, - 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, - 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, - 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4, - 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, - 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, - 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, - 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, - 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, - 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63, - 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, - 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, - 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, - 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, - 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, - 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3 -}; - -//***************************************************************************** -// -// The CRC-16 table for the polynomial C(x) = x^16 + x^15 + x^2 + 1 (standard -// CRC-16, also known as CRC-16-IBM and CRC-16-ANSI). -// -//***************************************************************************** -static const uint16_t g_pui16Crc16[256] = -{ - 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, - 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, - 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, - 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, - 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, - 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, - 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, - 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, - 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, - 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, - 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, - 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, - 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, - 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, - 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, - 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, - 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, - 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, - 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, - 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, - 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, - 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, - 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, - 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, - 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, - 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, - 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, - 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, - 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, - 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, - 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, - 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 -}; - -//***************************************************************************** -// -// The CRC-32 table for the polynomial C(x) = x^32 + x^26 + x^23 + x^22 + -// x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 (standard -// CRC32 as used in Ethernet, MPEG-2, PNG, etc.). -// -//***************************************************************************** -static const uint32_t g_pui32Crc32[] = -{ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, - 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, - 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, - 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, - 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, - 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, - 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, - 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, - 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, - 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, - 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, - 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, - 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, - 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, - 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, - 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, - 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, - 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, -}; - -//***************************************************************************** -// -// This macro executes one iteration of the CRC-8-CCITT. -// -//***************************************************************************** -#define CRC8_ITER(crc, data) g_pui8Crc8CCITT[(uint8_t)((crc) ^ (data))] - -//***************************************************************************** -// -// This macro executes one iteration of the CRC-16. -// -//***************************************************************************** -#define CRC16_ITER(crc, data) (((crc) >> 8) ^ \ - g_pui16Crc16[(uint8_t)((crc) ^ (data))]) - -//***************************************************************************** -// -// This macro executes one iteration of the CRC-32. -// -//***************************************************************************** -#define CRC32_ITER(crc, data) (((crc) >> 8) ^ \ - g_pui32Crc32[(uint8_t)((crc & 0xFF) ^ \ - (data))]) - -//***************************************************************************** -// -//! Calculates the CRC-8-CCITT of an array of bytes. -//! -//! \param ui8Crc is the starting CRC-8-CCITT value. -//! \param pui8Data is a pointer to the data buffer. -//! \param ui32Count is the number of bytes in the data buffer. -//! -//! This function is used to calculate the CRC-8-CCITT of the input buffer. -//! The CRC-8-CCITT is computed in a running fashion, meaning that the entire -//! data block that is to have its CRC-8-CCITT computed does not need to be -//! supplied all at once. If the input buffer contains the entire block of -//! data, then \b ui8Crc should be set to 0. If, however, the entire block of -//! data is not available, then \b ui8Crc should be set to 0 for the first -//! portion of the data, and then the returned value should be passed back in -//! as \b ui8Crc for the next portion of the data. -//! -//! For example, to compute the CRC-8-CCITT of a block that has been split into -//! three pieces, use the following: -//! -//! \verbatim -//! ui8Crc = Crc8CCITT(0, pui8Data1, ui32Len1); -//! ui8Crc = Crc8CCITT(ui8Crc, pui8Data2, ui32Len2); -//! ui8Crc = Crc8CCITT(ui8Crc, pui8Data3, ui32Len3); -//! \endverbatim -//! -//! Computing a CRC-8-CCITT in a running fashion is useful in cases where the -//! data is arriving via a serial link (for example) and is therefore not all -//! available at one time. -//! -//! \return The CRC-8-CCITT of the input data. -// -//***************************************************************************** -uint8_t -Crc8CCITT(uint8_t ui8Crc, const uint8_t *pui8Data, uint32_t ui32Count) -{ - uint32_t ui32Temp; - - // - // If the data buffer is not 16 bit-aligned, then perform a single step of - // the CRC to make it 16 bit-aligned. - // - if((uint32_t)pui8Data & 1) - { - // - // Perform the CRC on this input byte. - // - ui8Crc = CRC8_ITER(ui8Crc, *pui8Data); - - // - // Skip this input byte. - // - pui8Data++; - ui32Count--; - } - - // - // If the data buffer is not word-aligned and there are at least two bytes - // of data left, then perform two steps of the CRC to make it word-aligned. - // - if(((uint32_t)pui8Data & 2) && (ui32Count > 1)) - { - // - // Read the next 16 bits. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp); - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // While there is at least a word remaining in the data buffer, perform - // four steps of the CRC to consume a word. - // - while(ui32Count > 3) - { - // - // Read the next word. - // - ui32Temp = *(uint32_t *)pui8Data; - - // - // Perform the CRC on these four bytes. - // - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp); - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp >> 8); - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp >> 16); - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp >> 24); - - // - // Skip these input bytes. - // - pui8Data += 4; - ui32Count -= 4; - } - - // - // If there are 16 bits left in the input buffer, then perform two steps of - // the CRC. - // - if(ui32Count > 1) - { - // - // Read the 16 bits. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp); - ui8Crc = CRC8_ITER(ui8Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // If there is a final byte remaining in the input buffer, then perform a - // single step of the CRC. - // - if(ui32Count != 0) - { - ui8Crc = CRC8_ITER(ui8Crc, *pui8Data); - } - - // - // Return the resulting CRC-8-CCITT value. - // - return(ui8Crc); -} - -//***************************************************************************** -// -//! Calculates the CRC-16 of an array of bytes. -//! -//! \param ui16Crc is the starting CRC-16 value. -//! \param pui8Data is a pointer to the data buffer. -//! \param ui32Count is the number of bytes in the data buffer. -//! -//! This function is used to calculate the CRC-16 of the input buffer. The -//! CRC-16 is computed in a running fashion, meaning that the entire data block -//! that is to have its CRC-16 computed does not need to be supplied all at -//! once. If the input buffer contains the entire block of data, then -//! \b ui16Crc should be set to 0. If, however, the entire block of data is -//! not available, then \b ui16Crc should be set to 0 for the first portion of -//! the data, and then the returned value should be passed back in as -//! \b ui16Crc for the next portion of the data. -//! -//! For example, to compute the CRC-16 of a block that has been split into -//! three pieces, use the following: -//! -//! \verbatim -//! ui16Crc = Crc16(0, pui8Data1, ui32Len1); -//! ui16Crc = Crc16(ui16Crc, pui8Data2, ui32Len2); -//! ui16Crc = Crc16(ui16Crc, pui8Data3, ui32Len3); -//! \endverbatim -//! -//! Computing a CRC-16 in a running fashion is useful in cases where the data -//! is arriving via a serial link (for example) and is therefore not all -//! available at one time. -//! -//! \return The CRC-16 of the input data. -// -//***************************************************************************** -uint16_t -Crc16(uint16_t ui16Crc, const uint8_t *pui8Data, uint32_t ui32Count) -{ - uint32_t ui32Temp; - - // - // If the data buffer is not 16 bit-aligned, then perform a single step of - // the CRC to make it 16 bit-aligned. - // - if((uint32_t)pui8Data & 1) - { - // - // Perform the CRC on this input byte. - // - ui16Crc = CRC16_ITER(ui16Crc, *pui8Data); - - // - // Skip this input byte. - // - pui8Data++; - ui32Count--; - } - - // - // If the data buffer is not word-aligned and there are at least two bytes - // of data left, then perform two steps of the CRC to make it word-aligned. - // - if(((uint32_t)pui8Data & 2) && (ui32Count > 1)) - { - // - // Read the next 16 bits. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // While there is at least a word remaining in the data buffer, perform - // four steps of the CRC to consume a word. - // - while(ui32Count > 3) - { - // - // Read the next word. - // - ui32Temp = *(uint32_t *)pui8Data; - - // - // Perform the CRC on these four bytes. - // - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 8); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 16); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 24); - - // - // Skip these input bytes. - // - pui8Data += 4; - ui32Count -= 4; - } - - // - // If there are two bytes left in the input buffer, then perform two steps - // of the CRC. - // - if(ui32Count > 1) - { - // - // Read the two bytes. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // If there is a final byte remaining in the input buffer, then perform a - // single step of the CRC. - // - if(ui32Count != 0) - { - ui16Crc = CRC16_ITER(ui16Crc, *pui8Data); - } - - // - // Return the resulting CRC-16 value. - // - return(ui16Crc); -} - -//***************************************************************************** -// -//! Calculates the CRC-16 of an array of words. -//! -//! \param ui32WordLen is the length of the array in words (the number of bytes -//! divided by 4). -//! \param pui32Data is a pointer to the data buffer. -//! -//! This function is a wrapper around the running CRC-16 function, providing -//! the CRC-16 for a single block of data. -//! -//! \return The CRC-16 of the input data. -// -//***************************************************************************** -uint16_t -Crc16Array(uint32_t ui32WordLen, const uint32_t *pui32Data) -{ - // - // Calculate and return the CRC-16 of this array of words. - // - return(Crc16(0, (const uint8_t *)pui32Data, ui32WordLen * 4)); -} - -//***************************************************************************** -// -//! Calculates three CRC-16s of an array of words. -//! -//! \param ui32WordLen is the length of the array in words (the number of bytes -//! divided by 4). -//! \param pui32Data is a pointer to the data buffer. -//! \param pui16Crc3 is a pointer to an array in which to place the three -//! CRC-16 values. -//! -//! This function is used to calculate three CRC-16s of the input buffer; the -//! first uses every byte from the array, the second uses only the even-index -//! bytes from the array (in other words, bytes 0, 2, 4, etc.), and the third -//! uses only the odd-index bytes from the array (in other words, bytes 1, 3, -//! 5, etc.). -//! -//! \return None -// -//***************************************************************************** -void -Crc16Array3(uint32_t ui32WordLen, const uint32_t *pui32Data, - uint16_t *pui16Crc3) -{ - uint16_t ui16Crc, ui16Cri8Odd, ui16Cri8Even; - - // - // Initialize the CRC values to zero. - // - ui16Crc = 0; - ui16Cri8Odd = 0; - ui16Cri8Even = 0; - - // - // Loop while there are more words in the data buffer. - // - while(ui32WordLen--) - { - // - // Read the next word. - // - uint32_t ui32Temp = *pui32Data++; - - // - // Perform the first CRC on all four data bytes. - // - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 8); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 16); - ui16Crc = CRC16_ITER(ui16Crc, ui32Temp >> 24); - - // - // Perform the second CRC on only the even-index data bytes. - // - ui16Cri8Even = CRC16_ITER(ui16Cri8Even, ui32Temp); - ui16Cri8Even = CRC16_ITER(ui16Cri8Even, ui32Temp >> 16); - - // - // Perform the third CRC on only the odd-index data bytes. - // - ui16Cri8Odd = CRC16_ITER(ui16Cri8Odd, ui32Temp >> 8); - ui16Cri8Odd = CRC16_ITER(ui16Cri8Odd, ui32Temp >> 24); - } - - // - // Return the resulting CRC-16 values. - // - pui16Crc3[0] = ui16Crc; - pui16Crc3[1] = ui16Cri8Even; - pui16Crc3[2] = ui16Cri8Odd; -} - -//***************************************************************************** -// -//! Calculates the CRC-32 of an array of bytes. -//! -//! \param ui32Crc is the starting CRC-32 value. -//! \param pui8Data is a pointer to the data buffer. -//! \param ui32Count is the number of bytes in the data buffer. -//! -//! This function is used to calculate the CRC-32 of the input buffer. The -//! CRC-32 is computed in a running fashion, meaning that the entire data block -//! that is to have its CRC-32 computed does not need to be supplied all at -//! once. If the input buffer contains the entire block of data, then -//! \b ui32Crc should be set to 0xFFFFFFFF. If, however, the entire block of -//! data is not available, then \b ui32Crc should be set to 0xFFFFFFFF for the -//! first portion of the data, and then the returned value should be passed -//! back in as \b ui32Crc for the next portion of the data. Once all data has -//! been passed to the function, the final CRC-32 can be obtained by inverting -//! the last returned value. -//! -//! For example, to compute the CRC-32 of a block that has been split into -//! three pieces, use the following: -//! -//! \verbatim -//! ui32Crc = Crc32(0xFFFFFFFF, pui8Data1, ui32Len1); -//! ui32Crc = Crc32(ui32Crc, pui8Data2, ui32Len2); -//! ui32Crc = Crc32(ui32Crc, pui8Data3, ui32Len3); -//! ui32Crc ^= 0xFFFFFFFF; -//! \endverbatim -//! -//! Computing a CRC-32 in a running fashion is useful in cases where the data -//! is arriving via a serial link (for example) and is therefore not all -//! available at one time. -//! -//! \return The accumulated CRC-32 of the input data. -// -//***************************************************************************** -uint32_t -Crc32(uint32_t ui32Crc, const uint8_t *pui8Data, uint32_t ui32Count) -{ - uint32_t ui32Temp; - - // - // If the data buffer is not 16 bit-aligned, then perform a single step - // of the CRC to make it 16 bit-aligned. - // - if((uint32_t)pui8Data & 1) - { - // - // Perform the CRC on this input byte. - // - ui32Crc = CRC32_ITER(ui32Crc, *pui8Data); - - // - // Skip this input byte. - // - pui8Data++; - ui32Count--; - } - - // - // If the data buffer is not word-aligned and there are at least two bytes - // of data left, then perform two steps of the CRC to make it word-aligned. - // - if(((uint32_t)pui8Data & 2) && (ui32Count > 1)) - { - // - // Read the next int16_t. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp); - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // While there is at least a word remaining in the data buffer, perform - // four steps of the CRC to consume a word. - // - while(ui32Count > 3) - { - // - // Read the next word. - // - ui32Temp = *(uint32_t *)pui8Data; - - // - // Perform the CRC on these four bytes. - // - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp); - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp >> 8); - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp >> 16); - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp >> 24); - - // - // Skip these input bytes. - // - pui8Data += 4; - ui32Count -= 4; - } - - // - // If there are 16 bits left in the input buffer, then perform two steps of - // the CRC. - // - if(ui32Count > 1) - { - // - // Read the two bytes. - // - ui32Temp = *(uint16_t *)pui8Data; - - // - // Perform the CRC on these two bytes. - // - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp); - ui32Crc = CRC32_ITER(ui32Crc, ui32Temp >> 8); - - // - // Skip these input bytes. - // - pui8Data += 2; - ui32Count -= 2; - } - - // - // If there is a final byte remaining in the input buffer, then perform a - // single step of the CRC. - // - if(ui32Count != 0) - { - ui32Crc = CRC32_ITER(ui32Crc, *pui8Data); - } - - // - // Return the resulting CRC-32 value. - // - return(ui32Crc); -} - diff --git a/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.h b/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.h deleted file mode 100644 index 92f4c1ee7..000000000 --- a/Software/Embedded_SW/Embedded/Common/Software_CRC/sw_crc.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef COMMON_SW_CRC_H_ -#define COMMON_SW_CRC_H_ -//***************************************************************************** -// -// If building with a C++ compiler, make all of the definitions in this header -// have a C binding. -// -//***************************************************************************** -#ifdef __cplusplus -extern "C" -{ -#endif -#include - -//***************************************************************************** -// -// Prototypes for the functions. -// -//***************************************************************************** -extern uint8_t Crc8CCITT(uint8_t ui8Crc, const uint8_t *pui8Data, - uint32_t ui32Count); -extern uint16_t Crc16(uint16_t ui16Crc, const uint8_t *pui8Data, - uint32_t ui32Count); -extern uint16_t Crc16Array(uint32_t ui32WordLen, const uint32_t *pui32Data); -extern void Crc16Array3(uint32_t ui32WordLen, const uint32_t *pui32Data, - uint16_t *pui16Crc3); -extern uint32_t Crc32(uint32_t ui32Crc, const uint8_t *pui8Data, - uint32_t ui32Count); - -//***************************************************************************** -// -// Mark the end of the C bindings section for C++ compilers. -// -//***************************************************************************** -#ifdef __cplusplus -} -#endif - -#endif /* COMMON_SW_CRC_H_ */ diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/ustdlib.c b/Software/Embedded_SW/Embedded/Common/Utilities/ustdlib.c index 0eb68a9e4..420e1dbc3 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/ustdlib.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/ustdlib.c @@ -1482,7 +1482,7 @@ ustrtof(const char *nptr, const char **endptr) return(ulNeg ? (0 - fRet) : fRet); } -//***************************************************************************** +//\***************************************************************************** // //! Returns the length of a null-terminated string. //! @@ -1497,7 +1497,7 @@ ustrtof(const char *nptr, const char **endptr) //! //! \return Returns the length of the string pointed to by \e s. // -//***************************************************************************** +//\***************************************************************************** size_t ustrlen(const char *s) { @@ -1527,7 +1527,7 @@ ustrlen(const char *s) return(len); } -//***************************************************************************** +//\***************************************************************************** // //! Finds a substring within a string. //! @@ -1543,7 +1543,7 @@ ustrlen(const char *s) //! \return Returns a pointer to the first occurrence of \e s2 within //! \e s1 or NULL if no match is found. // -//***************************************************************************** +//\***************************************************************************** char * ustrstr(const char *s1, const char *s2) { @@ -1583,7 +1583,7 @@ ustrstr(const char *s1, const char *s2) return((char *)0); } -//***************************************************************************** +//\***************************************************************************** // //! Compares two strings without regard to case. //! @@ -1600,7 +1600,7 @@ ustrstr(const char *s1, const char *s2) //! \return Returns 0 if the two strings are equal, -1 if \e s1 is less //! than \e s2 and 1 if \e s1 is greater than \e s2. // -//***************************************************************************** +//\***************************************************************************** int ustrncasecmp(const char *s1, const char *s2, size_t n) { @@ -1652,7 +1652,7 @@ ustrncasecmp(const char *s1, const char *s2, size_t n) return(0); } -//***************************************************************************** +//\***************************************************************************** // //! Compares two strings without regard to case. //! @@ -1667,7 +1667,7 @@ ustrncasecmp(const char *s1, const char *s2, size_t n) //! \return Returns 0 if the two strings are equal, -1 if \e s1 is less //! than \e s2 and 1 if \e s1 is greater than \e s2. // -//***************************************************************************** +//\***************************************************************************** int ustrcasecmp(const char *s1, const char *s2) { @@ -1677,7 +1677,7 @@ ustrcasecmp(const char *s1, const char *s2) return(ustrncasecmp(s1, s2, (size_t)-1)); } -//***************************************************************************** +//\***************************************************************************** // //! Compares two strings. //! @@ -1694,7 +1694,7 @@ ustrcasecmp(const char *s1, const char *s2) //! \return Returns 0 if the two strings are equal, -1 if \e s1 is less //! than \e s2 and 1 if \e s1 is greater than \e s2. // -//***************************************************************************** +//\***************************************************************************** int ustrncmp(const char *s1, const char *s2, size_t n) { @@ -1740,7 +1740,7 @@ ustrncmp(const char *s1, const char *s2, size_t n) return(0); } -//***************************************************************************** +//\***************************************************************************** // //! Compares two strings. //! @@ -1755,7 +1755,7 @@ ustrncmp(const char *s1, const char *s2, size_t n) //! \return Returns 0 if the two strings are equal, -1 if \e s1 is less //! than \e s2 and 1 if \e s1 is greater than \e s2. // -//***************************************************************************** +//\***************************************************************************** int ustrcmp(const char *s1, const char *s2) { @@ -1765,14 +1765,14 @@ ustrcmp(const char *s1, const char *s2) return(ustrncmp(s1, s2, (size_t)-1)); } -//***************************************************************************** +//\***************************************************************************** // // Random Number Generator Seed Value // -//***************************************************************************** +//\***************************************************************************** static unsigned int g_iRandomSeed = 1; -//***************************************************************************** +//\***************************************************************************** // //! Set the random number generator seed. //! @@ -1784,14 +1784,14 @@ static unsigned int g_iRandomSeed = 1; //! //! \return None // -//***************************************************************************** +//\***************************************************************************** void usrand(unsigned int seed) { g_iRandomSeed = seed; } -//***************************************************************************** +//\***************************************************************************** // //! Generate a new (pseudo) random number //! @@ -1800,7 +1800,7 @@ usrand(unsigned int seed) //! //! \return A pseudo-random number will be returned. // -//***************************************************************************** +//\***************************************************************************** int urand(void) { @@ -1817,9 +1817,9 @@ urand(void) return((int)g_iRandomSeed); } */ -//***************************************************************************** +//\***************************************************************************** // // Close the Doxygen group. //! @} // -//***************************************************************************** +//\***************************************************************************** diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index 82c8b8099..8890fa8b9 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -507,7 +507,7 @@ STATUS ReportInit(ReportInitParams InitParams) I2CFilter = ReportAddFilterPackage("I2C"); MotorFilter = ReportAddFilterPackage("Motor"); // Filter = ReportAddFilterPackage(""); - ReportSwitchPackageFilter(IDSFilter,REPORT_OFF); + //ReportSwitchPackageFilter(IDSFilter,REPORT_OFF); ReportSwitchPackageFilter(WasteFilter,REPORT_OFF); return status; } diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index aa7807d1b..d12d70aa2 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -13,7 +13,6 @@ #include "Modules/Stubs_Handler/Stub_OptLimitSwitch.h" #include "Modules/Stubs_Handler/Stub_SteperMotor.h" #include "Modules/Stubs_Handler/Stub_Valve.h" -#include "Modules/Stubs_Handler/Stub_ExtFlash.h" #include "Modules/Stubs_Handler/Stub_FPGAReadBackReg.h" #include "Modules/Stubs_Handler/Stub_FPGAReadVersion.h" //#include "Modules/Stubs_Handler/Stub_L6470.h" @@ -205,12 +204,6 @@ void receive_callback(char* buffer, size_t length) case MESSAGE_TYPE__StubValveRequest: Stub_ValveRequest(requestContainer); break; - case MESSAGE_TYPE__StubExtFlashReadRequest: - Stub_ExtFlashReadRequest(requestContainer); - break; - case MESSAGE_TYPE__StubExtFlashWriteRequest: - Stub_ExtFlashWriteRequest(requestContainer); - break; // case MESSAGE_TYPE__StubFPGAReadBackRegRequest: // Stub_FPGAReadBackRegRequest(requestContainer); // break; @@ -407,12 +400,6 @@ void receive_callback(char* buffer, size_t length) case MESSAGE_TYPE__StubI2CWriteBytesRequest: Stub_I2CWriteBytesRequest(requestContainer); break; - case MESSAGE_TYPE__StubExtFlashWriteWordsRequest: - Stub_ExtFlashWriteWordsRequest(requestContainer); - break; - case MESSAGE_TYPE__StubExtFlashReadWordsRequest: - Stub_ExtFlashReadWordsRequest(requestContainer); - break; case MESSAGE_TYPE__KeepAliveRequest: KeepAliveRequestFunc(requestContainer); break; diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index ce8eb0aec..fa3feb5cb 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -33,7 +33,7 @@ //#define EMC_FORCE_MOT_CLOCK_INTERNAL //#define VAC_TEST -//#define DISPENSER_VALVES_OPEN +#define DISPENSER_VALVES_OPEN //#define USE_TUNNEL_PT100 //#define BTSR_NO_TFU @@ -378,11 +378,11 @@ enum extern char *SW_INFO_DIR; -typedef union +/*typedef union { uint32_t DWords[MaxFlashWords]; uint8_t Bytes[MaxFlashBytes]; -}Flash_Union; +}Flash_Union;*/ //---------------------------- diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c index b427bf1d2..d66ffd82a 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c @@ -789,10 +789,10 @@ int Ext_Flash_Operation(uint32_t ui32Address,uint32_t Operation, uint32_t NumOf return 0; } //------------------------------------------------------------- -Flash_Union Flash_RW; +//Flash_Union Flash_RW; -uint32_t WriteBuf[MaxFlashBytes]; -uint32_t ReadBuf[MaxFlashBytes]; +//uint32_t WriteBuf[MaxFlashBytes]; +//uint32_t ReadBuf[MaxFlashBytes]; /* uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* pui32DataTx) { @@ -843,8 +843,8 @@ uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* p */ -uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx)//ui32Address not in use -{ +//uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx)//ui32Address not in use +/*{ uint32_t AddressCounter = 0; uint32_t i; uint32_t No_Bytes; @@ -894,10 +894,10 @@ uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_ Current_Start_address = Current_End_address;// for the next time return Save_Current_Start_address;// for reading the data that we just wrote -} +}*/ -uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) +/*uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) { uint32_t No_Bytes; @@ -936,4 +936,4 @@ uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) } return Flash_RW.DWords; -} +}*/ diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h index d6177ec88..63e63f413 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h @@ -8,13 +8,14 @@ int FlashFS_Init(); int Init_SSI_Ext_Flash(); FRESULT Read_Ext_Flash_Device_ID(); -uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx); -uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ); - +//uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx); +//uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ); +/* extern Flash_Union Flash_RW; extern uint32_t WriteBuf[MaxFlashBytes]; extern uint32_t ReadBuf[MaxFlashBytes]; +*/ //--------------- /* #include diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c index 9dc0b03d4..b44af40fa 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c @@ -208,7 +208,7 @@ int TemperatureListString(char* str) } else if(Head_Type == HEAD_TYPE_ARC) { - len = usnprintf(str, 190, "Prepare H1: %d, H2: %d, H3: %d, AL1: AR1: M: %d, D: %d, W %d, B1 %d, B2 %d", + len = usnprintf(str, 190, "Prepare H1: %d, H2: %d, H3: %d, AL1:%d AR1: %d M: %d, D: %d, W %d, B1 %d, B2 %d", TempSensorResponse[HEAD_PT100_ZONE_1_0X80_0].Temperature_C_mult_by_100/100, TempSensorResponse[HEAD_PT100_ZONE_2_0X80_1].Temperature_C_mult_by_100/100, TempSensorResponse[HEAD_PT100_ZONE_3_0X82_0].Temperature_C_mult_by_100/100, TempSensorResponse[HEAD_PT100_AIR_HEATER_1_0X8C_0].Temperature_C_mult_by_100/100, TempSensorResponse[HEAD_PT100_AIR_HEATER_2_0X8C_1].Temperature_C_mult_by_100/100, diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c index 8ece96f99..47850cca4 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c @@ -274,7 +274,7 @@ uint8_t Search_Rheostat_Value_for_Air_clibration() if ((gas_value < (VOC_Calibration_value + delta)) && (gas_value > (VOC_Calibration_value - delta))) { - ReportWithPackageFilter(WasteFilter,"------------WHS: No need to calibrate the rheostat -----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------WHS: No need to calibrate the rheostat -----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); return OK;// no need to calibrate } else @@ -305,14 +305,14 @@ uint8_t Search_Rheostat_Value_for_Air_clibration() } else { - ReportWithPackageFilter(WasteFilter,"------------WHS: complete the rheostat calibration-----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------WHS: complete the rheostat calibration-----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); Latest_Gas_Sens_PPM = VOC2PPM(gas_value); //for the first read return OK; } } } - ReportWithPackageFilter(WasteFilter,"------------WHS: Unable to calibrate the rheostat-----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------WHS: Unable to calibrate the rheostat-----------------", __FILE__,__LINE__, gas_value, RpMessage, 0, 0); return ERROR; // unable to calibrate } @@ -322,15 +322,15 @@ uint8_t Voc_Sensor_Zero_Calibration() uint8_t Status = OK; //Open_Voc_Valve - ReportWithPackageFilter(WasteFilter,"------------ open VOC valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------ open VOC valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); Trigger_SetWHS_VOC_Valve(OPEN); //after 1 Min delay - find the Rheostat value for 2.5V - ReportWithPackageFilter(WasteFilter,"------------ wait 1 minute -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------ wait 1 minute -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); Status = AddControlCallback(NULL, Search_Rheostat_Value_for_Air_clibration, eOneMinute, TemplateDataReadCBFunction,0,0, 0 ); //Close_Voc_Valve - ReportWithPackageFilter(WasteFilter,"------------ close VOC valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); + ReportWithPackageFilter(DiagnosticsFilter,"------------ close VOC valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); Trigger_SetWHS_VOC_Valve(CLOSE); return Status; diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c index be7c296cf..70e91126d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c +++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c @@ -281,25 +281,24 @@ unsigned short Calculate_CRC16 ( int Message_Length, char *Message) // for modbu typedef enum { - Stage_0 = 10, //to start after few sec from power up - Stage_1, - Stage_2, - Stage_3, - Stage_4 + Stage_0 = 2000, //to start after few sec from power up // for cal every mSec + Stage_1 = Stage_0 + 1, // for cal every mSec + Stage_2 = Stage_1 + 15,// for cal every mSec + Stage_3 = Stage_2 + 5,// for cal every mSec }SHINKO_RW_STAGES_ENUM; uint8_t WHS_Shinko_Communication(SHINKO_RW_OPTIONS_ENUM RWOption) //reading every fourth cycle (Set HW, Request, Set HW, Response) { - //every 10sec start cycle of reading temperature and if there is request R/W the setup uint8_t Status = OK; static SHINKO_RW_STAGES_ENUM Shinko_Comm_Stage = Stage_0; static uint8_t Option = 0; - switch(Shinko_Comm_Stage) + switch(Shinko_Comm_Stage)//Shinko_Comm_Stage { case Stage_0: RS485_Direction(TX);//Set HW for TX - Option = RWOption;//change the read write option only in stage 0 ! (finish cycle with the same option) + Option = RWOption;//change the read write option only in stage 0 ! + Report("WHS_Shinko_Communication ", __FILE__,__LINE__,RWOption, RpMessage, Shinko_Comm_Stage, 0); Shinko_Comm_Stage++; break; case Stage_1: @@ -316,12 +315,13 @@ uint8_t WHS_Shinko_Communication(SHINKO_RW_OPTIONS_ENUM RWOption) //reading ever if((Option == W_SETUP) && (ShinkoTempDeg.Setup!= 0x00)) { Setting_Shinko_Request_SV();//Send Command - Shinko_Read = true;//flag to read the setup in the next cycle } + Report("WHS_Shinko_Communication ", __FILE__,__LINE__,RWOption, RpMessage, Shinko_Comm_Stage, 0); Shinko_Comm_Stage++; break; case Stage_2: RS485_Direction(RX);//Set HW for RX + Report("WHS_Shinko_Communication ", __FILE__,__LINE__,RWOption, RpMessage, Shinko_Comm_Stage, 0); Shinko_Comm_Stage++; break; case Stage_3: @@ -344,17 +344,15 @@ uint8_t WHS_Shinko_Communication(SHINKO_RW_OPTIONS_ENUM RWOption) //reading ever Status = ERROR; } + Report("WHS_Shinko_Communication ", __FILE__,__LINE__,RWOption, RpMessage, Shinko_Comm_Stage, 0); Shinko_Comm_Stage = Stage_0; - if(Option == RWOption) - { - Shinko_Read = false; - } +// if(Option == RWOption) +// Shinko_Read = false; break; default: - Shinko_Comm_Stage = Stage_0; - Shinko_Read = false; + Shinko_Comm_Stage++; break; } - return Status; // check header, checksum... + return Status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c index e0f7bb898..5d58c2cdf 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c +++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c @@ -228,6 +228,7 @@ void Valve_Command(Valves_t Valve_Id) //1 - OPEN, 0 - CLOSE case VALVE_DISPENSER_1: Dispenser_Valve_GPO_Reg.bits.F2_DISPENSER_VALVE_C1_1_C2_1 = ValveRequest[Valve_Id].Direction; + REPORT_MSG(ValveRequest[Valve_Id].Direction,"Dispenser 1 Set valve direction"); break; case VALVE_DISPENSER_2: Dispenser_Valve_GPO_Reg.bits.F2_DISPENSER_VALVE_C1_2_C2_2= ValveRequest[Valve_Id].Direction; diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 1ea6358da..2fc3bef6a 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -33,7 +33,7 @@ #include #include -#include + #include "drivers/Flash_ram/FlashProgram.h" #include "drivers/Flash_ram/MCU_E2Prom.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 62a52bcf3..99f29d22b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -47,7 +47,6 @@ #include "modules/Diagnostics/Diagnostics.h" #include "Modules/General/MachineStatus.h" -#include "drivers/Flash_Memory/Flash_Memory.h" #include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/Flash_ram/FlashProgram.h" @@ -68,6 +67,12 @@ #include "drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.h" #include "Drivers/Uart_Comm/WHS_Controller_Comm/Shinko/ACS-13AC5E3.h" +#include +#include +#include +#include +#include + Task_Handle Millisecond_Task_Handle; /******************** Definitions ********************************************/ @@ -600,6 +605,7 @@ uint32_t MillisecLowLoop(uint32_t tick) { uint8_t Motor_i,Disp_i,temp; TEMPERATURE_SENSOR_ID_ENUM Sensor_i; + RFID_READER_ID readerID; //static int temp=0; //call all modules Millisec functions @@ -647,6 +653,24 @@ uint32_t MillisecLowLoop(uint32_t tick) if (m20msecTick) { ADC0SS0Handler(); + /*if ((WHS_Type == WHS_TYPE_NEW)&&(Shinko_Read == true)) + { + if(ShinkoTempDeg.Read_Setup == 0x00)//didn't read it yet + { + WHS_Shinko_Communication(R_SETUP); + } + else*/ + /*if(0)//TBD - need stop condition to write only once (all the steps) , Read_Setup != setup, Read_Setup != 0, Read_Setup != Prev_Read_Setup + { + // option to wrte + read setup and stop when read = write + WHS_Shinko_Communication(W_SETUP); + } + else*/ + /*{ + //finish reading the setup before start reading the value + WHS_Shinko_Communication(R_Value); // Reading every fourth cycle (Set HW, Request, Set HW, Response) + } + }*/ } if(Fifty_msTick) { @@ -696,6 +720,18 @@ uint32_t MillisecLowLoop(uint32_t tick) } Trigger_InputsReading(); + + #ifdef USE_RFID + //every 100 m sec + for(readerID = READER_1; readerID < Max_Readers ; readerID++) + { + if(DiscoverRFIDTagEvery100mSec[readerID] == true) + { + RFIDCallEvery100mSec(readerID); + break; + } + } + #endif } if (Gradient_Tick) DispensersCollectionCall(); @@ -720,24 +756,6 @@ uint32_t MillisecLowLoop(uint32_t tick) if (isMotorConfigured(Motor_i)) MotorGetStatusFromFPGA(Motor_i); } - if ((WHS_Type == WHS_TYPE_NEW)&&(Shinko_Read == true)) - { - if(ShinkoTempDeg.Read_Setup == 0x00)//didn't read it yet - { - WHS_Shinko_Communication(R_SETUP); - } - else - /*if(0)//TBD - need stop condition to write only once (all the steps) , Read_Setup != setup, Read_Setup != 0, Read_Setup != Prev_Read_Setup - { - // option to wrte + read setup and stop when read = write - WHS_Shinko_Communication(W_SETUP); - } - else*/ - { - //finish reading the setup before start reading the value - WHS_Shinko_Communication(R_Value); // Reading every fourth cycle (Set HW, Request, Set HW, Response) - } - } } if ((O500Millisecond_Tick)&&(RapidPressureRead == false)) { @@ -810,6 +828,10 @@ uint32_t MillisecLowLoop(uint32_t tick) //call IFS state machine midTankStateMachine(); + + #ifdef USE_RFID + RFIDCycleEvery1Sec(); + #endif } if (Tensecond_Tick) { @@ -821,7 +843,6 @@ uint32_t MillisecLowLoop(uint32_t tick) } #endif - Shinko_Read = true;//start cycle of R/W setup or value every 10Sec } if (OneMinute_Tick) { @@ -845,6 +866,7 @@ uint32_t MillisecLowLoop(uint32_t tick) #ifdef CONTROL_DEBUG ResetControlTime(); #endif + Shinko_Read = true;//start cycle of R/W setup or value every 10Sec } if (TenMinutes_Tick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 36bcc0c3b..320c31fa7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -114,8 +114,8 @@ double dryerzone3temperature[DIAGNOSTICS_LIMIT+1];*/ double dispensermotorfrequency[MAX_SYSTEM_DISPENSERS][DIAGNOSTICS_LIMIT+1]; double dispenserspressure[MAX_SYSTEM_DISPENSERS][DIAGNOSTICS_LIMIT+1]; -double dispenserinklevel[MAX_SYSTEM_DISPENSERS][1]; -double midtankinklevel[MAX_SYSTEM_DISPENSERS][1]; +//double dispenserinklevel[MAX_SYSTEM_DISPENSERS][1]; +//double midtankinklevel[MAX_SYSTEM_DISPENSERS][1]; double MidTankpressure[MAX_SYSTEM_DISPENSERS][1]; double HeadFlowMeter,TotalFlowMeter; //double tempFlow = 0.0; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c index 0bb16c623..6d09e9f9e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c @@ -232,7 +232,7 @@ uint32_t DispenserAbortJoggingRequestFunc(MessageContainer* requestContainer) TimerMotors_t MotorId = (request->index)+HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; MotorStop(MotorId,Hard_Hiz); CurrentDispenserSpeed[request->index] = 0; - Control3WayValvesWithCallback ((Valves_t) request->index, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + Control3WayValvesWithCallback ((Valves_t) request->index, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer if (request->index == LUBRICANT_DISPENSER) { diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 774fd105b..2073fbaf0 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -289,7 +289,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters->has_ids_presegment_wfcf_timebeforesegment = true; EmbeddedParameters->ids_presegment_wfcf_timebeforesegment = 20000; uint8_t* response_buffer = my_malloc(configuration_parameters__get_packed_size(EmbeddedParameters)); - size_t response_size = 0; + if (response_buffer) { /*response_size = configuration_parameters__pack(EmbeddedParameters, response_buffer); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 991f4ecc0..4fe32e7cd 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -572,11 +572,11 @@ void IDS_Dispenser_Init(uint8_t DispenserId) HomingActive[DispenserId]= false; PrimingActive[DispenserId]= false; Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); -#ifdef DISPENSER_VALVES_OPEN +/*#ifdef DISPENSER_VALVES_OPEN Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer #else Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer -#endif +#endif*/ //if (Special_Dispensers == true) { if (ControlIdtoInactiveDispenserId[DispenserId] == 0xFF) diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index cd3feb624..1cf53fd07 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -642,6 +642,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl { endOfPrepareWCF = true; result = ModuleFail; + JobEndReason = JOB_PRESSURE_ALARM; pressureReady = true; ReportWithPackageFilter(IDSFilter,"pressure timeout!",__FILE__,DispenserBuildTimeCounter,NumofReadyDispensers,RpWarning,(int)(DispenserPreparePressure*100),0); for (i = 0; i < MAX_DYE_DISPENSERS; i++) diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c index 3a84a1bbd..b5dc7f3fe 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c @@ -86,6 +86,9 @@ bool newWHS_init(void) //Set_All_WHS_Fans(0xFF); // delayms(4000); //Trigger_SetWHSBlowerVoltage (0x0C00); + Task_sleep(1); + InitConsole_WHS_UART3();//WHS Shinko communication + return status; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 575d9881a..399831531 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -208,7 +208,7 @@ uint32_t InitSequenceMidTankCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag portId = (MidTankOperationCounter - MidTankCloseAir) ; //0-7 Disable_MidTank_Pressure_Reading(portId); Valve_Set(IDS_Id_to_AirValve[portId], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON - Control3WayValvesWithCallback ((Valves_t)portId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + //Control3WayValvesWithCallback ((Valves_t)portId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer } else if (MidTankOperationCounter >= MidTankReadPressure) diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index da9b6a893..8d11b75a3 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -214,7 +214,7 @@ static ReturnCode PrepareState(void *JobDetails) } if (Configured[Module_Waste]) { - // PrepareWaiting[Module_Waste] = ModuleWaiting; + PrepareWaiting[Module_Waste] = ModuleWaiting; } if (Configured[Module_Winder]) { @@ -248,8 +248,8 @@ static ReturnCode PrepareState(void *JobDetails) SendJobProgress(0.0, 0, false, "Winder prepare failed !!!!"); } } - //if (Configured[Module_Waste]) - // Waste_Prepare(); + if (Configured[Module_Waste]) + Waste_Prepare(); return retcode; } @@ -1390,10 +1390,12 @@ Void jobTask(UArg arg0, UArg arg1) ExitState(Message.messageData); break; case PreparationResultsOk: + Report("PreparationResultsOk",__FILE__,__LINE__, 5,RpMessage,0,0); PrintState(CurrentJob); break; case PreparationResultsFail: //send message data as a validation error message to host + Report("Job Ended PreparationResultsFail",__FILE__,__LINE__, 5,RpMessage,0,0); EndState(CurrentJob, "Prepare Failed"); //ExitState(Message.messageData); break; -- cgit v1.3.1 From 2d36ca07a6b43cf997aea3a987ed97cd3afcb655 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 27 Oct 2020 12:04:23 +0200 Subject: fix flash writing (parameters. now causes reset!), improve logs saving on errfile.txt, prevent motor alarms after hw configuration --- .../Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c | 17 ----------------- .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 6 +++++- .../Embedded_SW/Embedded/Common/report/reportInit.c | 5 +++++ .../Embedded_SW/Embedded/Communication/Connection.c | 4 ++-- .../Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 9 ++++----- .../Embedded/Drivers/flash_ram/FlashProgram.h | 2 ++ .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 10 +++++++--- .../Embedded/Modules/AlarmHandling/AlarmHandling.h | 2 ++ .../Embedded_SW/Embedded/Modules/Control/MillisecTask.c | 16 ++++++++-------- Software/Embedded_SW/Embedded/Modules/Control/control.c | 2 ++ .../Embedded/Modules/General/GeneralHardware.c | 1 + Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 9 +++++---- .../Embedded/Modules/Stubs_Handler/Progress.c | 4 ++++ .../Embedded_SW/Embedded/Modules/Waste/Waste_maint.c | 2 +- 14 files changed, 48 insertions(+), 41 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 56888b742..10f33c62b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -662,15 +662,6 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) FRESULT Fresult = FR_OK; FileInfo **FilesInfo = (FileInfo**)my_malloc(sizeof(FileInfo *)*(MAX_NUM_OF_FILES)); FileInfo Data[MAX_NUM_OF_FILES]; - /* - time_t t; - struct tm *ltm; - char *curTime; - t = time(NULL); - ltm = localtime(&t); - curTime = asctime(ltm); - Report(curTime, __FILE__, ltm->tm_hour,ltm->tm_min , RpWarning, ltm->tm_sec, 0); - */ if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { @@ -727,14 +718,6 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Data[i].lastmodifieddate = fno[i]->fdate; Data[i].has_lastmodifiedtime = true; Data[i].lastmodifiedtime = fno[i]->ftime; - /* - t = (fno[i]->fdate<<16)+fno[i]->ftime; - ltm = localtime(&t); - curTime = asctime(ltm); - usnprintf(&Datestr, 100, "File info %s %s",fno[i]->fname, curTime); - Report(Datestr, __FILE__, __LINE__, t, RpWarning, (int)Data[i].lastmodifiedtime, 0); - Task_sleep(50); - */ if (i==0) usnprintf(&FullPath[i], 50, "%s", request->path); diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index dbbe47ddb..2d39d25ec 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -165,6 +165,8 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) usnprintf(FullPath, 50, "%s%s%s", request->path,"/", VersionPackage->filedescriptors[File_i]->filename); FFresult = f_unlink("//SYSINFO//EMBPARAM.CFG"); FFresult |= f_rename (FullPath, "//SYSINFO//EMBPARAM.CFG"); + FlashInit(); + Reboot = true; LoadConfigurationParamsFromFile(true); Report("ConfigParams",__FILE__,FFresult,(int)NumberOfFiles,RpWarning,CurrentRunningFile,0); CurrentRunningFile++; @@ -173,7 +175,9 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) usnprintf(FullPath, 50, "%s%s%s", request->path,"/", VersionPackage->filedescriptors[File_i]->filename); FFresult = f_unlink("//SYSINFO//PROCESSP.CFG"); FFresult |= f_rename (FullPath, "//SYSINFO//PROCESSP.CFG"); - LoadProcessParamsFromFile(); + //LoadProcessParamsFromFile(); + FlashInit(); + Reboot = true; Report("ProcessParams",__FILE__,FFresult,(int)NumberOfFiles,RpWarning,CurrentRunningFile,0); CurrentRunningFile++; break; diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index 8890fa8b9..2778943f3 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -109,6 +109,10 @@ uint32_t OpenLogFile(void) uint32_t CloseLogFile(void) { /* perform default error output */ + int len; + uint32_t Bytes = 0; + len = usnprintf(RepMessage, 80, "Closing Log File %s %s",__DATE__, __TIME__); + LogFresult = f_write(LogFileHandle,RepMessage,len,&Bytes ); LogFresult = f_close(LogFileHandle); LogFileHandle = NULL; return LogFresult; @@ -329,6 +333,7 @@ uint32_t ReportInitMessage(MessageContainer* requestContainer) // ReportInitParams InitParams; StartDebugLogRequest* request = start_debug_log_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + Report("==============Saving file=================", __FILE__, __LINE__, _gTangoVersion.m_patch, RpWarning, _gTangoVersion.m_build, 0); ustrncpy (protobufToken, requestContainer->token,36); if (LogFileHandle != NULL) f_sync(LogFileHandle); diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index 0e90e5dbf..b566aa0e0 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -186,8 +186,8 @@ void KeepAliveRequest1Second(void) KARequestId++; //Report("keepalive request sent",__FILE__,__LINE__,KARequestId,RpWarning,msec_millisecondCounter, 0); - if (keepalivetest == false) - KeepAliveOneSecondCounter = 0; + //if (keepalivetest == false) + // KeepAliveOneSecondCounter = 0; //KeepAliveActive = true; responseContainer = createContainer(MESSAGE_TYPE__KeepAliveRequest, KARequestToken, true, &request, &keep_alive_request__pack, &keep_alive_request__get_packed_size); //------------------------------------------------------------------------------------------- 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 9d20d37a4..2ebaa4732 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -166,8 +166,7 @@ void Read_Motors_Driver_ADC(void) } else { - ReportWithPackageFilter(GeneralFilter,"the motor's combined driver adc",__FILE__,__LINE__,i,RpMessage,MotorDriverResponse[i].ADC,0); - + //ReportWithPackageFilter(GeneralFilter,"the motor's combined driver adc",__FILE__,__LINE__,i,RpMessage,MotorDriverResponse[i].ADC,0); } } @@ -192,9 +191,7 @@ void Read_Motors_Driver_ADC(void) { FPGA_Get_Res(i); MotorDriverResponse[i].ADC = Fpga_Spi[i].RX_MISO; - LOG_ERROR (i, "the motor's driver type"); - ReportWithPackageFilter(GeneralFilter,"the motor's driver adc",__FILE__,__LINE__,i,RpMessage,MotorDriverResponse[i].ADC,0); - + //ReportWithPackageFilter(GeneralFilter,"the motor's driver adc",__FILE__,__LINE__,i,RpMessage,MotorDriverResponse[i].ADC,0); } } } @@ -491,6 +488,8 @@ void FPGA_SetMotorsInit() { uint8_t i=0; + MotorConfiguredTimeout = 100; + //since powerstep in stby on powerup) F1_Moto_Driver_NSTBYRST1 = 0xFFFF; F1_Moto_Driver_NSTBYRST2 = 0xFFFF; diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.h b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.h index 655a980db..7da9f92a7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.h +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.h @@ -26,6 +26,8 @@ #define FLASH_SIZE 0X8000 +extern int base_flashErased; + //***************************************************************************** // // Read application data from a buffer and program it into flash. diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 42f60a151..6df2c27c6 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -73,6 +73,7 @@ bool AlarmHandlingActive = false; uint32_t AlarmHandlingControlId = 0xFF; uint32_t AlarmHandlingTick = 0; +int MotorConfiguredTimeout = 100; double CurrentAlarmHighLimit ,CurrentAlarmLowLimit; bool CheckHardLimitAlarms = false,CheckCurrentAlarms = false,CheckTamperAlarms = false,CheckMotorAlarms = false; uint8_t alarm_response_buffer[500]; @@ -504,7 +505,7 @@ uint32_t AlarmHandlingLoadFile(void) if (F_count == 4) { - ReportWithPackageFilter(AlarmFilter,"Writing four alarms", __FILE__,AlarmPtr,F_count, RpMessage, p_size, 0); + //ReportWithPackageFilter(AlarmFilter,"Writing four alarms", __FILE__,AlarmPtr,F_count, RpMessage, p_size, 0); F_count = 0; ReadAppAndProgram(AlarmPtr, p_size,FileAlarmItem); AlarmPtr+=p_size; @@ -976,7 +977,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) if ((IFS_Availability[1] == IFS_RECOGNIZED_INIT_PASSED)&&(IFS_Availability[2] == IFS_RECOGNIZED_INIT_PASSED)) //ifs installed -check cartridges { - tempFoundReason = Waste_Prepare(); + tempFoundReason = Waste_CheckState(); if (tempFoundReason!=JOB_OK) { FoundReason = tempFoundReason; @@ -1192,6 +1193,9 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (AlarmItem == NULL) return ERROR; int AlarmCounter=0; + if (MotorConfiguredTimeout) + MotorConfiguredTimeout--; + for (Alarm_i = 0;Alarm_i < NumOfSystemAlarms;Alarm_i++) { Status = false; @@ -1368,7 +1372,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) case ALARM_SOURCE_TYPE__MotorAlarm: if (CheckMotorAlarms) { - if ((FPGA_WD_Occurred == true)||(MachineReadyForHeating == false)) + if ((FPGA_WD_Occurred == true)||(MotorConfiguredTimeout > 0)) { Status = false; } diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h index 3b39370bf..0ce6d4816 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h @@ -10,6 +10,8 @@ #include "StateMachines/Printing/PrintingSTM.h" #include +extern int MotorConfiguredTimeout; + uint32_t AlarmHandlingFlashLoad(void); uint32_t AlarmHandlingLoadFile(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 8a14a1d67..689219583 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -822,14 +822,6 @@ uint32_t MillisecLowLoop(uint32_t tick) } if (Tensecond_Tick) { - #ifndef RUN_AS_MAIN_JIG - //Trigger_MidTank_Pressure_Read(); - for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++) - { - Read_MidTank_Pressure_Sensor(Disp_i); - } - #endif - } if (OneMinute_Tick) { @@ -864,6 +856,14 @@ uint32_t MillisecLowLoop(uint32_t tick) { Shinko_Cycle_Comm(); } +#ifndef RUN_AS_MAIN_JIG + //Trigger_MidTank_Pressure_Read(); + for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++) + { + Read_MidTank_Pressure_Sensor(Disp_i); + } +#endif + } if (OneHourTick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 14275533e..2047e9910 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -198,6 +198,8 @@ uint32_t ControlActivityLed( uint32_t Parameter1) ReportWithPackageFilter(FPGAFilter, "FPGA Watchdog Error",__FILE__,__LINE__,0,RpError, 0,0); ACTIVITY_GREEN_LED_ON; + MotorConfiguredTimeout = 100; + FPGA_SetMotorsInit(); Motor_ReconfigAllMotors(); } diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 2f9088cf1..90c18caa0 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -467,6 +467,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) //if (request->n_winders == 1) // status += InternalWinderConfigMessage(request->winders); + MotorConfiguredTimeout = 100; status += MotorsInit(); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 4fe32e7cd..2c2ebfd07 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -84,7 +84,7 @@ uint32_t InitialDispenserSpeed = INITIAL_DISPENSER_SPEED; uint32_t ControlIdtoInactiveDispenserId [MAX_SYSTEM_DISPENSERS] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; -uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t deviceID); +//uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t deviceID); AutoHoming_Config_enum AutoHoming_Config = AutoHoming_off; void IDS_Dispenser_SetAutoHoming_Config(AutoHoming_Config_enum Config) @@ -350,6 +350,7 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) CurrentDispenserSpeed[DispenserId] = 0; return OK; } +/* uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) { assert(DispenserId < MAX_SYSTEM_DISPENSERS); @@ -380,7 +381,7 @@ uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) } // HomingActive[DispenserId]= false; ReportWithPackageFilter(IDSFilter,"End homing for job start",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - /* else + /`* else { ReportWithPackageFilter(IDSFilter,"homing aborted,start backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); @@ -389,12 +390,12 @@ uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) Task_sleep(10); MotorSetSpeed(motorId, 1000); CurrentDispenserSpeed[DispenserId] = 1000; - }*/ + }*`/ //IDS_Dispenser_RefillEnded ( DispenserId, MotorsCfg[motorId].microstep); return OK; } - +*/ uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id) { int DispenserId; diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index fb8e97898..0d5d60af0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -948,7 +948,11 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) if((request->amount == 0x0CD) && (request->delay == 0x0CD)) //Get Gas Sensor { LOG_ERROR(request->delay,"Load embedded parameters from file and restart"); + base_flashErased = false; LoadConfigurationParamsFromFile(true); + LOG_ERROR(255,"Update successful, Rebooting in 5 seconds"); + Task_sleep (eOneSecond*5); + Power_Reset(); response.progress = (double)OK; response.has_progress = true; diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 1de7f1319..8043f76a9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -36,7 +36,7 @@ bool DoorState = OPEN; uint32_t timeout_counter = 0; int wasteLevel = 0; WasteCartridgeEnum SelectedCard = MaxWasteCartridges; -CartridgeStateEnum CartState[MaxWasteCartridges]; +CartridgeStateEnum CartState[MaxWasteCartridges];// = {CartridgeStateOUT,CartridgeStateOUT,CartridgeStateOUT}; uint32_t Cartridge_Cover_Control; button *CartLed[MaxWasteCartridges] = {0, &cart2, &cart3}; WasteTankStateEnum WasteTankState = WasteTankStateIdle; -- cgit v1.3.1