From 54115f60966580e3d37f48d28179bf4c13ef9a7e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 15 Jul 2019 13:43:16 +0300 Subject: Version 1.4.2.2 report filters introduced, improved flash handling. improved and simplified dispenser location. improved config parameters handling --- Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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 8682f706a..05b118c90 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -73,6 +73,7 @@ bool isDirectory(FileAttribute FileAtt) return true; return false; } +bool FileDone = false; uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) { @@ -106,6 +107,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) response.maxchunklength = MAX_CHUNK_LENGTH; strcpy(FileHandleChar, "1234"); response.uploadid = FileHandleChar; //supporting only single file at each time. + FileDone = false; } else { @@ -117,6 +119,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) } CommRxTaskHandle = Task_self(); Task_setPri(CommRxTaskHandle, 4); + // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); responseContainer = createContainer(MESSAGE_TYPE__FileUploadResponse, requestContainer->token, false, &response, &file_upload_response__pack, &file_upload_response__get_packed_size); @@ -134,7 +137,6 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) return OK; } -bool FileDone = false; FRESULT lFresult = FR_OK; uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { @@ -155,7 +157,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) // memcpy (&ReceivedFileHandle,request->uploadid,sizeof(ReceivedFileHandle)); //if (ReceivedFileHandle == FileHandle) //{ - Control_WD(ENABLE,10); //activate heaters/dispenser watchdog, 0.5 seconds + Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds + GeneralHwReady = false; KeepAliveOneSecondCounter = 0; Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes ); lFresult = Fresult; @@ -213,8 +216,11 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) my_free(responseContainer.data.data); SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__FileChunkUploadResponse); if (FileDone == true) + { Task_setPri(CommRxTaskHandle, 9); - + GeneralHwReady = true; + //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); + } return OK; } uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer) -- cgit v1.3.1 From 1a4e2e8a731c7d4c6150de73b36b7c40d6422cd7 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 24 Jul 2019 14:03:35 +0300 Subject: Version 1.4.2.5 firmware upgrade works, improved thread load. (works????) --- .../Embedded/Common/SWUpdate/FileSystem.c | 2 +- .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 5 +--- .../Embedded/Common/SWUpdate/FirmwareUpgrade.h | 1 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Drivers/FPGA/Full_Vme/FPGA_Programming_Up.c | 3 +++ .../Embedded/Drivers/Motors/MotorActions.c | 2 +- .../Embedded/Modules/Control/MillisecTask.c | 7 ++--- .../Embedded/Modules/Heaters/Heaters_init.c | 9 +++---- .../Embedded/Modules/Thread/ThreadLoad.c | 30 +++++++++++----------- 9 files changed, 29 insertions(+), 32 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 05b118c90..1e02283e0 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -53,7 +53,7 @@ FIL *UploadFileHandle = 0; //the system supports a single active file FIL *DownloadFileHandle = 0; //the system supports a single active file char FileHandleChar[5]; char ErrorMsg[100]; -#define MAX_CHUNK_LENGTH 4000 +#define MAX_CHUNK_LENGTH 5500 int32_t FileLength = 0; int32_t FileReceivedLength = 0; int32_t FileSentLength = 0; diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index dabd5ff44..139b452dc 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -71,6 +71,7 @@ uint32_t ActivateVersionCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) if (Reboot == true) { + LOG_ERROR(255,"Update successful, Rebooting in 5 seconds"); Task_sleep (120000000*5); Power_Reset(); } @@ -186,10 +187,6 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) activate_version_request__free_unpacked(request,NULL); SendChars(container_buffer, container_size); - if (Reboot == true) - { - Power_Reset(); - } return OK; } diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.h b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.h index 1d11a84b6..2b0a9bff9 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.h +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.h @@ -9,6 +9,7 @@ #define COMMON_SWUPDATE_FIRMWAREUPGRADE_H_ extern int CurrentFileSize; +extern int CurrentRunningFile; uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer); uint32_t ValidateVersionRequestFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 9c02e609e..5b0944ab9 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,2,5}; +TangoVersion_t _gTangoVersion = {1,4,2,6}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d 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 931044f82..11ba12c32 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 @@ -96,6 +96,7 @@ FRESULT FPGA_Programming_Up(FPGA_ID FPGA_Id, char * FullPath, bool IncludeReboot Report(FullPath,__FILE__,__LINE__,CurrentFileSize,RpWarning,0,0); fresult = main_vme(); + CurrentRunningFile++; } @@ -158,6 +159,8 @@ void FPGALoadTask(UArg arg0, UArg arg1) case OneFPGALoad: //ControlStop(); //MillisecStop(); + Report(FPGALoadMessage.FullPath,__FILE__,__LINE__,CurrentRunningFile,RpWarning,0,0); + FPGA_Programming_Up(FPGALoadMessage.FPGA_Id,FPGALoadMessage.FullPath,FPGALoadMessage.IncludeReboot); //ControlStart(); //MillisecStart(); diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 911b31eed..83e041591 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -343,7 +343,7 @@ uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callb } MotorSetDirection( MotorId, direction); - MotorSetSpeed (MotorId, 5); + MotorSetSpeed (MotorId, 15); MotorControlId[MotorId] = AddControlCallback( MotorMoveToDrierPositionCallBackFunction, eTenMillisecond,Control_Read_Dryer_Position,(IfTypeMotors*0x100+MotorId), MotorId, 0 ); MotorControlCallback[MotorId] = MotorMoveToDrierPositionCallBackFunction; return MotorControlId[MotorId]; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index c1fcd4030..e3955793d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -426,10 +426,8 @@ uint32_t MillisecLoop(uint32_t tick) { #ifdef Use_Head_Card HeadADCPT100_SendReadDataCommand(Sensor_i); - #else - TemperatureSensorReadFromFPGA_Res(Sensor_i); //got the data from the FPGA #endif - + TemperatureSensorReadFromFPGA_Res(Sensor_i); //got the data from the FPGA PT100Data[Sensor_i].WaitForData = false; PT100Data[Sensor_i].SyncRequired = true; if (PT100Data[Sensor_i].Callback) @@ -440,9 +438,8 @@ uint32_t MillisecLoop(uint32_t tick) { #ifdef Use_Head_Card HeadADCPT100_StartSync(Sensor_i); - #else - TemperatureSensorSync(Sensor_i); #endif + TemperatureSensorSync(Sensor_i); PT100Data[Sensor_i].SyncRequired = false; PT100Activity--; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c index faf6022d6..350236708 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c @@ -63,11 +63,10 @@ uint32_t Heaters_Init(void) int i; //ROM_TimerDisable(Heater_timerBase, TIMER_A); - #ifdef Use_Head_Card - HeadADCPT100_SensorInitConfig(); - #else - FPGA_SensorInitConfig(); - #endif +#ifdef Use_Head_Card + HeadADCPT100_SensorInitConfig(); +#endif + FPGA_SensorInitConfig(); memset(HeaterControl,0,sizeof(HeaterControl)); for (i = 0;i Date: Sun, 28 Jul 2019 06:22:27 +0300 Subject: try mutual exclusion on files, need to handle timeouts yet --- .../Embedded/Common/SWUpdate/FileSystem.c | 20 ++++++++++++++++++++ .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 2 ++ .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 2 +- .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h | 2 +- Software/Embedded_SW/Embedded/Embedded.cfg | 5 +++++ .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 2 +- .../Embedded/StateMachines/Printing/PrintingSTM.c | 3 +++ 7 files changed, 33 insertions(+), 3 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 1e02283e0..f4c52f000 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -62,6 +62,7 @@ uint32_t WrittenBytes = 0; uint32_t ReadBytes = 0; Task_Handle CommRxTaskHandle; +extern Semaphore_Handle FFS_Sem; ErrorCode getErrorCode(FRESULT Fresult) { @@ -97,6 +98,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); if (Fresult == FR_OK) { @@ -113,6 +115,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) { my_free (UploadFileHandle); UploadFileHandle = 0; + Semaphore_post(FFS_Sem); } } @@ -219,6 +222,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { Task_setPri(CommRxTaskHandle, 9); GeneralHwReady = true; + Semaphore_post(FFS_Sem); //Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0); } return OK; @@ -252,6 +256,7 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_open(DownloadFileHandle,request->filename,FA_READ ); if (Fresult == FR_OK) { @@ -309,6 +314,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileSentLength,"file download ended successfully"); f_close(SentFileHandle); + Semaphore_post(FFS_Sem); my_free (DownloadFileHandle); FileSentLength = 0; } @@ -318,6 +324,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileSentLength,"file download too much data!"); f_close(SentFileHandle); + Semaphore_post(FFS_Sem); my_free (DownloadFileHandle); FileSentLength = 0; } @@ -414,6 +421,7 @@ uint32_t CreateRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_open(UploadFileHandle,request->path,FA_CREATE_NEW); if (Fresult == FR_OK) { @@ -422,6 +430,7 @@ uint32_t CreateRequestFunc(MessageContainer* requestContainer) Fresult = FR_LOCKED; } } + Semaphore_post(FFS_Sem); } } if (Fresult != FR_OK) @@ -461,7 +470,9 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer) //int NumOfFiles = 0; FRESULT Fresult = FR_OK; + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_unlink(request->path); + Semaphore_post(FFS_Sem); REPORT_MSG(Fresult, "File Delete"); responseContainer = createContainer(MESSAGE_TYPE__DeleteResponse, requestContainer->token, false, &response, &delete_response__pack, &delete_response__get_packed_size); @@ -543,9 +554,11 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) int i,NumOfFiles = 0; FRESULT Fresult = FR_OK; + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult |= f_opendir(&dir, g_cCwdBuf); if(Fresult != FR_OK) { + Semaphore_post(FFS_Sem); return(Fresult); } @@ -574,6 +587,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) } } } + Semaphore_post(FFS_Sem); if ((Fresult == FR_OK)&&(NumOfFiles)) { @@ -643,6 +657,8 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path) Fresult = FR_DENIED; else { + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); + Fresult = f_open(FileHandle,path,FA_WRITE | FA_OPEN_ALWAYS); if (Fresult == FR_OK) { @@ -657,6 +673,7 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path) { LOG_ERROR (Fresult,"fopen error"); } + Semaphore_post(FFS_Sem); my_free(FileHandle); } } @@ -686,6 +703,7 @@ FRESULT FileRead(char *path, uint32_t *Size, void **Buffer) Fresult = FR_DENIED; else { + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_open(FileHandle,path,FA_READ); if (Fresult == FR_OK) { @@ -701,6 +719,7 @@ FRESULT FileRead(char *path, uint32_t *Size, void **Buffer) my_free (buffer); } f_close(FileHandle); + Semaphore_post(FFS_Sem); } else { @@ -739,6 +758,7 @@ FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle) if (FileHandle == 0) Fresult = FR_DENIED; else + Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult = f_open(FileHandle,path,FA_READ); } else diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index 139b452dc..7c6b4d4ef 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -30,6 +30,8 @@ #include "Modules/Control/Control.h" #include "Modules/AlarmHandling/AlarmHandling.h" +extern Semaphore_Handle FFS_Sem; + int NumberOfFiles = 0,CurrentRunningFile; int CurrentFileSize = 0; uint32_t ActivateVersionControlId = 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 a38b0a06c..a8bdaf95c 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 @@ -691,7 +691,7 @@ bool Get_COVER_1_State(COVERS_ENUM CoverId) case FrontDoor3_DH_DRYER: return F3_GPI_01_Reg.bits.F3_GPI_PANSW3; //break; - case FrontDoor4_MIDTHANK: + case FrontDoor4_MIDTANKS: return F3_GPI_01_Reg.bits.F3_GPI_PANSW4; //break; case CartridgesDoor: diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h index d77e9931c..9767837f1 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h @@ -221,7 +221,7 @@ typedef enum FrontDoor1_EC, FrontDoor2_PPC, FrontDoor3_DH_DRYER, - FrontDoor4_MIDTHANK, + FrontDoor4_MIDTANKS, CartridgesDoor, RearDoor, DryerDoor, diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index a0b853ec8..8dc53256b 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -72,6 +72,11 @@ semaphore3Params.instance.name = "updateSem"; semaphore3Params.mode = Semaphore.Mode_BINARY; Program.global.updateSem = Semaphore.create(null, semaphore3Params); +var semaphore4Params = new Semaphore.Params(); +semaphore4Params.instance.name = "FFS_Sem"; +semaphore4Params.mode = Semaphore.Mode_BINARY; +Program.global.FFS_Sem = Semaphore.create(null, semaphore4Params); + var semaphore7Params = new Semaphore.Params(); semaphore7Params.instance.name = "ReconnectSem"; semaphore7Params.mode = Semaphore.Mode_BINARY; diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 4504c74f5..c4fcfaf8e 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -252,7 +252,7 @@ const AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,FrontDoor1_EC ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__FRONT_COVER_1_OPEN}, {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,FrontDoor2_PPC ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__FRONT_COVER_2_OPEN}, {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,FrontDoor3_DH_DRYER ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__FRONT_COVER_3_OPEN}, - {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,FrontDoor4_MIDTHANK ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__FRONT_COVER_4_OPEN}, + {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,FrontDoor4_MIDTANKS ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__FRONT_COVER_4_OPEN}, {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,RearDoor ,1,false,true,DEBUG_LOG_CATEGORY__Error, 0xFF,5,EVENT_TYPE__REAR_COVER_OPEN }, {eHundredMillisecond,ALARM_SOURCE_TYPE__CoversAlarm,CartridgesDoor,1,false,true,DEBUG_LOG_CATEGORY__Warning,0xFF,5,EVENT_TYPE__CARTRIDGES_COVER_OPEN}, diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 729e3ab8e..2959a688b 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -128,9 +128,12 @@ FRESULT RewindJobFile() } return Fresult; } +extern Semaphore_Handle FFS_Sem; FRESULT CloseJobFile() { Fresult = f_close(JobRequestFileHandle); + Semaphore_post(FFS_Sem); + readbBytes = 0; ImmediateRead = 0; SegmentSize = 0; -- cgit v1.3.1 From a3f1ec8389cde87fff45dced9380f85d1b2424c6 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 28 Jul 2019 12:31:49 +0300 Subject: for version 1.4.2.7 : syc file system with semaphore (needs testing!). add secondary pump and activation on init and after 8 hours.now config parameters, improved thread load --- .../Embedded/Common/SWUpdate/FileSystem.c | 8 +- .../Embedded/Common/SWUpdate/FileSystem.h | 2 +- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../PMR/Diagnostics/InterfaceIOs.pb-c.c | 30 +++--- .../PMR/Diagnostics/InterfaceIOs.pb-c.h | 1 + .../PMR/Hardware/HardwareMotor.pb-c.c | 34 +++---- .../PMR/Hardware/HardwareMotor.pb-c.h | 18 ++-- .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 16 ++++ .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h | 1 + .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 6 +- .../Flash_Memory/FATFS/Control_File_System.c | 3 + .../Embedded/Drivers/Motors/MotorActions.c | 4 +- Software/Embedded_SW/Embedded/Embedded.cfg | 1 + .../Embedded/Modules/Control/MillisecTask.c | 15 ++- .../Modules/Diagnostics/DiagnosticActions.c | 3 + .../Embedded/Modules/Diagnostics/Diagnostics.c | 4 +- .../Embedded/Modules/General/GeneralHardware.c | 2 +- .../Embedded_SW/Embedded/Modules/General/buttons.c | 42 ++++++--- .../Embedded_SW/Embedded/Modules/General/process.c | 2 +- .../Embedded/Modules/IDS/IDS_dispenser.c | 2 +- .../Embedded/Modules/Thread/ThreadLoad.c | 104 +++++++++++++++------ .../Embedded/Modules/Thread/Thread_ex.h | 8 +- .../Embedded/Modules/Thread/Thread_init.c | 2 +- .../StateMachines/Initialization/InitSequence.c | 5 + 24 files changed, 211 insertions(+), 104 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 f4c52f000..5cbc92285 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -644,7 +644,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) } return Fresult; } -FRESULT FileWrite(void * buffer, uint16_t size,char *path) +FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout) { FRESULT Fresult = FR_OK; FIL *FileHandle = 0; //the system supports a single active file @@ -657,7 +657,11 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path) Fresult = FR_DENIED; else { - Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); + if (Semaphore_pend(FFS_Sem, timeout) == false) + { + LOG_ERROR (false,"file system busy error"); + return FR_TIMEOUT; + } Fresult = f_open(FileHandle,path,FA_WRITE | FA_OPEN_ALWAYS); if (Fresult == FR_OK) diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h index 605b4a475..0f6fd9d5d 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h @@ -22,7 +22,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer); uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer); uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer); -FRESULT FileWrite(void * buffer, uint16_t size,char *path); +FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout); FRESULT FileRead(char *path, uint32_t *Size, void **Buffer); FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 5b0944ab9..2ef74c7b6 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,2,6}; +TangoVersion_t _gTangoVersion = {1,4,2,7}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c index ec93b525c..3dfdfc2bb 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c @@ -7,7 +7,7 @@ #endif #include "InterfaceIOs.pb-c.h" -static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = +static const ProtobufCEnumValue interface_ios__enum_values_by_number[40] = { { "ANALOG_MIXCHIP_TEMP", "INTERFACE_IOS__ANALOG_MIXCHIP_TEMP", 0 }, { "GPO_MIXCHIP_SSR4_CTRL", "INTERFACE_IOS__GPO_MIXCHIP_SSR4_CTRL", 19 }, @@ -40,6 +40,7 @@ static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = { "Midtank7Cartridge", "INTERFACE_IOS__Midtank7Cartridge", 179 }, { "Midtank8Cartridge", "INTERFACE_IOS__Midtank8Cartridge", 180 }, { "GPO_LED4", "INTERFACE_IOS__GPO_LED4", 274 }, + { "GPO_TFEED_BREAK_1", "INTERFACE_IOS__GPO_TFEED_BREAK_1", 296 }, { "GPO_SPARE1_1", "INTERFACE_IOS__GPO_SPARE1_1", 318 }, { "GPO_SPARE1_2", "INTERFACE_IOS__GPO_SPARE1_2", 319 }, { "GPI_WCONTAINER_FULL", "INTERFACE_IOS__GPI_WCONTAINER_FULL", 341 }, @@ -50,15 +51,15 @@ static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = { "VALVE_WASTE_TANK", "INTERFACE_IOS__VALVE_WASTE_TANK", 346 }, }; static const ProtobufCIntRange interface_ios__value_ranges[] = { -{0, 0},{19, 1},{43, 6},{54, 9},{64, 11},{163, 12},{274, 30},{318, 31},{341, 33},{0, 39} +{0, 0},{19, 1},{43, 6},{54, 9},{64, 11},{163, 12},{274, 30},{296, 31},{318, 32},{341, 34},{0, 40} }; -static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = +static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[40] = { { "ANALOG_MIXCHIP_TEMP", 0 }, - { "GPI_WCONTAINER_FULL", 33 }, - { "GPI_WCONTAINER_WARN", 34 }, - { "GPO_BLOWER_PWM", 35 }, - { "GPO_CHILLER_SSR9_CTRL", 36 }, + { "GPI_WCONTAINER_FULL", 34 }, + { "GPI_WCONTAINER_WARN", 35 }, + { "GPO_BLOWER_PWM", 36 }, + { "GPO_CHILLER_SSR9_CTRL", 37 }, { "GPO_DILUTORPUMP_SSR10_CTRL", 12 }, { "GPO_DRYER_SSR1_CTRL", 6 }, { "GPO_DRYER_SSR2_CTRL", 7 }, @@ -70,12 +71,13 @@ static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = { "GPO_EXTWINDER_SSR11_CTRL", 11 }, { "GPO_LED4", 30 }, { "GPO_MIXCHIP_SSR4_CTRL", 1 }, - { "GPO_SPARE1_1", 31 }, - { "GPO_SPARE1_2", 32 }, + { "GPO_SPARE1_1", 32 }, + { "GPO_SPARE1_2", 33 }, { "GPO_SPARE_SSR12_CTRL", 9 }, { "GPO_SPARE_SSR13_CTRL", 10 }, + { "GPO_TFEED_BREAK_1", 31 }, { "GPO_WASTECH_PUMP2", 13 }, - { "GPO_WHS_WTANKPUMP2", 37 }, + { "GPO_WHS_WTANKPUMP2", 38 }, { "Midtank1Air", 14 }, { "Midtank1Cartridge", 22 }, { "Midtank2Air", 15 }, @@ -92,7 +94,7 @@ static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = { "Midtank7Cartridge", 28 }, { "Midtank8Air", 21 }, { "Midtank8Cartridge", 29 }, - { "VALVE_WASTE_TANK", 38 }, + { "VALVE_WASTE_TANK", 39 }, }; const ProtobufCEnumDescriptor interface_ios__descriptor = { @@ -101,11 +103,11 @@ const ProtobufCEnumDescriptor interface_ios__descriptor = "InterfaceIOs", "InterfaceIOs", "", - 39, + 40, interface_ios__enum_values_by_number, - 39, + 40, interface_ios__enum_values_by_name, - 9, + 10, interface_ios__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h index 341997ea0..1baf3dbc6 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h @@ -51,6 +51,7 @@ typedef enum _InterfaceIOs { INTERFACE_IOS__Midtank7Cartridge = 179, INTERFACE_IOS__Midtank8Cartridge = 180, INTERFACE_IOS__GPO_LED4 = 274, + INTERFACE_IOS__GPO_TFEED_BREAK_1 = 296, INTERFACE_IOS__GPO_SPARE1_1 = 318, INTERFACE_IOS__GPO_SPARE1_2 = 319, INTERFACE_IOS__GPI_WCONTAINER_FULL = 341, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c index bfda97424..fb4967ab5 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c @@ -358,7 +358,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "GateCfg1", 26, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_gatecfg1), offsetof(HardwareMotor, gatecfg1), NULL, @@ -370,7 +370,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "GateCfg2", 27, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_gatecfg2), offsetof(HardwareMotor, gatecfg2), NULL, @@ -379,10 +379,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalHold", + "TValHold", 28, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalhold), offsetof(HardwareMotor, tvalhold), NULL, @@ -391,10 +391,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalRun", + "TValRun", 29, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalrun), offsetof(HardwareMotor, tvalrun), NULL, @@ -403,10 +403,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalAcc", + "TValAcc", 30, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalacc), offsetof(HardwareMotor, tvalacc), NULL, @@ -415,10 +415,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalDec", + "TValDec", 31, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvaldec), offsetof(HardwareMotor, tvaldec), NULL, @@ -430,7 +430,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TFast", 32, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tfast), offsetof(HardwareMotor, tfast), NULL, @@ -442,7 +442,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TOnMin", 33, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tonmin), offsetof(HardwareMotor, tonmin), NULL, @@ -454,7 +454,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TOffMin", 34, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_toffmin), offsetof(HardwareMotor, toffmin), NULL, @@ -493,11 +493,11 @@ static const unsigned hardware_motor__field_indices_by_name[] = { 31, /* field[31] = TFast */ 33, /* field[33] = TOffMin */ 32, /* field[32] = TOnMin */ + 29, /* field[29] = TValAcc */ + 30, /* field[30] = TValDec */ + 27, /* field[27] = TValHold */ + 28, /* field[28] = TValRun */ 18, /* field[18] = ThermalCompensationFactor */ - 29, /* field[29] = TvalAcc */ - 30, /* field[30] = TvalDec */ - 27, /* field[27] = TvalHold */ - 28, /* field[28] = TvalRun */ }; static const ProtobufCIntRange hardware_motor__number_ranges[1 + 1] = { diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h index 789e1e139..2dfc0b200 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h @@ -78,23 +78,23 @@ struct _HardwareMotor protobuf_c_boolean has_fsspd; int32_t fsspd; protobuf_c_boolean has_gatecfg1; - uint32_t gatecfg1; + int32_t gatecfg1; protobuf_c_boolean has_gatecfg2; - uint32_t gatecfg2; + int32_t gatecfg2; protobuf_c_boolean has_tvalhold; - uint32_t tvalhold; + int32_t tvalhold; protobuf_c_boolean has_tvalrun; - uint32_t tvalrun; + int32_t tvalrun; protobuf_c_boolean has_tvalacc; - uint32_t tvalacc; + int32_t tvalacc; protobuf_c_boolean has_tvaldec; - uint32_t tvaldec; + int32_t tvaldec; protobuf_c_boolean has_tfast; - uint32_t tfast; + int32_t tfast; protobuf_c_boolean has_tonmin; - uint32_t tonmin; + int32_t tonmin; protobuf_c_boolean has_toffmin; - uint32_t toffmin; + int32_t toffmin; }; #define HARDWARE_MOTOR__INIT \ { PROTOBUF_C_MESSAGE_INIT (&hardware_motor__descriptor) \ 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 a8bdaf95c..dd700563b 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 @@ -730,7 +730,23 @@ void Pumps_Control(PUMPS_ENUM Pump_Id, bool Direction) //1 - OPEN, 0 - CLOSE ?? F1_gpo_01 = F1_GPO_Reg.ushort; } +uint32_t SecondaryPumpControlId; +uint32_t SecondaryPumpCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + Pumps_Control(WASTECH_PUMP2, CLOSE); + if (SafeRemoveControlCallback(SecondaryPumpControlId, SecondaryPumpCallBackFunction )==OK) + SecondaryPumpControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)SecondaryPumpControlId,RpWarning,(int)SecondaryPumpCallBackFunction,0); + +} + +void PumpActivation(uint32_t seconds) +{ + Pumps_Control(WASTECH_PUMP2, OPEN); + SecondaryPumpControlId = AddControlCallback( SecondaryPumpCallBackFunction, seconds*1000/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); +} /* uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode) { diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h index 9767837f1..420a82b47 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h @@ -237,6 +237,7 @@ typedef enum void Pumps_Control(PUMPS_ENUM Pump_Id, bool Direction); +void PumpActivation(uint32_t seconds); uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent); bool Check_Disp_Safety_Stop_Indication(uint8_t Dispenser_ID); bool Emergency_Push_Button_Report(); 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 07625d314..e130f4831 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -1167,7 +1167,8 @@ void FPGA_SetMotKvalRun(TimerMotors_t _motorId) Fpga_Spi[_motorId].TX_MOSI = temp; Fpga_Spi[_motorId].AMT_OF_Words = 4; - FPGA_SPI_Transnit(_motorId); + MillisecWriteToMotor(_motorId, temp, 4, NULL); + //FPGA_SPI_Transnit(_motorId); } void FPGA_SetMotKvalAcc(TimerMotors_t _motorId) @@ -1192,7 +1193,8 @@ void FPGA_SetMotKvalAcc(TimerMotors_t _motorId) Fpga_Spi[_motorId].TX_MOSI = temp; Fpga_Spi[_motorId].AMT_OF_Words = 4; - FPGA_SPI_Transnit(_motorId); + MillisecWriteToMotor(_motorId, temp, 4, NULL); +// FPGA_SPI_Transnit(_motorId); } void FPGA_SetMotKvalDec(TimerMotors_t _motorId) diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c index c58be6664..94f341b7d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c @@ -91,6 +91,7 @@ static FATFS g_sFatFs; //tFResultString; //static int response ; +extern Semaphore_Handle FFS_Sem; char FlashReadstring [35]; char FlashReadstring1 [35]; @@ -128,6 +129,8 @@ FRESULT Init_Flash_File_System(bool Need_mkfs) if(Need_mkfs == true) iFResult = f_mkfs( 0, 0, 512 ); //Create File System on the Drive + Semaphore_post(FFS_Sem); + return iFResult; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 83e041591..e2b0ed701 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -201,7 +201,7 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) / if (CallbackCalls%20 == 0) { // REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction"); - Report("Move_To_Stopper_Callback",__FILE__,__LINE__,MotorPosition,RpMessage,StoredMotorPosition[MotorId],0); + //Report("Move_To_Stopper_Callback",__FILE__,__LINE__,MotorPosition,RpMessage,StoredMotorPosition[MotorId],0); //CallbackCalls = 0; } @@ -285,7 +285,7 @@ uint32_t MotorMoveToDrierPositionCallBackFunction(uint32_t IfIndex, uint32_t Rea //CallbackCalls = 0; } - if (DrierZeroPosition == ReadValue) //thread running identified + //if (DrierZeroPosition == ReadValue) //thread running identified { //stop this control loop SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index 8dc53256b..9aa9b2470 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -1,5 +1,6 @@ var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); +var Seconds = xdc.useModule('ti.sysbios.hal.Seconds'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e3955793d..063d7c823 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -492,6 +492,8 @@ void setRapidPressureRead(bool value) { RapidPressureRead = value; } + +uint16_t PumpCounter = 0; uint32_t MillisecLowLoop(uint32_t tick) { uint8_t Motor_i,Disp_i,Heater_i,temp; @@ -501,13 +503,14 @@ uint32_t MillisecLowLoop(uint32_t tick) //call all modules Millisec functions //test dancers and speed encoders //check all callback units (state machine waiting for completion of a change) - bool Ten_msTick, Hundred_msTick , m90msecTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick; + bool Ten_msTick, Hundred_msTick , m90msecTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick,OneHourTick; Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; m90msecTick = (tick%eHundredMillisecond == 90) ?true:false; O900Millisecond_Tick = (tick%eOneSecond == 900) ?true:false; Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; OneMinute_Tick = (tick%eOneMinute == 0) ?true:false; + OneHourTick = (tick%eOneHour == 0) ?true:false; //gather Motor data from FPGA //ROM_IntMasterDisable(); @@ -611,6 +614,16 @@ uint32_t MillisecLowLoop(uint32_t tick) MotorGetStatusFromFPGA(Motor_i); }*/ } + if (OneHourTick) + { +#define PUMP_LIMIT 8 + PumpCounter++; + if (PumpCounter>=PUMP_LIMIT) + { + PumpActivation(900); + PumpCounter = 0; + } + } //ROM_IntMasterEnable(); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index f8a57362a..4597efa93 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -268,6 +268,9 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) else Lubricant_2Way_Valve(STOP);//use START or STOP, 0 - 100%(); break; + case INTERFACE_IOS__GPO_TFEED_BREAK_1: + Pumps_Control(WASTECH_PUMP2, request->value); + break; default: responseContainer.has_error = true; responseContainer.error = ERROR_CODE__GENERAL_ERROR; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index a22bfc815..98e760b32 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -115,7 +115,7 @@ DoubleArray DiagnosticsDispenserPressure[MAX_SYSTEM_DISPENSERS]; HeaterState **heatersstates; HeaterState HeaterInfo[HEATER_TYPE__MixerHeater+1]; DigitalInterfaceState **digitalinterfacestates; -DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+9]; +DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+10]; /*double dispenser1motorfrequency[DIAGNOSTICS_LIMIT+1]; double dispenser2motorfrequency[DIAGNOSTICS_LIMIT+1]; double dispenser3motorfrequency[DIAGNOSTICS_LIMIT+1]; @@ -390,7 +390,7 @@ void Diagnostic100msecCollection(void) dispenserspressure[i][DiagnosticsIndex] = GetDispenserPressure(i); //Read_MidTank_Pressure_Sensor MidTankpressure[i][0] = Get_MidTank_Pressure_Sensor(i); //MidTankpressure[i][0] = IDS_Dispenser_Data[i].totalconsumedinnanolitter; - MidTankpressure[i][0] = IDS_Dispenser_Data[i].consumedinnanolitter; + MidTankpressure[i][0] = 1.00-(IDS_Dispenser_Data[i].consumedinnanolitter/5800000); } #ifndef REDUCED_DIAGNOSTICS for (i=0;idata.data); - FileWrite(requestContainer->data.data, requestContainer->data.len,HwConfigPath); + FileWrite(requestContainer->data.data, requestContainer->data.len,HwConfigPath,BIOS_WAIT_FOREVER); UploadHardwareConfigurationRequest* UploadRequest = upload_hardware_configuration_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index 1c719d778..52f717626 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -538,14 +538,14 @@ uint32_t LoadStatMachine( button *pBtn) { case sttRDY : REPORT_MSG(parameter," ------------ load.state = sttRDY ----------------- "); - switch (pBtn->Action) +/* switch (pBtn->Action) { case (SHORTPB): case (LONGPB): case (REPLONGPB): pBtn->state = sttPRELOAD; - pBtn->color = BLINK; - if (ThreadLoadStateMachine( THREAD_LOAD_INIT)) + pBtn->color = BLINK;*/ + if (ThreadLoadButton( THREAD_LOAD_INIT)) { pBtn->state = sttPRELOAD ; // to do pBtn->color = BLUE; @@ -553,41 +553,54 @@ uint32_t LoadStatMachine( button *pBtn) } else { - pBtn->state = sttDISABLE ; + // pBtn->state = sttDISABLE ; Pannel_Leds(THREAD_LOAD, MODE_OFF);//AVI+ } - break; + /*break; default : break; - } + }*/ break; case sttPRELOAD: REPORT_MSG(parameter," ------------ load.state = sttPRELOAD ----------------- "); - switch (pBtn->Action) + /*switch (pBtn->Action) { case (SHORTPB): case (LONGPB): case (REPLONGPB): pBtn->color = BLUE; - Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ - if (ThreadLoadStateMachine( THREAD_LOAD_INITIAL_TENSION)) + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+*/ + if (ThreadLoadButton( THREAD_LOAD_INITIAL_TENSION)) { - pBtn->state = sttLOADSUCSESS ; // to do + pBtn->state = sttRDY ; // to do pBtn->color = BLUE; Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ } else { - pBtn->state = sttLOADFAIL ; + //pBtn->state = sttLOADFAIL ; pBtn->color = fastBILNK ; // to do } - break; + /*break; default : break; - } + }*/ break; case sttLOADING: REPORT_MSG(parameter," ------------ load.state = sttLOADING ----------------- "); + pBtn->color = fastBILNK; + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ + if (ThreadLoadButton( THREAD_LOAD_END)) + { + pBtn->state = sttRDY ; // to do + pBtn->color = BLUE; + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ + } + else + { + //pBtn->state = sttLOADFAIL ; + pBtn->color = fastBILNK ; // to do + } break; // case sttLOADSUCSESS ????? // break; @@ -596,7 +609,8 @@ uint32_t LoadStatMachine( button *pBtn) default: //sttDISABLE REPORT_MSG(parameter," ------------ load.state = default ----------------- "); - pBtn->color = colorOFF; + pBtn->state = sttRDY ; // to do + pBtn->color = BREATHING; Pannel_Leds(THREAD_LOAD, MODE_OFF);//AVI+ break; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index b968381c6..2c8788bdc 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -191,7 +191,7 @@ void ProcessRequestFunc(MessageContainer* requestContainer) ProcessParameters* ProcessParams = request->processparameters; if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters { - FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath); + FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath,BIOS_WAIT_FOREVER); Bytes = sizeof(ProcessParameters); EraseFlashSection(PROCESS_PARAMETERS_MAP_IN_FLASH,Bytes+4); ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH, 4,&Bytes); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 6d7f0df96..88032f756 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -298,7 +298,7 @@ uint32_t IDS_Dispenser_Store_Data (void) ReadAppAndProgram(DISPENSERS_MAP_IN_FLASH, 4,&response_size); ReadAppAndProgram(DISPENSERS_MAP_IN_FLASH+4, response_size, IDS_Dispenser_Data); - Status = FileWrite(IDS_Dispenser_Data,response_size,DispenserStorePath); + Status = FileWrite(IDS_Dispenser_Data,response_size,DispenserStorePath,BIOS_NO_WAIT); DispenserDataUpdated = false; REPORT_MSG(msec_millisecondCounter - timing, "Updating dispensers file - time"); return Status; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 837221274..366f4b163 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -45,18 +45,24 @@ 5 THREAD_LOAD_LIFT_DANCERS, 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE 7 THREAD_LOAD_INITIAL_TENSION, //CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND - 8 THREAD_LOAD_CLOSE_ROCKERS, 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD 10 THREAD_LOAD_CLOSE_LIDS, - 11 THREAD_LOAD_RESUME_HEATING, - 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION - 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 + 12 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + 8 THREAD_LOAD_CLOSE_ROCKERS, + 11 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + 13 THREAD_LOAD_RESUME_HEATING, 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING 15 THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM;*/ THREAD_LOAD_STAGES_ENUM LoadStages = THREAD_LOAD_INIT; ProcessParameters ProcessParametersClear,ProcessParametersRecover; + + int32_t keepmicrostep; + int32_t keepkvalrun; + uint8_t CallbackCounter = 0; + uint8_t TimeoutsCounter = 0; + uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; uint32_t ControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; @@ -163,7 +169,7 @@ } else*/ { - Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); //storeLoadArmParameters(); SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; @@ -173,6 +179,7 @@ } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { + if(PullerControlId != 0xFF) { MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); @@ -192,7 +199,8 @@ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz); // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); - Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + CallbackCounter = 0; + Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); NumberOfDrierLoaderCycles=0; //storeLoadArmParameters(); LoadStages++; @@ -224,13 +232,11 @@ //Use Notation How Many Rotations In The Drier, Or Check Against Stopper. Move Slowly return OK; } - uint8_t CallbackCounter = 0; - uint8_t TimeoutsCounter = 0; uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue) { - Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); - REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id"); + Report("Thread_Load_HomingCallback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); +// REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id"); if (CallbackCounter) { CallbackCounter--; @@ -249,12 +255,12 @@ else { LoadStages++; - if (LoadStages == THREAD_LOAD_LIFT_ROCKERS) + if (LoadStages == THREAD_LOAD_CLOSE_ROCKERS) { - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepmicrostep); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepmicrostep); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepkvalrun); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepkvalrun); } if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call { @@ -303,16 +309,18 @@ uint32_t Thread_Load_Lift_Rockers(void) //Machine Is Ready. Send Message, Start Timer To Close Lids, Wait For Operator Response { + keepmicrostep = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep; + keepkvalrun = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].kvalrun; REPORT_MSG(LoadStages, "Thread Load State Machine step"); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 35); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 35); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 2); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 2); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 70); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 70); Task_sleep(10); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000); return OK; } @@ -334,9 +342,9 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,12000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,12000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000); return OK; } @@ -388,7 +396,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 200, FEEDER_DANCER ,true, Thread_Load_HomingCallback,10000); + MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 100, FEEDER_DANCER ,true, Thread_Load_HomingCallback,2000); return OK; } @@ -459,6 +467,7 @@ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4); ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+FEEDER_MOTOR),FEEDER_DANCER,FEEDER_MOTOR); + Report("AddControlCallback feeder",__FILE__,__LINE__,ControlId,RpMessage,IfTypeThread*0x100+FEEDER_MOTOR,0); CallbackCounter++; MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); @@ -466,7 +475,7 @@ //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = 0xFF; - FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); + FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); return OK; } uint32_t Thread_Load_Jog_ThreadStop(uint32_t index, uint32_t ReadValue) @@ -490,6 +499,24 @@ uint32_t Thread_Load_End(void) { REPORT_MSG(LoadStages,"Loading Ended"); + if(ControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz); + RemoveControlCallback(ControlId, ThreadLoadControlCBFunction ); + ControlId = 0xFF; + } + if(PullerControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); + RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction ); + PullerControlId = 0xFF; + } + if(WinderControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz); + RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction ); + WinderControlId = 0xFF; + } return OK; } uint32_t Thread_Load_Dryer_UnLoading(void) @@ -523,6 +550,7 @@ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize); PullerControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),POOLER_DANCER,POOLER_MOTOR); + Report("AddControlCallback Puller",__FILE__,__LINE__,PullerControlId,RpMessage,IfTypeThread*0x100+POOLER_MOTOR,0); //////////////////////// MotorControlConfig[WINDER_MOTOR].m_params.MAX = 1; MotorControlConfig[WINDER_MOTOR].m_params.MIN = MotorsControl[WINDER_MOTOR].outputproportionalpowerlimit*-1; @@ -544,6 +572,7 @@ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_WINDER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].directionthreadwize); WinderControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),WINDER_DANCER,WINDER_MOTOR); + Report("AddControlCallback Winder",__FILE__,__LINE__,WinderControlId,RpMessage,IfTypeThread*0x100+WINDER_MOTOR,0); //////////////////////// MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].directionthreadwize); @@ -553,13 +582,15 @@ //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + LoadArmInfo.LoadArmBackLash = 10; + status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = 0xFF; - FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); + FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); return OK; } @@ -613,10 +644,6 @@ //LoadStages++; Thread_Load_Close_Lids(); break; - case THREAD_LOAD_RESUME_HEATING: - //LoadStages++; - Thread_Load_Resume_Heating(); - break; case THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT://JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION //LoadStages++; Thread_Load_Jog_Feeder_To_Middle_Point(); @@ -626,6 +653,10 @@ //LoadStages++; Thread_Load_Dryer_Loading(); break; + case THREAD_LOAD_RESUME_HEATING: + //LoadStages++; + Thread_Load_Resume_Heating(); + break; case THREAD_LOAD_JOG_THREAD: //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING //LoadStages++; Thread_Load_Jog_Thread(); @@ -640,7 +671,18 @@ } return OK; } - +uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue) +{ + Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0); + if (LoadStages > ReadValue) + { + ThreadLoadStateMachine(LoadStages+1); + } + else + { + ThreadLoadStateMachine(ReadValue); + } +} uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { //read value is the dancer angle diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 167616afe..1544af59e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -58,17 +58,17 @@ typedef enum THREAD_LOAD_LIFT_DANCERS, THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE THREAD_LOAD_INITIAL_TENSION,//CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND - THREAD_LOAD_CLOSE_ROCKERS, THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD THREAD_LOAD_CLOSE_LIDS, - THREAD_LOAD_RESUME_HEATING, - THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + THREAD_LOAD_CLOSE_ROCKERS, + THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + THREAD_LOAD_RESUME_HEATING, THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM; -uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM ReadValue); +uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue); bool ThreadLoadingActive(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 500ba9a39..38c0f86f1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -174,7 +174,7 @@ uint32_t StoreDancerConfigMessage() { response_size = hardware_configuration__pack(&DancerConfig, response_buffer); } - Fresult = FileWrite(response_buffer,response_size,DancerConfigPath); + Fresult = FileWrite(response_buffer,response_size,DancerConfigPath,BIOS_WAIT_FOREVER); EraseFlashSection(DANCERS_MAP_IN_FLASH,1024); for (Dancer_i = 0; Dancer_i < MAX_SYSTEM_DANCERS; Dancer_i++) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index bdf8bd15d..3b972cc23 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -81,7 +81,10 @@ uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) else { if (MachineState == MACHINE_STATE_HW_CONFIG) + { + Report("HWConfigurationInit failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceCallBackFunction,0); MachineState = MACHINE_STATE_NO_CFG_FILE; + } } return OK; } @@ -284,6 +287,8 @@ uint32_t InitSequenceStartHeating(void) } else MachineState = MACHINE_STATE_MACHINE_READY_TO_DYE; + //activate second pump for 10 minutes + PumpActivation(600); return OK; } uint32_t InitSequenceMachineReadyToDye(void) -- cgit v1.3.1 From 18c4c73f8b654dca09e1333d1f6a35e4cbdc9b17 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 1 Aug 2019 13:08:22 +0300 Subject: Version 1.4.3.0 Embedded SW Release note - Version 1.4.3.0 ============================================================= System: File system protection + improvements Keep critical data on MCU EEPROM Procedures: Thread load fix and coordinate the amount of thread in drier to the distance to spool length. Dispensers flow control stage 2a - maintain pressure during presegment Modules: Enclosure temperature alarms Secondary waste pump Dispensers state info Heaters protection improved Diagnostics data - full data, full speed for now Thread - fix length calculation Process: Cleaning ready for integration --- .../Embedded/Common/SWUpdate/FileSystem.c | 2 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded_SW/Embedded/Common/report/filter.c | 2 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 2 +- .../Embedded_SW/Embedded/Modules/General/process.c | 8 + .../Embedded_SW/Embedded/Modules/General/process.h | 3 + .../Embedded/Modules/Heaters/Heaters_print.c | 51 +++- Software/Embedded_SW/Embedded/Modules/IDS/IDS.h | 1 - .../Embedded/Modules/IDS/IDS_dispenser.c | 10 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 257 +++++++++++++++------ .../Embedded/Modules/Thread/ThreadLoad.c | 1 + .../Embedded/Modules/Thread/Thread_Winder.c | 10 +- .../Embedded/Modules/Thread/Thread_print.c | 58 ++--- .../Embedded/Software Release Notes.txt | 11 +- .../Embedded/StateMachines/Printing/JobSTM.c | 4 +- .../Embedded/StateMachines/Printing/PrintingSTM.c | 8 +- 16 files changed, 302 insertions(+), 128 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 5cbc92285..48e29e54c 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -600,7 +600,9 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Data[i].name = fno[i]->fname; Data[i].has_length = true; Data[i].length = fno[i]->fsize; + Data[i].has_lastmodifieddate = true; Data[i].lastmodifieddate = fno[i]->fdate; + Data[i].has_lastmodifiedtime = true; Data[i].lastmodifiedtime = fno[i]->ftime; if (i==0) usnprintf(&FullPath[i], 50, "%s", request->path); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 78c7c7d74..9efaf59c8 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,2,9}; +TangoVersion_t _gTangoVersion = {1,4,3,0}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Common/report/filter.c b/Software/Embedded_SW/Embedded/Common/report/filter.c index b922e53bc..febc1ea8c 100644 --- a/Software/Embedded_SW/Embedded/Common/report/filter.c +++ b/Software/Embedded_SW/Embedded/Common/report/filter.c @@ -145,7 +145,7 @@ int ReportFilterPackage(const char *filterName, uint8_t SwitchAddRemove) return -1; /* nothing to remove */ } strcpy(packageFilterTable[filterNumOfCurrentEntries].filterName,filterName); - packageFilterTable[filterNumOfCurrentEntries].filterDontUse = true; + packageFilterTable[filterNumOfCurrentEntries].filterDontUse = false; filterNumOfCurrentEntries++; return (filterNumOfCurrentEntries-1); } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 98e760b32..2ca57e08e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -62,7 +62,7 @@ uint32_t Diagnostics_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue); uint32_t Diagnostics_TenMiliControlTrigger(uint32_t IfIndex, uint32_t ReadValue); uint32_t DispensersCollection(uint32_t IfIndex, uint32_t ReadValue); -#define REDUCED_DIAGNOSTICS +//#define REDUCED_DIAGNOSTICS DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT; #define DIAGNOSTICS_LIMIT 3 diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 2c8788bdc..39e87ed6a 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -37,6 +37,9 @@ double headairflow = 0; double dryerairflow = 0; int32_t tableindex = 0; +double dryerbufferMeters = 0; +double dryerbufferCentimeters = 0; + #define MAX_ALLOWED_TEMPERATURE 280 char ProcessParamsConfigPath[50] = "0://SysInfo//ProcessP.cfg"; @@ -170,6 +173,11 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) HeatersStopControlOnHeatersOff(ProcessParams); dyeingspeed = ProcessParams->dyeingspeed; dryerbufferlength = ProcessParams->dryerbufferlength; + dryerbufferMeters = dryerbufferlength*0.76+0.6; + dryerbufferCentimeters = dryerbufferlength*76+60; + + Report("drier buffer length",__FILE__,(int)dryerbufferlength,(int)dryerbufferMeters*100,RpWarning,(int)dryerbufferCentimeters,0); + mininkuptake = ProcessParams->mininkuptake; feedertension = ProcessParams->feedertension; pullertension = ProcessParams->pullertension; diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.h b/Software/Embedded_SW/Embedded/Modules/General/process.h index c67bd49b3..2b02c28c7 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.h +++ b/Software/Embedded_SW/Embedded/Modules/General/process.h @@ -19,6 +19,9 @@ extern double headairflow; extern double dryerairflow; extern int32_t tableindex; +extern double dryerbufferMeters; +extern double dryerbufferCentimeters; + extern ProcessParameters ProcessParametersKeep; extern void ProcessRequestFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index d60d5b840..8e185750f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -87,7 +87,7 @@ uint32_t DisasterControlId = 0xFF; #define DRYER_AIR_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP1 #define DRYER_MAIN_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP2 #define DRYER_SECONDARY_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP3 -#define MINIMUM_HEATER_READ 8.5 +#define MINIMUM_HEATER_READ 9.0 #define MAXIMUM_HEATER_READ 283 //old uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {DRYER_AIR_PT100,DRYER_MAIN_PT100,DRYER_SECONDARY_PT100,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,TEMP_SENSE_AN_ENCLOSURETEMP3}; @@ -538,6 +538,28 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) //ReportWithPackageFilter(HeatersFilter,"PrepareHeater AC Read", __FILE__,HeaterId, SetTemperatue, RpWarning,HeaterPreviousRead[HeaterId], 0); HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]);//MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]); HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]);// = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]); + if((HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]<=MINIMUM_HEATER_READ*100)||(MAXIMUM_HEATER_READ*100<=HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain])|| + (HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]<=MINIMUM_HEATER_READ*100)||(MAXIMUM_HEATER_READ*100<=HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary])) + { + ReportWithPackageFilter(HeatersFilter,"PT100 not working properly",__FILE__,__LINE__,HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,RpError, 0,0); + ReportWithPackageFilter(HeatersFilter,"PT100 not working properly",__FILE__,__LINE__,HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,RpError, 0,0); + if (ControlIdtoMaxHeaterId [HeaterId] != 0xFF) + { + RemoveControlCallback(ControlIdtoMaxHeaterId [HeaterId], DcHeaterMaxTempCBFunction); + ControlIdtoMaxHeaterId [HeaterId] = 0xFF; + } + if (ControlIdtoHeaterId [HeaterId] != 0xFF) + { + RemoveControlCallback(ControlIdtoHeaterId [HeaterId], DCHeaterControlCBFunction); + ControlIdtoHeaterId [HeaterId] = 0xFF; + } + DeActivateHeater(HeaterId); + HeaterCmd[HeaterId].targettemperatue = 0; + AlarmHandlingSetAlarm(HeaterEventType[HeaterId], true); + + return ERROR; + } + } //turn all alarms off AlarmHandlingSetAlarm(HeaterUnderEventType[HeaterId], false); @@ -571,6 +593,7 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) if (SetTemperatue) { Control_Dryer_Fan(START,75);//use START or STOP, 0 - 100% + ReportWithPackageFilter(HeatersFilter,"Control_Dryer_Fan",__FILE__,__LINE__,START,RpError, 75,0); } } /* @@ -583,6 +606,26 @@ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue) if (DisasterControlId == 0xFF) DisasterControlId = AddControlCallback( HeatersDisasterControl, eOneSecond,TemplateDataReadCBFunction,0,0, 0); + HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]);//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); + if((HeaterPreviousRead[HeaterId]<=MINIMUM_HEATER_READ*100)||(MAXIMUM_HEATER_READ*100<=HeaterPreviousRead[HeaterId])) + { + ReportWithPackageFilter(HeatersFilter,"PT100 not working properly",__FILE__,__LINE__,HeaterId,RpError, 0,0); + if (ControlIdtoMaxHeaterId [HeaterId] != 0xFF) + { + RemoveControlCallback(ControlIdtoMaxHeaterId [HeaterId], DcHeaterMaxTempCBFunction); + ControlIdtoMaxHeaterId [HeaterId] = 0xFF; + } + if (ControlIdtoHeaterId [HeaterId] != 0xFF) + { + RemoveControlCallback(ControlIdtoHeaterId [HeaterId], DCHeaterControlCBFunction); + ControlIdtoHeaterId [HeaterId] = 0xFF; + } + DeActivateHeater(HeaterId); + AlarmHandlingSetAlarm(HeaterEventType[HeaterId], true); + HeaterCmd[HeaterId].targettemperatue = 0; + + return ERROR; + } if (ControlIdtoHeaterId [HeaterId] == 0xFF) ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond*/,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); //HeaterPIDConfig[HeaterId].m_params.dt *=10; @@ -598,12 +641,6 @@ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue) Enable_Reading_Heaters_Current(HeaterId2CurrentId[HeaterId]); - HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]);//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); - if((abs(HeaterPreviousRead[HeaterId]-MINIMUM_HEATER_READ)<1)||(abs(MAXIMUM_HEATER_READ-HeaterPreviousRead[HeaterId])<10)) - { - ReportWithPackageFilter(HeatersFilter,"PT100 not working properly",__FILE__,__LINE__,HeaterId,RpError, 0,0); - return ERROR; - } //ReportWithPackageFilter(HeatersFilter,"PrepareHeater Read", __FILE__,HeaterId, SetTemperatue, RpWarning,HeaterPreviousRead[HeaterId], 0); if (ControlIdtoMaxHeaterId [HeaterId] == 0xFF) ControlIdtoMaxHeaterId [HeaterId] = AddControlCallback( DcHeaterMaxTempCBFunction, eOneSecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index d0621125f..33033ad69 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -36,7 +36,6 @@ uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue); int direction; }IDS_Dispenser_Data;*/ -void IDS_Dispenser_Set_Flow_Params (char DispenserId,double NanoLitterPerPulse,char MicroSteps); void IDS_Dispenser_RefillStarted (char DispenserId,char MicroSteps); void IDS_Dispenser_RefillEnded (char DispenserId,char MicroSteps); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 186fef2f9..de7d12024 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -320,6 +320,8 @@ void IDS_Dispenser_Content_Calculation (char DispenserId) //double consumedintimeframe = (double)(CurrentDispenserSpeed[DispenserId]); //pulses only //consumedintimeframe = 10+DispenserId; IDS_Dispenser_Data[DispenserId].consumedinnanolitter += (CurrentDispenserSpeed[DispenserId]/10);//100 milliseconds ==> speed/10 + if (IDS_Dispenser_Data[DispenserId].consumedinnanolitter<0) + IDS_Dispenser_Data[DispenserId].consumedinnanolitter = 0; if (CurrentDispenserSpeed[DispenserId]>0.1) { DispenserDataUpdated = true; @@ -350,14 +352,6 @@ void DispensersCollectionCall(void) IDS_Dispenser_Content_Calculation(i); } } -void IDS_Dispenser_Set_Flow_Params (char DispenserId,double nanolitterperpulse,char microsteps) -{ - /*assert (DispenserId1000)?tempSpeed*1.1:1000; + updatedSpeed = (tempSpeed*1.1<1000)?tempSpeed*1.1:1000; MotorSetSpeed(HW_Motor_Id, updatedSpeed); CurrentDispenserSpeed[i] = updatedSpeed; //Report("IDS accelerate speed",__FILE__,i,(int)tempSpeed,RpWarning,(int)updatedSpeed,0); @@ -634,6 +633,8 @@ c. Go to step 2.a x Segment.BrushStopsCount. } return OK; } + //******************************************************************************************************************** + //******************************************************************************************************************** uint32_t IDSPrepareState(void *JobDetails) { @@ -673,10 +674,6 @@ c. Go to step 2.a x Segment.BrushStopsCount. //ValveCommand (Enable,MixerDirection); } - PrepeareSpeed = JobTicket->processparameters->dyeingspeed*JobTicket->processparameters->maxinkuptake*1.30; - //REPORT_MSG((int)JobTicket->processparameters->dyeingspeed, "dyeing speed"); - //REPORT_MSG((int)JobTicket->processparameters->maxinkuptake, "max ink uptake"); - if (HeaterCheckReady() == true) { REPORT_MSG(1,"heaters ready, starting"); @@ -706,13 +703,10 @@ c. Go to step 2.a x Segment.BrushStopsCount. } if (NumOfActiveDispensers) { - PrepeareSpeed/=NumOfActiveDispensers; REPORT_MSG((int)NumOfActiveDispensers, "Num Of Active Dispensers"); for (i = 0; i < MAX_DYE_DISPENSERS; i++) { - //dispenserspeed = PrepeareSpeed/MotorsCfg[DispenserIdToMotorId[i]].microstep; dispenserspeed = DispenserPrepareSpeed; - //IDS_StopHomeDispenser(i); if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { Report("Prepare Speed",__FILE__,__LINE__,i,RpWarning,(int)dispenserspeed,0); @@ -724,6 +718,138 @@ c. Go to step 2.a x Segment.BrushStopsCount. DispenserPrepareControlId = AddControlCallback( IDS_Prepare_Callback, PRESSURE_READ_TIME_GAP,TemplateDataReadCBFunction ,0, 0, 0 ); setRapidPressureRead(true); + } + //******************************************************************************************************************** + //************************** IDS PRESEGMENT BUILDUP ****************************************************************** + //******************************************************************************************************************** + + JobDescriptionFileBrushStop * FileBrushStop; + char IdsMessage[100]; + + //******************************************************************************************************************** + uint32_t IDS_PreSegmentPrepare_Callback(uint32_t DispenserId, uint32_t ReadValue) + { + bool pressureReady = false; + int i; + int NumofReadyDispensers = 0; + TimerMotors_t HW_Motor_Id; + float updatedSpeed,tempSpeed; + //REPORT_MSG((int)DispenserPrepareControlId, "Prepare Callback"); + + DispenserBuildTimeCounter+=PRESSURE_READ_TIME_GAP; + + if (DispenserBuildTimeCounter<(1*eOneSecond)) + { + REPORT_MSG(DispenserBuildTimeCounter,"waiting 1 seconds for pressure changes"); + return OK; + } + if (PreSegmentWCFStarted == true) + { + REPORT_MSG(PreSegmentWCFStarted,"PreSegmentWCFStarted is true, stopping prepare stage"); + //SafeRemoveControlCallback(DispenserPrepareControlId, IDS_Prepare_Callback ); + setRapidPressureRead(false); + return OK; + } + for (i = 0; i < MAX_DYE_DISPENSERS; i++) + { + //IDS_StopHomeDispenser(i); + if (DispenserUsedInSegment[i] == true) //we actually should check for all dispensers + { + HW_Motor_Id = DispenserIdToMotorId[i]; + if (GetDispenserPressure(i) > DispenserPreparePressure) + { + NumofReadyDispensers++; + tempSpeed = CurrentDispenserSpeed[i]; + updatedSpeed = (tempSpeed*0.95>100)?tempSpeed*0.95:100; + MotorSetSpeed(HW_Motor_Id, updatedSpeed); + CurrentDispenserSpeed[i] = updatedSpeed; + //Report("IDS PreSegment reduce speed",__FILE__,i,(int)tempSpeed,RpWarning,(int)updatedSpeed,0); + } + else + { + tempSpeed = CurrentDispenserSpeed[i]; + updatedSpeed = (tempSpeed*1.1<1000)?tempSpeed*1.1:1000; + MotorSetSpeed(HW_Motor_Id, updatedSpeed); + CurrentDispenserSpeed[i] = updatedSpeed; + //Report("IDS PreSegment accelerate speed",__FILE__,i,(int)tempSpeed,RpWarning,(int)updatedSpeed,0); + } + } + } + + if ((NumofReadyDispensers)&&(DispenserBuildTimeCounter%1000 == 0)) + Report("IDS_PreSegmentPrepare_Callback",__FILE__,DispenserBuildTimeCounter,NumofReadyDispensers,RpWarning,(int)NumOfActiveDispensers,0); + + if (NumofReadyDispensers>=NumOfActiveDispensers) + pressureReady = true; + + if ((DispenserBuildTimeCounter >= DispenserPrepareTimeout)||(pressureReady == true)) + { + SafeRemoveControlCallback(DispenserPrepareControlId, IDS_Prepare_Callback ); + setRapidPressureRead(false); + } + return OK; + } + //******************************************************************************************************************** + void IDSPresegmentPrepareStart(void) + { + int i; + int Dispenser_i,n_dispensers,DispenserId; + TimerMotors_t HW_Motor_Id; + double segmentfirst_speed; + JobDispenser **Dispensers; + + for (Dispenser_i = 0; Dispenser_i < MAX_DYE_DISPENSERS; Dispenser_i++) + { + DispenserUsedInSegment[Dispenser_i] = false; + } + if (FileBrushStop) + { + Report("start dispensers pre segment pressure build",__FILE__,__LINE__,FileBrushStop->index,RpWarning,(int)FileBrushStop->n_dispensers,0); + NumOfActiveDispensers = FileBrushStop->n_dispensers; + Dispensers = FileBrushStop->dispensers; + n_dispensers = FileBrushStop->n_dispensers; + if (n_dispensers) + { + for (Dispenser_i = 0; Dispenser_i < n_dispensers; Dispenser_i++) + { + DispenserId = Dispensers[Dispenser_i]->index; + HW_Motor_Id = DispenserIdToMotorId[DispenserId]; + if (MotorsCfg[HW_Motor_Id].hardwaremotortype + != DispenserIdToMotorId[DispenserId]) + continue; + if ((DispenserId == CLEANER_DISPENSER)||(DispenserId == LUBRICANT_DISPENSER)) + { + continue; + } + //(Speed*uStep*PPR)/((2*PI*Dispenser_Radius) + segmentfirst_speed = Dispensers[Dispenser_i]->nanolitterpersecond + / Dispensers[Dispenser_i]->nanoliterperpulse; + if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) + { + DispenserUsedInSegment[Dispenser_i] = true; + MotorSetSpeed(HW_Motor_Id, DispenserPrepareSpeed); + CurrentDispenserSpeed[Dispenser_i] = DispenserPrepareSpeed; + usnprintf(IdsMessage, 80,"WFCF Prepare Dispenser %d speed %d",DispenserId,(int) segmentfirst_speed); + //REPORT_MSG(segmentfirst_speed,IdsMessage); + Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); + //SendJobProgress(0.0, 0, false, IdsMessage); + } + else + { + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[Dispenser_i] = 0; + usnprintf(IdsMessage, 80,"WFCF Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); + Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); + + } + } + DispenserBuildTimeCounter = 0; + //DispenserPrepareControlId = AddControlCallback( IDS_PreSegmentPrepare_Callback, PRESSURE_READ_TIME_GAP,TemplateDataReadCBFunction ,0, 0, 0 ); + setRapidPressureRead(true); + + } + } + } //******************************************************************************************************************** uint32_t IDS_Valve_PresegmentValveReady(uint32_t deviceID, uint32_t ReadValue) @@ -757,8 +883,6 @@ c. Go to step 2.a x Segment.BrushStopsCount. //******************************************************************************************************************** - JobDescriptionFileBrushStop * FileBrushStop; - char IdsMessage[100]; uint32_t IDSPreSegmentStateCallbackRunner(uint32_t IfIndex, uint32_t ReadValue) { @@ -803,6 +927,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); //IDS_Valve_PresegmentReady(1,0); Report("End of Pre-segment Handling",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); SafeRemoveControlCallback(DispenserPreSegmentControlId,IDSPreSegmentStateCallbackRunner); + setRapidPressureRead(false); } if (EnableCleaning == true) { @@ -816,16 +941,22 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); Report("Start cleaning rockers",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); //IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed); }*/ - if (( InterSegmentCenterRockers)&&(InterSegmentCenterRockers == InterSegmentStepsCount)) + if (( InterSegmentCenterRockers)&&(InterSegmentCenterRockers == (lInterSegmentLength-InterSegmentStepsCount))) { Report("Stop spray and center rockers",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); IDS_Cleaning_Stop_Cleaning_Solution (NULL); //IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callback); } } + if (PreSegmentWCFStarted == false) + { + IDS_PreSegmentPrepare_Callback(0,0); + } if ((InterSegmentStartWFCFDispensers > 0)&&(InterSegmentStartWFCFDispensers == InterSegmentStepsCount)) { Report("start dispensers at rate * WFCF",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); + PreSegmentWCFStarted = true; // stop any presegment prepare stages, if still exist + setRapidPressureRead(false); if (FileBrushStop) { REPORT_MSG(FileBrushStop->index,"WFCFBrushStopRead Index"); @@ -853,16 +984,10 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); //MotorSetMicroStep(HW_Motor_Id, Dispensers[Dispenser_i]->dispenserstepdivision); segmentfirst_speed /= Dispensers[Dispenser_i]->dispenserstepdivision; //the dye supply is calculated based on a 1/8 microstep - IDS_Dispenser_Set_Flow_Params( - DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, - Dispensers[Dispenser_i]->dispenserstepdivision); } else { segmentfirst_speed/=8;//MotorsCfg[HW_Motor_Id].microstep; //the dye supply is calculated based on a 1/8 microstep - IDS_Dispenser_Set_Flow_Params( - DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, - MotorsCfg[HW_Motor_Id].microstep); } if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) { @@ -970,7 +1095,7 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) InterSegmentCenterRockers = 3000; }*/ - InterSegmentStartWFCFDispensers = (lInterSegmentLength>5000)?lInterSegmentLength-5000:lInterSegmentLength; + //InterSegmentStartWFCFDispensers = (lInterSegmentLength>5000)?lInterSegmentLength-5000:lInterSegmentLength; } } /*if (SegmentId == 0)//first segment - running the DTS out of the drier @@ -986,7 +1111,7 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) CurrentDispenserSpeed[Dispenser_i] = 0; } } - lInterSegmentLength = ((dryerbufferlength*100)*1000/dyeingspeed); + lInterSegmentLength = (dryerbufferCentimeters*1000/dyeingspeed); lInterSegmentLength-=(lInterSegmentLength%100); //round to a 100 multiplication InterSegmentStepsCount = 0; DispenserPreSegmentControlId = AddControlCallback( IDSPreSegmentStateCallbackRunner, 100,TemplateDataReadCBFunction ,0, 0, 0 ); @@ -995,7 +1120,7 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) Report("Add control callback failed",__FILE__,__LINE__,(int)100,RpWarning,(int)0,0); return ERROR; } - Report("Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)dryerbufferlength,0); + Report("Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)lInterSegmentLength,0); if (EnableCleaning == true) { InterSegmentStartSprayCleaner = 500; @@ -1058,7 +1183,6 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) } //REPORT_MSG(DispenserId,"IDS_Valve_Presegment start"); - IDS_Dispenser_Set_Flow_Params(DispenserId,0,0); if (Dispensers[Dispenser_i]->dispenserstepdivision != DISPENSER_STEP_DIVISION__Auto) { MotorSetMicroStep(HW_Motor_Id, Dispensers[Dispenser_i]->dispenserstepdivision); @@ -1080,6 +1204,10 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) } } //Task_sleep(5); + PreSegmentWCFStarted = false; + REPORT_MSG(PreSegmentWCFStarted,"START IDSPresegmentPrepareStart"); + + IDSPresegmentPrepareStart(); return OK; } //******************************************************************************************************************** @@ -1115,17 +1243,10 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) //MotorSetMicroStep(HW_Motor_Id, Dispensers[Dispenser_i]->dispenserstepdivision); segmentfirst_speed /= Dispensers[Dispenser_i]->dispenserstepdivision; //the dye supply is calculated based on a 1/8 microstep - IDS_Dispenser_Set_Flow_Params( - DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, - Dispensers[Dispenser_i]->dispenserstepdivision); } else { segmentfirst_speed/=8;//MotorsCfg[HW_Motor_Id].microstep; //the dye supply is calculated based on a 1/8 microstep - - IDS_Dispenser_Set_Flow_Params( - DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, - MotorsCfg[HW_Motor_Id].microstep); } if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) { @@ -1293,7 +1414,6 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) if (DispenserUsedInJob[Dispenser_i]==false)//unconfigured dispenser continue; DispenserDistanceToSpoolReady[Dispenser_i] = false; - IDS_Dispenser_Set_Flow_Params(Dispenser_i,0,0); //MotorStop(HW_Motor_Id,Hard_Hiz); //Control3WayValvesWithCallback ((Valves_t)Dispenser_i, MidTank_Dispenser, IDS_Valve_DistanceToSpoolValveReady); //direction: MidTank_Dispenser or Dispenser_Mixer IDS_Dispenser_Close_Valve_And_Stop_Motor(Dispenser_i,IDS_Valve_DistanceToSpoolValveReady); @@ -1301,7 +1421,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) //cleaning - lInterSegmentLength = ((dryerbufferlength*100)*1000/dyeingspeed); + lInterSegmentLength = (dryerbufferCentimeters*1000/dyeingspeed); lInterSegmentLength-=(lInterSegmentLength%100); //round to a 100 multiplication InterSegmentStepsCount = 0; DispenserPreSegmentControlId = AddControlCallback( IDSPreSegmentStateCallbackRunner, 100,TemplateDataReadCBFunction ,0, 0, 0 ); @@ -1354,7 +1474,6 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) //MotorStop(DispenserIdToMotorId[Dispenser_i],Hard_Hiz); //Control3WayValvesWithCallback (Dispenser_i, MidTank_Dispenser, IDS_Valve_EndValveReady); //direction: MidTank_Dispenser or Dispenser_Mixer IDS_Dispenser_Close_Valve_And_Stop_Motor(Dispenser_i,IDS_Valve_EndValveReady); - IDS_Dispenser_Set_Flow_Params(Dispenser_i,0,0); } else { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 04ff325d4..5984618d9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -139,6 +139,7 @@ ProcessParametersClear.headzone5temp = 0; ProcessParametersClear.headzone6temp = 0; ProcessParametersClear.dyeingspeed = 40; + ProcessParametersClear.dryerbufferlength = ProcessParametersKeep.dryerbufferlength; if (HandleProcessParameters(&ProcessParametersClear)!= OK) { LOG_ERROR (LoadStages, "Thread_Load_Init failed"); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 510168ab8..7e1312464 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -321,7 +321,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { ScrewNumberOfSteps--; WindingConeLocation--; - ReportWithPackageFilter(ThreadFilter,"Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); + // ReportWithPackageFilter(ThreadFilter,"Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } else //next time going back @@ -329,7 +329,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0) { ScrewNumberOfSteps++; - Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); + // Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } /* if (WinderMotorSpeedRollOver) @@ -364,11 +364,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewRunningTime = temp;//(SYS_CLK_FREQ*Steps)/ScrewSpeed; //ROM_IntMasterEnable(); //usnprintf(TempScrewStr, 100, "Winder: Horizon,Rotation, PPR, RPP{ %d, %d ,%d, %d} ",(int)screw_horizontal_speed,(int)RotationsPerSecond,(int)InternalWinderCfg.NumberOfRotationPerPassage,(int)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround); - usnprintf(ScrewStr, 100, "Winder: Steps,Speed, Time, WinderSpeed{ %d, %d ,%d, %d} ",(int)ScrewNumberOfSteps,(int)ScrewSpeed,(int)temp,(int)WinderReferenceSpeed); +// usnprintf(ScrewStr, 100, "Winder: Steps,Speed, Time, WinderSpeed{ %d, %d ,%d, %d} ",(int)ScrewNumberOfSteps,(int)ScrewSpeed,(int)temp,(int)WinderReferenceSpeed); // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); // #warning PID is now only proportional (above) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); - Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); +// Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); //Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } @@ -535,7 +535,7 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) } uint32_t WinderDistanceToSpoolState(void ) { - double DTS_Time = ((dryerbufferlength*100)/dyeingspeed)*1000;//distance to spool time in milliseconds + double DTS_Time = (dryerbufferCentimeters/dyeingspeed)*1000;//distance to spool time in milliseconds REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-WinderBackToBaseTime,TemplateDataReadCBFunction,0,0,0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 528b83c1c..a88ce61a5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -259,32 +259,38 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) return 0xFFFFFFFF; } PoolerCurrentPosition = MotorGetPosition(ThreadMotorIdToMotorId[index]); -// if (CurrentPosition == 0) -// return OK; //unusable data - if (Poolerinitialpos == 0xFFFF) - { + //if (PoolerCurrentPosition != 0) + //{ + if (Poolerinitialpos == 0xFFFF) + { + PoolerPreviousPosition = PoolerCurrentPosition; + Poolerinitialpos = 0; + } + prevprev = PoolerPreviousPosition; + positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); + //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; PoolerPreviousPosition = PoolerCurrentPosition; - Poolerinitialpos = 0; - } - prevprev = PreviousPosition; - positionDiff = Control_Delta_Position_Pass(PoolerCurrentPosition,PoolerPreviousPosition); - //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; - PoolerPreviousPosition = PoolerCurrentPosition; - length = (double)(positionDiff)*PoolerLengthCalculationMultiplier; - //if (InitialProcess == false) - { - PoolerTotalProcessedLength+= (length/100); - TempPoolerTotalProcessedLength = PoolerTotalProcessedLength; - } - if (length > 1000) - { - usnprintf(Lenstr, 100, "pooler length huge: length %d, diff 0x%x, pos 0x%x prev 0x%x",(int)length*100,(int)positionDiff,PreviousPosition,prevprev); - SendJobProgress(0.0,0,false, Lenstr); - Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); - length = 0; + // total length = (position diff / full cycle) * pulley perimeter + //(positionDiff/pulseperround)*((2*PI*motor_Radius) - } + //positionDiff = positionDiff / MotorsCfg[ThreadMotorIdToMotorId[index]].microstep; + length = (double)(positionDiff)*PoolerLengthCalculationMultiplier; + + if (length > 1000) + { + usnprintf(Lenstr, 100, "length huge: length %d, diff 0x%x, pos 0x%x prev 0x%x",(int)length*100,(int)positionDiff,PreviousPosition,prevprev); + SendJobProgress(0.0,0,false, Lenstr); + Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); + length = 0; + + } + + //} + + length = (double)(positionDiff)*PoolerLengthCalculationMultiplier; + PoolerTotalProcessedLength+= (length/100); + TempPoolerTotalProcessedLength = PoolerTotalProcessedLength; #ifndef FEEDER_LENGTH_CALCULATION CurrentProcessedLength+=length; @@ -914,8 +920,8 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId) } /*else if (InitialProcess==true) { - ThreadUpdateProcessLength (dryerbufferlength,(void *)ThreadPreSegmentEnded); - REPORT_MSG (dryerbufferlength," ThreadPreSegmentState DTS length (sample)"); + ThreadUpdateProcessLength (dryerbufferMeters,(void *)ThreadPreSegmentEnded); + REPORT_MSG (dryerbufferCentimeters," ThreadPreSegmentState DTS length (sample)"); SegmentState = false; PreSegmentState = true; DTSState = false; @@ -977,7 +983,7 @@ uint32_t ThreadSegmentState(void *SegmentDetails, int SegmentId) //******************************************************************************************************************** uint32_t ThreadDistanceToSpoolState(void ) { - seglength = dryerbufferlength; + seglength = dryerbufferMeters; REPORT_MSG (seglength,"ThreadDistanceToSpoolState"); //#ifdef FEEDER_LENGTH_CALCULATION ThreadUpdateProcessLength (seglength,(void *)ThreadDistanceToSpoolEnded); diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index 912979467..92534e42b 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,16 +1,21 @@ -Embedded SW Release note - Version 1.4.2.9 +Embedded SW Release note - Version 1.4.3.0 ============================================================= System: - File system protection + File system protection + improvements Keep critical data on MCU EEPROM Procedures: Thread load + fix and coordinate the amount of thread in drier to the distance to spool length. + Dispensers flow control stage 2a - maintain pressure during presegment Modules: Enclosure temperature alarms Secondary waste pump Dispensers state info + Heaters protection improved + Diagnostics data - full data, full speed for now + Thread - fix length calculation Process: - Cleaning + Cleaning ready for integration Embedded SW Release note - Version 1.4.2.2 ============================================================= diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 4288d786b..b01add901 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -635,8 +635,8 @@ void JobRequestFunc(MessageContainer* requestContainer) JobEndReason = JOB_OK; TotalProcessedLength = 0.0; PoolerTotalProcessedLength = 0.0; - job_length = CurrentJob->length + CurrentJob->processparameters->dryerbufferlength; - Report("job length ",__FILE__,job_length,CurrentJob->length,RpWarning,CurrentJob->processparameters->dryerbufferlength, 0); + job_length = CurrentJob->length + dryerbufferMeters; + Report("job length ",__FILE__,job_length,(int)CurrentJob->length,RpWarning,(int)dryerbufferCentimeters, 0); JobAlarmReason = AlarmHandlingPrepareJob(CurrentJob); if (JobAlarmReason ==OK) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 019e2346d..599056a5e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -713,7 +713,7 @@ void PrintSTMMsgHandler(void * msg) if (RewindJobFile() != FR_OK) { JobEndReason = JOB_OTHER_ALARM; - if (dryerbufferlength == 0) + if (dryerbufferlength <= 0.1) EndState(CurrentJob, "Job Ended"); else DistanceToSpoolState(CurrentJob); @@ -729,7 +729,7 @@ void PrintSTMMsgHandler(void * msg) Report("SegmentResultsOk segmentId",__FILE__,__LINE__, SegmentId,RpMessage,n_segments,0); if (SegmentId >= n_segments) { - if (dryerbufferlength == 0) + if (dryerbufferlength <= 0.1) EndState(CurrentJob, "Job Ended"); else DistanceToSpoolState(CurrentJob); @@ -749,7 +749,7 @@ void PrintSTMMsgHandler(void * msg) else { JobEndReason = JOB_OTHER_ALARM; - if (dryerbufferlength == 0) + if (dryerbufferlength <= 0.1) EndState(CurrentJob, "Job Ended"); else DistanceToSpoolState(CurrentJob); @@ -761,7 +761,7 @@ void PrintSTMMsgHandler(void * msg) if (Segment == NULL) { JobEndReason = JOB_OTHER_ALARM; - if (dryerbufferlength == 0) + if (dryerbufferlength <= 0.1) EndState(CurrentJob, "Job Ended"); else DistanceToSpoolState(CurrentJob); -- cgit v1.3.1