diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-12-17 14:39:26 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-12-17 14:39:26 +0200 |
| commit | f0f46e7e560cf5e9999e5ba9904634f01176f27e (patch) | |
| tree | 961affaea885d7306faca197a72c20f4811d7b8c /Software/Embedded_SW/Embedded | |
| parent | a84ca31290b18ef2a9ec4c197d86573bb13adb03 (diff) | |
| parent | d9ee0b8e11f15c2b3bae068767516bc84a5ca4ed (diff) | |
| download | Tango-f0f46e7e560cf5e9999e5ba9904634f01176f27e.tar.gz Tango-f0f46e7e560cf5e9999e5ba9904634f01176f27e.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded')
44 files changed, 639 insertions, 376 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index f3d42b01a..17c1f164b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -566,20 +566,12 @@ uint32_t DeleteRequestFunc(MessageContainer* requestContainer) //int NumOfFiles = 0; FRESULT Fresult = FR_OK; - if (1)//(Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) - { - Fresult = f_unlink(request->path); - Semaphore_post(FFS_Sem); - } - else - { - Fresult = FR_DENIED; - Report("Semaphore_pend failed", __FILE__, __LINE__, 4, RpWarning, (int)0, 0); - } + 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); - if (Fresult!= OK) + if ((Fresult!= FR_OK)&&(Fresult!= FR_NO_FILE)) { //usnprintf(ErrorMsg, 100, "File Operation failed error code %d",Fresult); responseContainer.has_error = true; @@ -794,8 +786,11 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout) { LOG_ERROR (Fresult,"fwrite error"); } - //LOG_ERROR (Bytes,"f_write ok no of bytes"); - Report("f_write ok no of bytes", __FILE__, __LINE__, Bytes, RpWarning, (int)size, 0); + else + { + //LOG_ERROR (Bytes,"f_write ok no of bytes"); + Report("f_write ok no of bytes", __FILE__, __LINE__, Bytes, RpWarning, (int)size, 0); + } f_close(FileHandle); } else @@ -875,12 +870,14 @@ FRESULT FileRead(char *path, uint32_t *Size, void **Buffer) } else { - LOG_ERROR (Fresult,"malloc error"); + Report("malloc error", __FILE__, __LINE__, Fresult, RpWarning, (int)fno->fsize, 0); + Fresult = FR_DENIED; } } else { - LOG_ERROR (Fresult,"f_stat error"); + Report("f_stat error", __FILE__, __LINE__, Fresult, RpWarning, (int)0, 0); + Fresult = FR_DENIED; } my_free(fno); return Fresult; diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index 078055920..a404ca8ee 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -31,6 +31,7 @@ #include "Modules/Control/Control.h" #include "Modules/AlarmHandling/AlarmHandling.h" #include "modules/General/process.h" +#include "Modules/heaters/heaters_ex.h" int NumberOfFiles = 0,CurrentRunningFile; 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 3b88982c2..5392a415e 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,5,3,2}; +TangoVersion_t _gTangoVersion = {1,5,3,4}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index a11f9db73..2850f666e 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -85,6 +85,7 @@ bool isReportActive(void) } uint32_t OpenLogFile(void) { +#ifdef STORE_DEBUG_LOGS int len; uint32_t Bytes = 0; LogFileHandle = my_malloc(sizeof(FIL)); @@ -106,10 +107,13 @@ uint32_t OpenLogFile(void) LogFresult = FR_INT_ERR; return LogFresult; +#endif + return OK; } uint32_t CloseLogFile(void) { /* perform default error output */ +#ifdef STORE_DEBUG_LOGS int len; uint32_t Bytes = 0; len = usnprintf(RepMessage, 80, "Closing Log File %s %s",__DATE__, __TIME__); @@ -117,6 +121,9 @@ uint32_t CloseLogFile(void) LogFresult = f_close(LogFileHandle); LogFileHandle = NULL; return LogFresult; +#endif + return OK; + } uint32_t LogToFile(char *message, /* The formatted message */ char *FileName, @@ -127,6 +134,7 @@ uint32_t LogToFile(char *message, /* The formatted message { /* print user supplied error code */ +#ifdef STORE_DEBUG_LOGS uint32_t Bytes = 0; int len; if (LogFileHandle == NULL) @@ -134,8 +142,13 @@ uint32_t LogToFile(char *message, /* The formatted message len = usnprintf(RepMessage, 300, "\r\nfile %s\t line %d\t code %d\t sev %d,\tparam %d,\t %s",FileName, LineNumber,errorCode, Severity, parameter,message); LogFresult = f_write(LogFileHandle,RepMessage,len,&Bytes ); + if (LogFileHandle->fsize > 100000) + f_lseek(LogFileHandle, 0); return LogFresult; +#endif + return OK; + } int ReportResponseFunc(char *message, /* The formatted message */ char *FileName, diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index 2103c5d2f..cce9747bc 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -149,7 +149,7 @@ void receive_callback(char* buffer, size_t length) ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); } #endif - if ((requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)||(requestContainer->type != MESSAGE_TYPE__KeepAliveResponse)) + if ((requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveResponse)) resetIdleCounter(); //ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); if (keepalivetest == false) diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.c index 7aa6f71d4..3a656e258 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.c @@ -7,7 +7,7 @@ #endif #include "EventType.pb-c.h" -static const ProtobufCEnumValue event_type__enum_values_by_number[379] = +static const ProtobufCEnumValue event_type__enum_values_by_number[380] = { { "", "", 0 }, { "", "", 1000 }, @@ -222,6 +222,7 @@ static const ProtobufCEnumValue event_type__enum_values_by_number[379] = { "", "", 5096 }, { "", "", 5097 }, { "", "", 5098 }, + { "", "", 5099 }, { "", "", 6000 }, { "", "", 6001 }, { "", "", 6002 }, @@ -390,22 +391,20 @@ static const ProtobufCEnumValue event_type__enum_values_by_number[379] = { "", "", 10016 }, }; static const ProtobufCIntRange event_type__value_ranges[] = { -{0, 0},{1000, 1},{2000, 15},{3000, 40},{4000, 92},{5000, 114},{6000, 213},{7000, 219},{8000, 307},{9000, 339},{10000, 362},{0, 379} +{0, 0},{1000, 1},{2000, 15},{3000, 40},{4000, 92},{5000, 114},{6000, 214},{7000, 220},{8000, 308},{9000, 340},{10000, 363},{0, 380} }; -static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = +static const ProtobufCEnumValueIndex event_type__enum_values_by_name[380] = { + { "", 341 }, { "", 340 }, - { "", 339 }, - { "", 365 }, + { "", 366 }, { "", 4 }, { "", 5 }, { "", 6 }, { "", 7 }, { "", 22 }, { "", 21 }, - { "", 345 }, - { "", 356 }, - { "", 350 }, + { "", 346 }, { "", 357 }, { "", 351 }, { "", 358 }, @@ -413,18 +412,9 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 359 }, { "", 353 }, { "", 360 }, + { "", 354 }, { "", 361 }, - { "", 235 }, - { "", 299 }, - { "", 291 }, - { "", 251 }, - { "", 259 }, - { "", 267 }, - { "", 275 }, - { "", 219 }, - { "", 243 }, - { "", 227 }, - { "", 283 }, + { "", 362 }, { "", 236 }, { "", 300 }, { "", 292 }, @@ -502,6 +492,17 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 250 }, { "", 234 }, { "", 290 }, + { "", 243 }, + { "", 307 }, + { "", 299 }, + { "", 259 }, + { "", 267 }, + { "", 275 }, + { "", 283 }, + { "", 227 }, + { "", 251 }, + { "", 235 }, + { "", 291 }, { "", 96 }, { "", 107 }, { "", 108 }, @@ -552,6 +553,7 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 151 }, { "", 152 }, { "", 144 }, + { "", 213 }, { "", 145 }, { "", 146 }, { "", 147 }, @@ -640,15 +642,15 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 18 }, { "", 19 }, { "", 20 }, - { "", 372 }, - { "", 374 }, - { "", 362 }, - { "", 368 }, - { "", 376 }, - { "", 370 }, + { "", 373 }, + { "", 375 }, { "", 363 }, - { "", 378 }, - { "", 346 }, + { "", 369 }, + { "", 377 }, + { "", 371 }, + { "", 364 }, + { "", 379 }, + { "", 347 }, { "", 12 }, { "", 14 }, { "", 13 }, @@ -672,10 +674,6 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 30 }, { "", 28 }, { "", 90 }, - { "", 315 }, - { "", 331 }, - { "", 307 }, - { "", 323 }, { "", 316 }, { "", 332 }, { "", 308 }, @@ -704,20 +702,24 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 338 }, { "", 314 }, { "", 330 }, + { "", 323 }, + { "", 339 }, + { "", 315 }, + { "", 331 }, + { "", 219 }, { "", 218 }, - { "", 217 }, - { "", 213 }, - { "", 216 }, { "", 214 }, + { "", 217 }, { "", 215 }, - { "", 342 }, - { "", 364 }, + { "", 216 }, + { "", 343 }, + { "", 365 }, { "", 0 }, { "", 15 }, - { "", 354 }, - { "", 348 }, { "", 355 }, { "", 349 }, + { "", 356 }, + { "", 350 }, { "", 77 }, { "", 80 }, { "", 83 }, @@ -753,17 +755,17 @@ static const ProtobufCEnumValueIndex event_type__enum_values_by_name[379] = { "", 89 }, { "", 35 }, { "", 31 }, - { "", 347 }, - { "", 344 }, - { "", 373 }, - { "", 375 }, - { "", 366 }, - { "", 369 }, - { "", 377 }, - { "", 371 }, + { "", 348 }, + { "", 345 }, + { "", 374 }, + { "", 376 }, { "", 367 }, - { "", 341 }, - { "", 343 }, + { "", 370 }, + { "", 378 }, + { "", 372 }, + { "", 368 }, + { "", 342 }, + { "", 344 }, { "", 42 }, { "", 76 }, { "", 79 }, @@ -781,9 +783,9 @@ const ProtobufCEnumDescriptor event_type__descriptor = "", "", "", - 379, + 380, event_type__enum_values_by_number, - 379, + 380, event_type__enum_values_by_name, 11, event_type__value_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.h index 9b2147774..a1b5bebed 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/EventType.pb-c.h @@ -233,6 +233,7 @@ typedef enum _EventType { EVENT_TYPE__DYEING_HEAD_BLOWER_2_FLOW_TOO_LOW = 5096, EVENT_TYPE__DYEING_HEAD_ARC_LID_IS_OPEN = 5097, EVENT_TYPE__DYEING_HEAD_TUNNEL_LID_IS_OPEN = 5098, + EVENT_TYPE__DYEING_HEAD_COVER_IS_OPEN = 5099, EVENT_TYPE__MIXER_OVERTEMPERATURE = 6000, EVENT_TYPE__MIXER_UNDERTEMPERATURE_A = 6001, EVENT_TYPE__MIXER_UNDERTEMPERATURE_B = 6002, 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 555e4fe12..3f50da709 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,9 +7,10 @@ #endif #include "InterfaceIOs.pb-c.h" -static const ProtobufCEnumValue interface_ios__enum_values_by_number[48] = +static const ProtobufCEnumValue interface_ios__enum_values_by_number[49] = { { "", "", 0 }, + { "", "", 17 }, { "", "", 19 }, { "", "", 20 }, { "", "", 21 }, @@ -59,42 +60,41 @@ static const ProtobufCEnumValue interface_ios__enum_values_by_number[48] = { "", "", 346 }, }; static const ProtobufCIntRange interface_ios__value_ranges[] = { -{0, 0},{19, 1},{43, 6},{54, 9},{64, 11},{163, 12},{214, 30},{224, 33},{270, 34},{296, 39},{318, 40},{341, 42},{0, 48} +{0, 0},{17, 1},{19, 2},{43, 7},{54, 10},{64, 12},{163, 13},{214, 31},{224, 34},{270, 35},{296, 40},{318, 41},{341, 43},{0, 49} }; -static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[48] = +static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[49] = { { "", 0 }, - { "", 31 }, { "", 32 }, - { "", 30 }, - { "", 42 }, + { "", 33 }, + { "", 31 }, { "", 43 }, { "", 44 }, - { "", 34 }, { "", 45 }, - { "", 12 }, - { "", 6 }, + { "", 35 }, + { "", 46 }, + { "", 13 }, { "", 7 }, { "", 8 }, - { "", 2 }, + { "", 9 }, { "", 3 }, { "", 4 }, { "", 5 }, - { "", 11 }, - { "", 35 }, + { "", 6 }, + { "", 12 }, { "", 36 }, { "", 37 }, { "", 38 }, - { "", 1 }, - { "", 40 }, + { "", 39 }, + { "", 2 }, { "", 41 }, - { "", 9 }, + { "", 42 }, { "", 10 }, - { "", 39 }, - { "", 13 }, - { "", 46 }, + { "", 11 }, + { "", 40 }, { "", 14 }, - { "", 22 }, + { "", 47 }, + { "", 1 }, { "", 15 }, { "", 23 }, { "", 16 }, @@ -109,8 +109,10 @@ static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[48] = { "", 28 }, { "", 21 }, { "", 29 }, - { "", 33 }, - { "", 47 }, + { "", 22 }, + { "", 30 }, + { "", 34 }, + { "", 48 }, }; const ProtobufCEnumDescriptor interface_ios__descriptor = { @@ -119,11 +121,11 @@ const ProtobufCEnumDescriptor interface_ios__descriptor = "", "", "", - 48, + 49, interface_ios__enum_values_by_number, - 48, + 49, interface_ios__enum_values_by_name, - 12, + 13, 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 8f2631c75..494df4af4 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 @@ -21,6 +21,7 @@ PROTOBUF_C__BEGIN_DECLS typedef enum _InterfaceIOs { INTERFACE_IOS__ANALOG_MIXCHIP_TEMP = 0, + INTERFACE_IOS__LS_DH_LID_OPEN = 17, INTERFACE_IOS__GPO_MIXCHIP_SSR4_CTRL = 19, INTERFACE_IOS__GPO_DYEINGH_SSR5_CTRL = 20, INTERFACE_IOS__GPO_DYEINGH_SSR6_CTRL = 21, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.c index b2366bf0a..ea6ee6d7a 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.c @@ -7,20 +7,24 @@ #endif #include "HardwareDancerType.pb-c.h" -static const ProtobufCEnumValue hardware_dancer_type__enum_values_by_number[3] = +static const ProtobufCEnumValue hardware_dancer_type__enum_values_by_number[5] = { { "", "", 0 }, { "", "", 1 }, { "", "", 2 }, + { "", "", 3 }, + { "", "", 4 }, }; static const ProtobufCIntRange hardware_dancer_type__value_ranges[] = { -{0, 0},{0, 3} +{0, 0},{0, 5} }; -static const ProtobufCEnumValueIndex hardware_dancer_type__enum_values_by_name[3] = +static const ProtobufCEnumValueIndex hardware_dancer_type__enum_values_by_name[5] = { + { "", 4 }, { "", 0 }, { "", 1 }, { "", 2 }, + { "", 3 }, }; const ProtobufCEnumDescriptor hardware_dancer_type__descriptor = { @@ -29,9 +33,9 @@ const ProtobufCEnumDescriptor hardware_dancer_type__descriptor = "", "", "", - 3, + 5, hardware_dancer_type__enum_values_by_number, - 3, + 5, hardware_dancer_type__enum_values_by_name, 1, hardware_dancer_type__value_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.h index fed2b0108..ef217df4d 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareDancerType.pb-c.h @@ -22,7 +22,9 @@ PROTOBUF_C__BEGIN_DECLS typedef enum _HardwareDancerType { HARDWARE_DANCER_TYPE__LeftDancer = 0, HARDWARE_DANCER_TYPE__MiddleDancer = 1, - HARDWARE_DANCER_TYPE__RightDancer = 2 + HARDWARE_DANCER_TYPE__RightDancer = 2, + HARDWARE_DANCER_TYPE__ThirdDancer = 3, + HARDWARE_DANCER_TYPE__FourthDancer = 4 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(HARDWARE_DANCER_TYPE) } HardwareDancerType; diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 5b163c415..1bed505f2 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -24,11 +24,17 @@ //#define DISPESER_TEST //#define FPGA_WATCHDOG_DISABLE +#ifndef WATCHDOG +#define STORE_DEBUG_LOGS +#endif +//#define STORE_DEBUG_LOGS //#define FOUR_WINDERS #ifdef FOUR_WINDERS #define BTSR_NO_FEEDER_TFU #define BTSR_NO_PULLER_TFU +#define BTSR_ROTATED_WINDER_TFU #endif +//#define BTSR_ROTATED_WINDER_TFU #define USE_UART4_FOR_BTSR // need change in FRPGA FPGA_1 yy > 0x20 + jumpers in main board need to read HW Version @@ -89,6 +95,15 @@ typedef enum Status_Enum // don't change used for RFID S_NOTINUSE = -1 }STATUS_ENUM; +typedef enum +{ + //logitag ID + READER_1 = 0, + READER_2 = 1, + READER_3 = 2, + Max_Readers = 3, +}RFID_READER_ID; + #define OK 0 #define ERROR 1 diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c index 66f209421..632dfb0d5 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c @@ -98,7 +98,9 @@ #include "ff.h" /* FatFs configurations and declarations */ //#include "diskio.h" /* Declarations of low level disk I/O functions */ +#include <DataDef.h> #include "third_party/fatfs/src/diskio.h" +#include "Common/report/report.h" /*-------------------------------------------------------------------------- @@ -894,7 +896,10 @@ FRESULT put_fat ( if (clst < 2 || clst >= fs->n_fatent) { /* Check range */ - res = FR_INT_ERR; + { + res = FR_INT_ERR; + Report("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0); + } } else { switch (fs->fs_type) { @@ -929,6 +934,8 @@ FRESULT put_fat ( default : res = FR_INT_ERR; + Report("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->fs_type,0); + } fs->wflag = 1; } @@ -958,13 +965,16 @@ FRESULT remove_chain ( if (clst < 2 || clst >= fs->n_fatent) { /* Check range */ res = FR_INT_ERR; - + Report("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0); } else { res = FR_OK; while (clst < fs->n_fatent) { /* Not a last link? */ nxt = get_fat(fs, clst); /* Get cluster status */ if (nxt == 0) break; /* Empty cluster? */ - if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */ + if (nxt == 1) { + res = FR_INT_ERR; + Report("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)res,RpWarning,(int)fs->n_fatent,0); + break; } /* Internal error? */ if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */ res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */ if (res != FR_OK) break; @@ -1097,14 +1107,20 @@ FRESULT dir_sdi ( dj->index = idx; clst = dj->sclust; if (clst == 1 || clst >= dj->fs->n_fatent) /* Check start cluster range */ + { + Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0); return FR_INT_ERR; + } if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */ clst = dj->fs->dirbase; if (clst == 0) { /* Static table (root-dir in FAT12/16) */ dj->clust = clst; if (idx >= dj->fs->n_rootdir) /* Index is out of range */ - return FR_INT_ERR; + { + Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)idx,RpWarning,(int)dj->fs->n_rootdir,0); + return FR_INT_ERR; + } dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / SZ_DIR); /* Sector# */ } else { /* Dynamic table (sub-dirs or root-dir in FAT32) */ @@ -1113,7 +1129,10 @@ FRESULT dir_sdi ( clst = get_fat(dj->fs, clst); /* Get next cluster */ if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */ if (clst < 2 || clst >= dj->fs->n_fatent) /* Reached to end of table or int error */ + { + Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0); return FR_INT_ERR; + } idx -= ic; } dj->clust = clst; @@ -2558,7 +2577,10 @@ FRESULT f_write ( res = validate(fp); /* Check validity */ if (res != FR_OK) LEAVE_FF(fp->fs, res); if (fp->flag & FA__ERROR) /* Aborted file? */ + { + Report("f_write FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)btw,0); LEAVE_FF(fp->fs, FR_INT_ERR); + } if (!(fp->flag & FA_WRITE)) /* Check access mode */ LEAVE_FF(fp->fs, FR_DENIED); if ((DWORD)(fp->fsize + btw) < fp->fsize) btw = 0; /* File size cannot reach 4GB */ @@ -2596,7 +2618,11 @@ FRESULT f_write ( } #endif sect = clust2sect(fp->fs, fp->clust); /* Get current sector */ - if (!sect) ABORT(fp->fs, FR_INT_ERR); + if (!sect) + { + Report("f_write FR_INT_ERR",__FILE__,__LINE__,(int)sect,RpWarning,(int)btw,0); + ABORT(fp->fs, FR_INT_ERR); + } sect += csect; cc = btw / SS(fp->fs); /* When remaining bytes >= sector size, */ if (cc) { /* Write maximum contiguous sectors directly */ @@ -2886,7 +2912,10 @@ FRESULT f_lseek ( res = validate(fp); /* Check validity of the object */ if (res != FR_OK) LEAVE_FF(fp->fs, res); if (fp->flag & FA__ERROR) /* Check abort flag */ + { + Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)FA__ERROR,0); LEAVE_FF(fp->fs, FR_INT_ERR); + } #if _USE_FASTSEEK if (fp->cltbl) { /* Fast seek */ @@ -2969,7 +2998,11 @@ FRESULT f_lseek ( #if !_FS_READONLY if (clst == 0) { /* If no cluster chain, create a new chain */ clst = create_chain(fp->fs, 0); - if (clst == 1) ABORT(fp->fs, FR_INT_ERR); + if (clst == 1) + { + Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)FA__ERROR,0); + ABORT(fp->fs, FR_INT_ERR); + } if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR); fp->sclust = clst; } @@ -2988,7 +3021,11 @@ FRESULT f_lseek ( #endif clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */ if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR); - if (clst <= 1 || clst >= fp->fs->n_fatent) ABORT(fp->fs, FR_INT_ERR); + if (clst <= 1 || clst >= fp->fs->n_fatent) + { + Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fp->fs->n_fatent,0); + ABORT(fp->fs, FR_INT_ERR); + } fp->clust = clst; fp->fptr += bcs; ofs -= bcs; @@ -2996,7 +3033,11 @@ FRESULT f_lseek ( fp->fptr += ofs; if (ofs % SS(fp->fs)) { nsect = clust2sect(fp->fs, clst); /* Current sector */ - if (!nsect) ABORT(fp->fs, FR_INT_ERR); + if (!nsect) + { + Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)nsect,RpWarning,(int)0,0); + ABORT(fp->fs, FR_INT_ERR); + } nsect += ofs / SS(fp->fs); } } @@ -3184,7 +3225,10 @@ FRESULT f_getfree ( do { stat = get_fat(fs, clst); if (stat == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } - if (stat == 1) { res = FR_INT_ERR; break; } + if (stat == 1) + { + Report("f_getfree FR_INT_ERR",__FILE__,__LINE__,(int)stat,RpWarning,(int)0,0); + res = FR_INT_ERR; break; } if (stat == 0) n++; } while (++clst < fs->n_fatent); } else { @@ -3233,6 +3277,7 @@ FRESULT f_truncate ( res = validate(fp); /* Check validity of the object */ if (res == FR_OK) { if (fp->flag & FA__ERROR) { /* Check abort flag */ + Report("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)0,0); res = FR_INT_ERR; } else { if (!(fp->flag & FA_WRITE)) /* Check access mode */ @@ -3250,7 +3295,11 @@ FRESULT f_truncate ( ncl = get_fat(fp->fs, fp->clust); res = FR_OK; if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR; - if (ncl == 1) res = FR_INT_ERR; + if (ncl == 1) + { + Report("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)ncl,RpWarning,(int)0,0); + res = FR_INT_ERR; + } if (res == FR_OK && ncl < fp->fs->n_fatent) { res = put_fat(fp->fs, fp->clust, 0x0FFFFFFF); if (res == FR_OK) res = remove_chain(fp->fs, ncl); @@ -3301,6 +3350,7 @@ FRESULT f_unlink ( dclst = ld_clust(dj.fs, dir); if (res == FR_OK && (dir[DIR_Attr] & AM_DIR)) { /* Is it a sub-dir? */ if (dclst < 2) { + Report("f_unlink FR_INT_ERR",__FILE__,__LINE__,(int)dclst,RpWarning,(int)0,0); res = FR_INT_ERR; } else { mem_cpy(&sdj, &dj, sizeof (DIR)); /* Check if the sub-dir is empty or not */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c index 5bac56231..236cd87d7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c @@ -280,12 +280,13 @@ double Calc_Calibration_MidTank_Liquid(uint32_t VsampleInBits, MidTank_t MidTan ( Slope_B[MidTank_ID] > Max_Slope_B) || ( Slope_B[MidTank_ID] < Min_Slope_B) ) { temp = VSensor - Deafault_Initial_Offset_A; - +#ifndef LIGHT_COLORS if(MidTank_ID == MIDTANK_8) { LiquidLitter = temp * Deafault_Slope_B_Disp8; } else +#endif { LiquidLitter = temp * Deafault_Slope_B; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_MainBaord.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_MainBaord.h index fe9ee34bf..7f7e4ae1b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_MainBaord.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_MainBaord.h @@ -16,15 +16,6 @@ uint32_t Block_Main_All_I2C_RFID_Channels(); uint32_t Select_Main_I2C_RFID_Channel(PANEL_BUTTON_OR_CRAT_ID Cart_ID); */ -typedef enum -{ - //logitag ID - READER_1 = 0, - READER_2 = 1, - READER_3 = 2, - Max_Readers = 3, -}RFID_READER_ID; - #ifndef EVALUATION_BOARD bool SetReader(uint32_t readerID); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c index a3ae5bba1..a600c3b9f 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c @@ -497,10 +497,10 @@ double CalculateWHSWasteTankLevelMiliLiter() get_vlev1(&Vm_mv);//mV (VREF = 4.096V 12bit so 1bit is 1mV) - //Report("***** get waste level in mV ********", __FILE__, __LINE__, 0, RpMessage, (int)(Vm_mv), 0); - Vm_ml = Vm_mv * 1500/mvfor1500mL; + Report("***** get waste level in mV ********", __FILE__, __LINE__, (int)(Vm_ml), RpMessage, (int)(Vm_mv), 0); + if(Vm_ml < LocalV0_ml) { //LocalV0_ml = Vm_ml; @@ -566,7 +566,7 @@ bool waste_seq_cont() WasteCounter = 0; waste_level_ml = avg/8; - Report("------------ Avg waste level in ml -----------------", __FILE__, WasteAverageIndex, avg, RpMessage, (int)(waste_level_ml), 0); + Report("------------ Avg waste level in ml -----------------", __FILE__, WasteAverageIndex, (int)avg, RpMessage, (int)(waste_level_ml), 0); } if (FirstInSequence == false) { diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 4722bfe2f..e90f0622e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -44,9 +44,6 @@ uint32_t DrierZeroPosition = 0; //bool DrierBackLashDirection = false; uint32_t Arm_Drier_Center = 0; callback_fptr UnloadingReset = NULL; -/*int CallbackCalls=0; -int FirstCall = 0; -#define MAX_CONTROL_SAMPLES 10*/ int32_t ArmSamples[MAX_CONTROL_SAMPLES] = {0}; int ArmSamplePointer = {0}; int StoredavreageSampleValue = 0; @@ -214,6 +211,7 @@ uint32_t MotorGotoWithBusyCallback (TimerMotors_t MotorId,bool direction, uint32 //MotorStop(MotorId,Hard_Hiz ); int sign = direction?1:-1; MotorGoTo(MotorId,Steps*sign ); + CallbackCalls = 0; MotorControlId[MotorId] = AddControlCallback(NULL, MotorMoveCallBackFunction, /*eTenMillisecond*/20, MotorControlGetnBusyState,(IfTypeMotors*0x100+MotorId), MotorId, 0 ); MotorControlCallback[MotorId] = MotorMoveCallBackFunction; return MotorControlId[MotorId]; @@ -232,6 +230,7 @@ uint32_t MotorRunWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Fr MotorTimeout[MotorId] = 0; MotorTimeLag[MotorId] = 20; MotorTimeLimit[MotorId] = timeout; + CallbackCalls = 0; if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM) { InitialArmLocation = Read_Dryer_ENC_Position(0,0); @@ -250,10 +249,10 @@ uint32_t MotorRunWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Fr MotorControlCallback[MotorId] = MotorMoveCallBackFunction; return MotorControlId[MotorId]; } -uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO +uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //TODO { uint32_t MotorId,encoder,temp = 0; - uint32_t Busy = BUSY; + uint32_t RunningContinues = true; int angle; if (IfIndex>>8 != IfTypeMotors) @@ -289,7 +288,7 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO } } } - else //loading - going up + /*else //loading - going up { //previous number is smaller than current if (InitialArmLocation<encoder) @@ -310,32 +309,32 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO InitialArmLocation=encoder; } } - } + }*/ if (((temp>1000)||(temp<20))&&(CallbackCalls>10)) { - Report("MotorRunCallBackFunctionMotorRunCallBackFunction temp curr prev small",__FILE__,encoder,InitialArmLocation,RpWarning,temp,0); + Report("MotorRunCallBackFunction temp curr prev small",__FILE__,encoder,InitialArmLocation,RpWarning,temp,0); failCounter++; - if (failCounter>=20) + if (failCounter>=8) { Report("arm stopped",__FILE__,failCounter,encoder,RpWarning,temp,0); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Hiz); - BusyFlag = NOTBUSY; + RunningContinues = false; } } else { failCounter = 0; - BusyFlag = BUSY; + RunningContinues = true; } if (CallbackCalls%50 == 0) { //encoder = Read_Dryer_ENC_Position(0,0); - Report("MotorRunCallBackFunctionMotorRunCallBackFunction periodic curr prev total",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0); + Report("MotorRunCallBackFunction periodic curr prev total",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0); } if (CallbackCalls%200 == 0) { //encoder = Read_Dryer_ENC_Position(0,0); - Report("MotorRunCallBackFunctionMotorRunCallBackFunction",__FILE__,__LINE__,encoder,RpWarning,CallbackCalls,0); + Report("MotorRunCallBackFunction",__FILE__,__LINE__,encoder,RpWarning,CallbackCalls,0); } } else @@ -348,24 +347,25 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO } MotorTimeout[MotorId]+=MotorTimeLag[MotorId]; - if ((BusyFlag == NOTBUSY)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0))) + if ((RunningContinues == false)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0))) { if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM) { - angle = Calculate_Arm_Distance(Arm_Drier_Center,temp); + angle = Calculate_Arm_Distance(Arm_Drier_Center,encoder); if (abs(angle)<400) { - BusyFlag = NOTBUSY; + RunningContinues = false; } else { - BusyFlag = BUSY; + RunningContinues = true; } Report("arm stopped call",__FILE__,failCounter,encoder,RpWarning,abs(DrierZeroPosition-encoder),0); + Report("arm stopped call 2",__FILE__,MotorTimeout[MotorId],RunningContinues,RpWarning,angle,0); } //stop this control loop - Report("MotorControlGetnBusyState stop",__FILE__,MotorId,BusyFlag,RpMessage,MotorCallback[MotorId],0); + Report("MotorControlGetnBusyState stop",__FILE__,MotorId,RunningContinues,RpMessage,MotorCallback[MotorId],0); SafeRemoveControlCallback(MotorControlId[MotorId], MotorRunCallBackFunction ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; @@ -374,13 +374,13 @@ uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO if ((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)) { Report("motor timeout",__FILE__,__LINE__,MotorId,RpMessage,MotorTimeout[MotorId],0); - Busy = BUSY; + RunningContinues = true; } Report("MotorRunCallBackFunction curr prev return",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0); //call the module callback if (MotorCallback[MotorId]) { - MotorCallback[MotorId](MotorId,Busy); + MotorCallback[MotorId](MotorId,RunningContinues); } } @@ -398,7 +398,7 @@ uint32_t MotorMoveWithCallback (TimerMotors_t MotorId,bool direction, uint32_t S Report("MotorControlGetnBusyState print",__FILE__,__LINE__,MotorDriverResponse[MotorId].Busy,RpMessage,0,0); }*/ ReportWithPackageFilter(GeneralFilter,"MotorMoveWithCallback",__FILE__,direction,MotorId,RpMessage,Steps,0); - + CallbackCalls = 0; //call driver action to device id with the parameter //SetMotorSpeed (deviceId, parameter); MotorCallback[MotorId] = callback; @@ -542,6 +542,7 @@ uint32_t MotorMoveToStopper (TimerMotors_t MotorId,bool direction, uint32_t Spee Task_sleep(10); Initialcurrentposition = Read_Dryer_ENC_Position(); cycles = 0; + CallbackCalls = 0; StoredMotorPosition[MotorId] = Read_Dryer_ENC_Position(); Report("MotorMoveToStopper initial position",__FILE__,__LINE__,StoredMotorPosition[MotorId],RpWarning,Initialcurrentposition,0); MotorSetSpeed (MotorId, Speed); @@ -619,8 +620,8 @@ uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callb currentposition = Control_Read_Dryer_Position(0,0); MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierZeroPosition); Report("MotorMovetoEncoderPosition",__FILE__,__LINE__,DrierZeroPosition,RpWarning,currentposition,0); - Report("MotorMovetoEncoderPosition callback",__FILE__,__LINE__,callback,RpWarning,speed,0); - if (abs(currentposition - DrierZeroPosition)<5) + Report("MotorMovetoEncoderPosition callback",__FILE__,__LINE__,direction,RpWarning,speed,0); + if (abs(currentposition - DrierZeroPosition)<2) { if (callback) callback(MotorId,0); @@ -664,9 +665,11 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO } MotorId = IfIndex&0xFF; CallbackCalls++; - if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM) { + Read_Dryer_ENC_Position(); + if (CallbackCalls<50) + return OK; if (CallbackCalls%200 == 0) { Report("MotorMoveCallBackFunction",__FILE__,__LINE__,MotorId,RpWarning,Read_Dryer_ENC_Position(0,0),0); @@ -894,8 +897,11 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t ReportWithPackageFilter(GeneralFilter,"cannot open dyeing head lid when safety active",__FILE__,direction,MotorId,RpMessage,Safety_Incident_Report(),0); return ERROR; } - DeActivateHeadMagnet(); //open the lid magnet - ReportWithPackageFilter(GeneralFilter,"calling DeActivateHeadMagnet",__FILE__,timeout,direction,RpMessage,Freq,0); + if (Head_Type != HEAD_TYPE_ARC) + { + DeActivateHeadMagnet(); //open the lid magnet + ReportWithPackageFilter(GeneralFilter,"calling DeActivateHeadMagnet",__FILE__,timeout,direction,RpMessage,Freq,0); + } if (direction == MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_LID].directionthreadwize) { if (Head_Type != HEAD_TYPE_ARC) { @@ -1157,7 +1163,7 @@ uint32_t LoadingArmReset_Callback(uint32_t MotorId, uint32_t ReadValue) uint32_t temp = Read_Dryer_ENC_Position(); angle = Calculate_Arm_Distance(Arm_Drier_Center,temp); ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset_Callback",__FILE__,angle,temp,RpMessage,Arm_Drier_Center,0); - //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0); + //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading_Callback details",__FILE__,__LINE__,ReadValue,RpMessage,0,0); //if ((AccumulatedArmMovement>8000 )&&(ReadValue == NOTBUSY)) // OK - take another round if (ReadValue == NOTBUSY) // OK - take another round { @@ -1167,11 +1173,11 @@ uint32_t LoadingArmReset_Callback(uint32_t MotorId, uint32_t ReadValue) //if (fabs(angle)<0.2) { ReportWithPackageFilter(DiagnosticsFilter,"drier center proximity",__FILE__,temp,Arm_Drier_Center,RpMessage,angle,0); - if (angle<400) + if (angle>0) direction = 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize; else direction = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize; - MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,LoadingArmReset_Callback_Stopper_Callback,/*3000*/16000,direction,10); + MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,LoadingArmReset_Callback_Stopper_Callback,/*3000*/16000,direction,5); } else @@ -1189,6 +1195,7 @@ uint32_t LoadingArmReset_Callback(uint32_t MotorId, uint32_t ReadValue) else //timeout or no movement { ReportWithPackageFilter(DiagnosticsFilter,"Unloading drier - halted",__FILE__,__LINE__,Arm_Drier_Center,RpMessage,0,0); + MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop); //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm ReportWithPackageFilter(DiagnosticsFilter,"Dryer unloading timeout(1) or no movement",__FILE__,temp,Arm_Drier_Center,RpWarning,ReadValue,0); @@ -1217,7 +1224,8 @@ uint32_t LoadingArmReset (callback_fptr callback,uint32_t timeout) //TODO ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset",__FILE__,__LINE__,timeout,RpMessage, 0,0); MotorRunWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius, LoadingArmReset_Callback, 300000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius, + LoadingArmReset_Callback, 300000); return OK; diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h index 79239835f..503a3f925 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h @@ -35,7 +35,7 @@ MAX_HARDWARE_DANCER } Dancers_4_Winders; - #define NUM_OF_ROTENC (MAX_HARDWARE_DANCER) + #define NUM_OF_ROTENC (HARDWARE_DANCER_TYPE__FourthDancer+1) #else #define NUM_OF_ROTENC (HARDWARE_DANCER_TYPE__RightDancer+1) #endif diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 2ec2c66a7..c1eeff837 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -137,7 +137,7 @@ Void MyswitchFxn(Task_Handle prev, Task_Handle next) PrevTask = prev; NextTask = next; } -void updateresetreasonineeprom(void) +void updateresetreasonineeprom(int i) { #define Head_Address 40 #define Max_Address 100 @@ -147,6 +147,7 @@ void updateresetreasonineeprom(void) EEPROMRead(&Head,Head_Address*4, 4); if (Head>=Max_Address) Head=0; Head++; + RESC+=(i*0x1000); EEPROMProgram(&Head, Head_Address*4, 4); EEPROMProgram(&RESC, (Head_Address+Head)*4, 4); @@ -160,6 +161,7 @@ Void errHook(Error_Block *eb) //char File[50] = "";*/ char message[300]; int len; + updateresetreasonineeprom(InitFailures); //STATUS_GREEN_LED_OFF; ACTIVITY_GREEN_LED_OFF; @@ -268,7 +270,7 @@ int main(void) uint32_t Data,i; MCU_E2PromInit(); - updateresetreasonineeprom(); + updateresetreasonineeprom(0); #endif #ifdef EVALUATION_BOARD @@ -452,7 +454,7 @@ int main(void) IDLE_TASK_package_init(); Start_InitSequence(); - PowerIdleInit(); + //PowerIdleInit(); BIOS_start(); return (0); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 059b8fc4c..07ebfa747 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -154,14 +154,14 @@ typedef enum typedef struct { - uint16_t Frequency; //1/10/100/1000 + //uint16_t Frequency; //1/10/100/1000 AlarmSourceType AlarmSource; uint16_t DeviceId; uint8_t ModuleDeviceId; uint16_t AlarmValue; bool AlarmDirection; DebugLogCategory Severity; - uint16_t Predecessor; + //uint16_t Predecessor; uint8_t DebounceValue; EventType EventType; bool isPersistent; @@ -490,16 +490,12 @@ uint32_t AlarmHandlingLoadFile(void) F_count = 0; for (i = 0; i < AlarmParametersTable->n_alarmitem ;i++) { - FileAlarmItem[F_count].AlarmDirection = AlarmParametersTable->alarmitem[i]->alarmdirection; FileAlarmItem[F_count].AlarmDirection = AlarmParametersTable->alarmitem[i]->alarmdirection; - //FileAlarmItem[F_count].Frequency = AlarmParametersTable->alarmitem[i]->frequency; //1/10/100/1000 FileAlarmItem[F_count].AlarmSource = AlarmParametersTable->alarmitem[i]->alarmsource; FileAlarmItem[F_count].DeviceId = AlarmParametersTable->alarmitem[i]->deviceid; FileAlarmItem[F_count].ModuleDeviceId = AlarmParametersTable->alarmitem[i]->moduledeviceid; FileAlarmItem[F_count].AlarmValue = AlarmParametersTable->alarmitem[i]->alarmvalue; - FileAlarmItem[F_count].AlarmDirection = AlarmParametersTable->alarmitem[i]->alarmdirection; FileAlarmItem[F_count].Severity = AlarmParametersTable->alarmitem[i]->severity; - //FileAlarmItem[F_count].Predecessor = AlarmParametersTable->alarmitem[i]->predecessor; FileAlarmItem[F_count].DebounceValue = AlarmParametersTable->alarmitem[i]->debouncevalue; FileAlarmItem[F_count].EventType = AlarmParametersTable->alarmitem[i]->eventtype; FileAlarmItem[F_count].isPersistent = AlarmParametersTable->alarmitem[i]->ispersistent; @@ -642,10 +638,10 @@ JobEndReasonEnum getEndReason(uint32_t AlarmId) return JOB_TEMPERATURE_ALARM; } case ALARM_SOURCE_TYPE__LimitSwitchAlarm: - usnprintf(AlarmReasonStr, 100, "Dispenser %d empty",AlarmItem[AlarmId].DeviceId); + usnprintf(AlarmReasonStr, 100, "Dispenser %d empty",AlarmItem[AlarmId].DeviceId+1); return JOB_OUT_OF_DYE; case ALARM_SOURCE_TYPE__PressureAlarm: - usnprintf(AlarmReasonStr, 100, "Over pressure in dispenser %d",AlarmItem[AlarmId].DeviceId); + usnprintf(AlarmReasonStr, 100, "Over pressure in dispenser %d",AlarmItem[AlarmId].DeviceId+1); return JOB_PRESSURE_ALARM; case ALARM_SOURCE_TYPE__CurrentAlarm: usnprintf(AlarmReasonStr, 100, "over/under current (%d) in %d",AlarmId,AlarmItem[AlarmId].DeviceId); @@ -657,7 +653,7 @@ JobEndReasonEnum getEndReason(uint32_t AlarmId) usnprintf(AlarmReasonStr, 100, "Machine door %d removed during a run",AlarmItem[AlarmId].DeviceId); return JOB_TAMPER_ALARM; case ALARM_SOURCE_TYPE__HardLimitAlarm: - usnprintf(AlarmReasonStr, 100, "Dispenser %d hit the hard limit",AlarmItem[AlarmId].DeviceId); + usnprintf(AlarmReasonStr, 100, "Dispenser %d hit the hard limit",AlarmItem[AlarmId].DeviceId+1); return JOB_LS_ALARM; case ALARM_SOURCE_TYPE__DoNotPollAlarm: if (AlarmItem[AlarmId].Severity == DEBUG_LOG_CATEGORY__Critical) @@ -1010,30 +1006,33 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) } } } - if ((AlarmState[Alarm_i].Status == true)&&(FoundReason == JOB_OK)) + for (Alarm_i = 0;Alarm_i<NumOfSystemAlarms;Alarm_i++) { - if(AlarmItem[Alarm_i].Severity>=DEBUG_LOG_CATEGORY__Error) + if ((AlarmState[Alarm_i].Status == true)&&(FoundReason == JOB_OK)) { - ReportWithPackageFilter(AlarmFilter,"an alarm existing before job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); - switch (AlarmItem[Alarm_i].EventType ) + if(AlarmItem[Alarm_i].Severity>=DEBUG_LOG_CATEGORY__Error) { - case EVENT_TYPE__INSUFFICIENT_AIR_FLOW: - case EVENT_TYPE__VOC_SENSOR_ALARM_TIME: -#warning unmark to prevent job on voc alarm//case EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE: - //case EVENT_TYPE__POWER_UP_BIT_FAILURE: - FoundReason = JOB_WASTE_HANDLING_PROBLEM; - AlarmId = Alarm_i; - ReportWithPackageFilter(AlarmFilter,"an alarm preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); - break; - case EVENT_TYPE__ELECTRICAL_CABINET_OVERTEMPERATURE: - case EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE: - case EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE_2: - FoundReason = JOB_TEMPERATURE_ALARM; - AlarmId = Alarm_i; - ReportWithPackageFilter(AlarmFilter,"machine internal over-temperature is preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); - break; - default: - break; + ReportWithPackageFilter(AlarmFilter,"an alarm existing before job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); + switch (AlarmItem[Alarm_i].EventType ) + { + case EVENT_TYPE__INSUFFICIENT_AIR_FLOW: + case EVENT_TYPE__VOC_SENSOR_ALARM_TIME: + //case EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE: + //case EVENT_TYPE__POWER_UP_BIT_FAILURE: + FoundReason = JOB_WASTE_HANDLING_PROBLEM; + AlarmId = Alarm_i; + ReportWithPackageFilter(AlarmFilter,"an alarm preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); + break; + case EVENT_TYPE__ELECTRICAL_CABINET_OVERTEMPERATURE: + case EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE: + case EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE_2: + FoundReason = JOB_TEMPERATURE_ALARM; + AlarmId = Alarm_i; + ReportWithPackageFilter(AlarmFilter,"machine internal over-temperature is preventing job", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, AlarmItem[Alarm_i].Severity, AlarmItem[Alarm_i].DeviceId, 0); + break; + default: + break; + } } } } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index d366e8832..ad5a1d5ca 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -544,8 +544,12 @@ int MillisecCalculateTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId) calc = TemperatureSum[SensorId] / (TemperatureCount[SensorId]-2); if (TemperatureSum[SensorId]>10) { + if(abs(TemperatureMax[SensorId]-TemperatureMin[SensorId])>2000) + { + if ((Head_Type == HEAD_TYPE_FLAT_WITHOUT_CARD)||(SensorId!=TEMP_SENSE_AN_ENCLOSURETEMP3)) Report("Millisec Temp spike",__FILE__,SensorId,(int)TemperatureMax[SensorId],RpWarning,(int) TemperatureMin[SensorId],0); + } } TemperatureSum[SensorId] = 0; TemperatureCount[SensorId] = 0; @@ -645,7 +649,6 @@ uint32_t MillisecLowLoop(uint32_t tick) //Screw_ENC_Velocity_to_DAC(); - for testing the screw enc if (Head_Type > HEAD_TYPE_FLAT_WITHOUT_CARD) StartPT100 = TEMP_SENSE_ANALOG_DRYER_TEMP1; - if (Ten_msTick) { //Speed_Data = Read_Speed_Sensor_TypeII(); @@ -821,6 +824,10 @@ uint32_t MillisecLowLoop(uint32_t tick) if (Head_Type == HEAD_TYPE_ARC) { HeadBlowersControlLoop(); } + else + { + FlatHeadAlarms(); + } //call waste state machine Waste_StateMachine_OneSecond_Call(); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index e02bd8191..e6da43178 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -83,6 +83,7 @@ typedef struct DataReadCBFunction ControlDataReadPtr; ControlCBFunction ControlCallbackPtr; uint32_t ControlTiming; + uint32_t LastCalled; char *Name; }ControlDeviceStruc; @@ -613,10 +614,13 @@ uint32_t ControlLowLoop(uint32_t tick) { if (tick - ControlArray[ControlLowDevice_i].StartTick<=skipped_ticks) continue; + if (tick - ControlArray[ControlLowDevice_i].LastCalled<=skipped_ticks) + continue; if (ControlArray[ControlLowDevice_i].ControlTiming == eOneMillisecond) continue; if (ControlArray[ControlLowDevice_i].StartTick == tick) continue; + ControlArray[ControlLowDevice_i].LastCalled = tick; if (((tick - ControlArray[ControlLowDevice_i].StartTick)%ControlArray[ControlLowDevice_i].ControlTiming)<=skipped_ticks) // run the control on exact intervals { diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 11a48b587..9cad274b9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -78,7 +78,7 @@ DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT; #define DIAGNOSTICS_LIMIT 3 #define DIAGNOSTICS_DANCER_LIMIT 30 int DiagnosticsIndex = 0; -int DiagnosticCollectionLimit = 3; //number of data samples to collect before sending to the host +int DiagnosticCollectionLimit = 1; //number of data samples to collect before sending to the host //int DiagnosticLimit = eHundredMillisecond; //frequency of data collection //int DiagnosticFastLimit = eTenMillisecond; //frequency of data collection int DiagnosticLimit =eHundredMillisecond; //frequency of data collection @@ -135,7 +135,7 @@ DoubleArray DiagnosticsDispenserPressure[MAX_SYSTEM_DISPENSERS]; HeaterState **heatersstates; HeaterState HeaterInfo[HEATER_TYPE_MAX_HEATERS]; -#define NUM_OF_INTERFACE_IOS 26 +#define NUM_OF_INTERFACE_IOS 27 DigitalInterfaceState **digitalinterfacestates; DigitalInterfaceState DigitalOutputState[NUM_OF_INTERFACE_IOS]; /*double dispenser1motorfrequency[DIAGNOSTICS_LIMIT+1]; @@ -320,15 +320,12 @@ uint32_t DiagnosticsLoadDigitalValues(void) DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR13_CTRL; DigitalOutputState[index++].value = ReadHeadMagnetBit(); - // indication of movement cause the switch in the tech board to change, also doesn't go through the task - /*if (Head_Type == HEAD_TYPE_SYLKO) //rapid/pp machines - { - DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED3; - DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTIN); - DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED4; - DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTOT); - }*/ + DigitalOutputState[index].interfaceio = INTERFACE_IOS__LS_DH_LID_OPEN; + if(Head_Type == HEAD_TYPE_ARC) + DigitalOutputState[index++].value = FPGA_Read_limit_Switches(I2C_HEADCARD_COVER_LS_ARC); + else + DigitalOutputState[index++].value = FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp [HARDWARE_MOTOR_TYPE__MOTO_DH_LID]); #ifdef USE_VOC_BUZZER_ALARM if (WHS_Type == WHS_TYPE_NEW) diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index 086525bc1..12842177c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -51,7 +51,7 @@ void HomingStopReporting(void) int i; for (i = 0; i< NUM_OF_MOTORS;i++) { - HomingToken[i][0] == 0; + HomingToken[i][0] = 0; } LOG_ERROR(0,"HomingStopReporting"); } @@ -413,8 +413,12 @@ uint32_t DispenserHomingRequestFunc(MessageContainer* requestContainer) responseContainer.continuous = true; if (MotorId <= NUM_OF_MOTORS) { - //if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) - if (isMotorConfigured(MotorId) == true) + if ((JobIsActive())&&(DispenserUsedInJob[request->index] == true)) + { + responseContainer.error = ERROR_CODE__GENERAL_ERROR; + responseContainer.errormessage = "Dispenser active in job"; + } + else if (isMotorConfigured(MotorId) == true) { if (request->direction == MOTOR_DIRECTION__Backward) //dispenser homing status = IDS_HomeDispenser(request->index,speed,DispenserHomingRequestCallback); @@ -481,17 +485,12 @@ uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_ { MessageContainer responseContainer; MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT; - uint32_t angle, temp = Read_Dryer_ENC_Position(); - - angle = Calculate_Arm_Distance(D_DrierPrevLocation,temp); + uint32_t temp = Read_Dryer_ENC_Position(); + int angle; - if ((abs (angle)<14000 )||(BusyFlag == BUSY)) // OK - take another round - { - responseContainer.has_error = true; - responseContainer.error = ERROR_CODE__GENERAL_ERROR; + angle = Calculate_Arm_Distance(Drier_Center_read,temp); - } - ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Set_Load_Arm_To_Stopper time",__FILE__,__LINE__,msec_millisecondCounter,RpMessage,0,0); + ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Set_Load_Arm_To_Stopper time",__FILE__,__LINE__,msec_millisecondCounter,RpMessage,angle,0); if (HomingControlId[deviceID] != 0xff) { ReportWithPackageFilter(DiagnosticsFilter,"MotorHomingProgressReport stopped",__FILE__,__LINE__,deviceID,RpMessage,HomingCounter[deviceID],0); @@ -506,6 +505,11 @@ uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_ responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, HomingToken[deviceID], true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size); responseContainer.has_continuous = true; responseContainer.continuous = true; + if (abs (angle)>20) // arm not at center position + { + responseContainer.has_error = true; + responseContainer.error = ERROR_CODE__GENERAL_ERROR; + } uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); @@ -556,7 +560,7 @@ uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_ uint32_t Diagnostics_Dryer_UnLoading(void) { D_DrierPrevLocation = Read_Dryer_ENC_Position(); - + MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&Drier_Center_read); LoadingArmReset(Diagnostics_Set_Load_Arm_To_Stopper_Callback,300000); /*uint32_t temp; @@ -615,16 +619,17 @@ uint32_t Diagnostics_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint uint32_t Diagnostics_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue) { D_numberOfCycles++; - uint32_t angle, temp = Read_Dryer_ENC_Position(); + int angle; + uint32_t temp = Read_Dryer_ENC_Position(); angle = Calculate_Arm_Distance(D_DrierPrevLocation,temp); ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,(int)angle,(int)ReadValue,RpMessage,temp,0); MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,D_numberOfCycles); - if ((abs(angle)>14000 )&&(ReadValue == NOTBUSY)) // OK - take another round + if ((abs(angle)<400 )&&(ReadValue == NOTBUSY)) // OK - take another round { D_DrierPrevLocation = temp; - //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,ReadValue,temp,RpMessage,angle,0); //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback details",__FILE__,(int)(TotalLoadedLen),numberOfCycles,RpMessage,CallbackCounter,0); if (D_numberOfCycles<LoadArmRounds) { @@ -653,6 +658,7 @@ uint32_t Diagnostics_Dryer_Loading(void) if (dryerbufferlength) LoadArmRounds = (int)dryerbufferlength; MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&D_DrierPrevLocation); + //MCU_E2PromProgram(EEPROM_DRIER_LOADING_ARM_ANGLE,Calc_angle); ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading request: current ",__FILE__,D_DrierPrevLocation,D_numberOfCycles,RpMessage,LoadArmRounds,0); Drier_Center_read = D_DrierPrevLocation; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c index 6d09e9f9e..c023a211c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c @@ -168,7 +168,12 @@ uint32_t DispenserJoggingRequestFunc(MessageContainer* requestContainer) if (MotorId <= NUM_OF_MOTORS) { // if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) - if (isMotorConfigured(MotorId) == true) + if ((JobIsActive())&&(DispenserUsedInJob[request->index] == true)) + { + responseContainer.error = ERROR_CODE__GENERAL_ERROR; + responseContainer.errormessage = "Dispenser active in job"; + } + else if (isMotorConfigured(MotorId) == true) { switch (request->direction) { diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 0726225df..010fc9607 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -44,6 +44,7 @@ #include "drivers/Flash_ram/MCU_E2Prom.h" #include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h> #include "drivers/FPGA/Full_Vme/FPGA_Programming_Up.h" +#include <Drivers/I2C_Communication/I2C_RFID_Dispenser_Task/I2C_RFID_Disp_Task.h> #include "StateMachines/Printing/PrintingSTM.h" #include "StateMachines/Initialization/InitSequence.h" @@ -216,12 +217,19 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters->has_openvalvetimeout = true; EmbeddedParameters->openvalvetimeout = 52; + EmbeddedParameters->has_initialdispenserpressure = true; + EmbeddedParameters->initialdispenserpressure=3.85; + EmbeddedParameters->has_initialdispensertimeout = true; + EmbeddedParameters->initialdispensertimeout=119999.0 ; + EmbeddedParameters->has_initialdispensertimelag = true; + EmbeddedParameters->initialdispensertimelag=100.0 ; + EmbeddedParameters->has_dispenserbuildpressurespeed = true; EmbeddedParameters->dispenserbuildpressurespeed=500; EmbeddedParameters->has_dispenserbuildpressurelimit = true; EmbeddedParameters->dispenserbuildpressurelimit=1.0 ; EmbeddedParameters->has_dispenserbuildpressuretimeout = true; - EmbeddedParameters->dispenserbuildpressuretimeout=150000; + EmbeddedParameters->dispenserbuildpressuretimeout=419999.0; EmbeddedParameters->has_dispenserbuildpressurelag = true; EmbeddedParameters->dispenserbuildpressurelag=50; @@ -289,6 +297,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters->powerofftemperaturelimit = 90; EmbeddedParameters->has_ids_presegment_wfcf_timebeforesegment = true; EmbeddedParameters->ids_presegment_wfcf_timebeforesegment = 20000; + EmbeddedParameters->description = "default embedded parameters"; uint8_t* response_buffer = my_malloc(configuration_parameters__get_packed_size(EmbeddedParameters)); if (response_buffer) @@ -416,6 +425,10 @@ uint32_t EmbeddedParametersInit(void) { Set_Voltage_Hysteresis (EmbeddedParameters->generalparameters[12]); } + if (EmbeddedParameters->n_generalparameters >= 15) + { + Set_Head_Blowers_Parameters(EmbeddedParameters->generalparameters[13],EmbeddedParameters->generalparameters[14]); + } PowerIdleSetParameters(EmbeddedParameters->switchtoidletimeinseconds,EmbeddedParameters->idledriertemperature,EmbeddedParameters->idleheadtemperature,EmbeddedParameters->idlemixertemperature); return Fresult; @@ -446,10 +459,10 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) LOG_ERROR (0, "Wrong Data Allocation"); return ERROR; } - if (InitFailures > REPEATED_INIT_FAILURE_LIMIT) + /*if (InitFailures > REPEATED_INIT_FAILURE_LIMIT) { Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); - AlarmHandlingSetAlarm (EVENT_TYPE__POWER_UP_BIT_FAILURE,ON); + //AlarmHandlingSetAlarm (EVENT_TYPE__POWER_UP_BIT_FAILURE,ON); //return ERROR; } else @@ -458,7 +471,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) { Report("HWConfigurationInit repeated failure going up",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); } - } + }*/ HardwareConfiguration *request = UploadRequest->hardwareconfiguration; diff --git a/Software/Embedded_SW/Embedded/Modules/General/Safety.c b/Software/Embedded_SW/Embedded/Modules/General/Safety.c index ebbc3d326..a70866fd6 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/Safety.c +++ b/Software/Embedded_SW/Embedded/Modules/General/Safety.c @@ -205,10 +205,10 @@ uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) { if (Check_Disp_Safety_Stop_Indication(Disp_i) == false) { - AlarmHandlingSetAlarm(DispenserAlarm[Disp_i], false); if (DispenserAlarm[Disp_i] == true) { IDS_Dispenser_Alarm_Off(Disp_i); + AlarmHandlingSetAlarm(DispenserAlarm[Disp_i], false); } DispenserAlarm[Disp_i] = 0; DispenserOverPressure[Disp_i] = false; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_Blowers.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_Blowers.c index 63118221b..76c679d80 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_Blowers.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_Blowers.c @@ -52,8 +52,8 @@ #define ARC_ALARM_LIMIT 3 #define V0_INIT_STOP_FAN_TIME 5 -#define PRESSURE_SENSOR_CP 0.269 -#define PRESSURE_SENSOR_B 0.45 +#define PRESSURE_SENSOR_CP (0.242) +#define PRESSURE_SENSOR_B (-0.134) #define V0_DEFAULT_VALUE 1050 #define FAN_MIN_RPM_THRESHOLD 4000 extern uint16_t Head_Fan_Tach[2]; @@ -65,6 +65,9 @@ uint8_t HeadBlowersEnable = 1; uint8_t BlowerIdToSensorId[2] = {HEAD_PT100_ZONE_7_0X86_0, HEAD_PT100_ZONE_5_0X84_0}; //HEAD_FAN_RIGHT, HEAD_FAN_LEFT uint32_t HeadBlowersInitControlId = 0xFF; uint32_t HeadBlowersV0InitCount = 0; +uint32_t HeadBlowersV0InitInProgress = 0; +float PressureSensor_CP = PRESSURE_SENSOR_CP; +float PressureSensor_B = PRESSURE_SENSOR_B; typedef struct { @@ -225,6 +228,9 @@ void setArcHeadAlarms(uint32_t AlarmId, bool value) { switch(AlarmId) { + case EVENT_TYPE__DYEING_HEAD_COVER_IS_OPEN: + ReportWithPackageFilter(HeatersFilter,"FlatHeadAlarms on",__FILE__,AlarmId,count9,RpError, 0,0); + break; /*case EVENT_TYPE__DYEING_HEAD_ARC_LID_IS_OPEN: ReportWithPackageFilter(HeatersFilter,"ArcHeadAlarms on",__FILE__,AlarmId,count9,RpError, 0,0); break; @@ -258,7 +264,19 @@ void setArcHeadAlarms(uint32_t AlarmId, bool value) } } } +void FlatHeadAlarms(void) +{ + if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdUp [HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) == LIMIT) { + if (++count9 == ARC_ALARM_LIMIT) + setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_COVER_IS_OPEN, true); + count9 = (count9 > ARC_ALARM_LIMIT)?(ARC_ALARM_LIMIT):(count9); + } else { + if (--count9 == 0) + setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_COVER_IS_OPEN, false); + count9 = (count9 < 0)?(0):(count9); + } +} void ArcHeadAlarms(void) { double currentFlow = 0.0; @@ -332,9 +350,11 @@ void ArcHeadAlarms(void) count5 = (count5 < 0)?(0):(count5); } if (currentFlow < 1.0) { - if (++count6 == ARC_ALARM_LIMIT) - setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_1_FLOW_TOO_LOW, true); - count6 = (count6 > ARC_ALARM_LIMIT)?(ARC_ALARM_LIMIT):(count6); + if (!HeadBlowersV0InitInProgress) { + if (++count6 == ARC_ALARM_LIMIT) + setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_1_FLOW_TOO_LOW, true); + count6 = (count6 > ARC_ALARM_LIMIT)?(ARC_ALARM_LIMIT):(count6); + } } else { if (--count6 == 0) setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_1_FLOW_TOO_LOW, false); @@ -352,9 +372,11 @@ void ArcHeadAlarms(void) count7 = (count7 < 0)?(0):(count7); } if (currentFlow < 1.0) { - if (++count8 == ARC_ALARM_LIMIT) - setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_2_FLOW_TOO_LOW, true); - count8 = (count8 > ARC_ALARM_LIMIT)?(ARC_ALARM_LIMIT):(count8); + if (!HeadBlowersV0InitInProgress) { + if (++count8 == ARC_ALARM_LIMIT) + setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_2_FLOW_TOO_LOW, true); + count8 = (count8 > ARC_ALARM_LIMIT)?(ARC_ALARM_LIMIT):(count8); + } } else { if (--count8 == 0) setArcHeadAlarms(EVENT_TYPE__DYEING_HEAD_BLOWER_2_FLOW_TOO_LOW, false); @@ -435,7 +457,7 @@ double PressureSensorGetPressure(uint8_t FanId) Vm /= 10.0; if ((Vm - V0 + 22)<0) return 0.0; - Q = sqrt(Vm - V0 + 22) * PRESSURE_SENSOR_CP - PRESSURE_SENSOR_B; + Q = sqrt(Vm - V0 + 22) * PressureSensor_CP + PressureSensor_B; return Q; } @@ -500,6 +522,7 @@ uint32_t HeadBlowersInitCallbak(uint32_t IfIndex, uint32_t ReadValue) HeadBlowersInitControlId = 0xFF; HeadBlowerAirflowCalibration(); HeadBlowersOff(0); + HeadBlowersV0InitInProgress = 0; Report("Head Blowers V0 calculated", __FILE__, __LINE__, PressureSensorV0[0], RpMessage, PressureSensorV0[1], 0); Waste_Check_Flows(); } @@ -524,7 +547,23 @@ uint32_t HeadBlowersV0Init(void) //init Head Blowers V0 HeadBlowersV0InitCount = 0; + HeadBlowersV0InitInProgress = 1; HeadBlowersInitControlId = AddControlCallback("Head Blowers V0 init", HeadBlowersInitCallbak, eOneSecond, TemplateDataReadCBFunction, 0, 0, 0); Report("Head Blowers V0 init", __FILE__, __LINE__, Head_Type, RpMessage, 0, 0); return OK; } + +void Set_Head_Blowers_Parameters(float cp,float b) +{ + if (cp) + { + PressureSensor_CP = cp; + Report("Head Blowers CP Coefficient", __FILE__, __LINE__, (int)(PressureSensor_CP * 1000), RpMessage, 0, 0); + } + if (b) + { + PressureSensor_B = b; + Report("Head Blowers B Coefficient", __FILE__, __LINE__, (int)(PressureSensor_B * 1000), RpMessage, 0, 0); + } +} + diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h index cac543647..7c11b12bf 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h @@ -52,8 +52,10 @@ void HeadBlowersInit(); uint32_t HeadBlowerPidRequestMessage(void* request, int BlowerId); void HeadBlowersCfg(); void HeadBlowersControlLoop (); +void FlatHeadAlarms(void); uint32_t HeadBlowerCommandRequestMessage(int blowerId, float flow); void HeadBlowersOff(int off); uint32_t HeadBlowersOffGet(); uint32_t HeadBlowersV0Init(void); +void Set_Head_Blowers_Parameters(float cp,float b); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 2f72c9cb0..db7261090 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1006,18 +1006,25 @@ uint32_t HeaterPrepareFailureCheckTemperatures[HEATER_TYPE_MAX_HEATERS] = {0,0,0 void HeaterPrepareFailureCheck(void) { int i; + int band = 200; if (GetHeatersPrepareWaiting() == false) { HeaterPrepareFailureCheckCounter = 0; return; } + if (HeaterPrepareFailureCheckCounter%60 == 0) + ReportWithPackageFilter(HeatersFilter,"HeaterPrepareFailureCheck",__FILE__,HeaterPrepareFailureCheckCounter,GetHeatersPrepareWaiting(),RpWarning,HeaterCheckReady(), 0); if ((HeaterPrepareFailureCheckCounter>=300)&&(HeaterPrepareFailureCheckCounter%60 == 0)) { for (i = 0; i<HEATER_TYPE_MAX_HEATERS; i++) { if(HeaterReady[i] == false) { - if (abs (HeaterPrepareFailureCheckTemperatures[i] - HeaterPreviousRead[i])<200) // no temperature move in the last 5 minutes + if ((i == HEATER_TYPE__DryerAirHeater)||(i == HEATER_TYPE__HeadCoverHeater1)||(i == HEATER_TYPE__HeadCoverHeater2)) + band = 50; + else + band = 200; + if (abs (HeaterPrepareFailureCheckTemperatures[i] - HeaterPreviousRead[i])<band) // no temperature move in the last 5 minutes { ReportWithPackageFilter(HeatersFilter,"HeaterPrepareFailureCheck",__FILE__,i,HeaterPrepareFailureCheckTemperatures[i],RpWarning,HeaterPreviousRead[i], 0); JobEndReason = JOB_TEMPERATURE_ALARM; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index 0f8108dad..e570a27f6 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -30,6 +30,8 @@ extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS]; extern bool HomingActive[MAX_SYSTEM_DISPENSERS]; extern bool PrimingActive[MAX_SYSTEM_DISPENSERS]; +extern uint32_t DispenserPreSegmentControlId; + extern uint32_t LeftRockerSpeed; extern uint32_t RightRockerSpeed; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 400eab33e..a1aa37c07 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -540,10 +540,22 @@ uint32_t IDS_Check_Pressure_Callback(uint32_t DispenserId, uint32_t ReadValue) TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId]; if (JobIsActive()) { - if (DispenserUsedInJob[DispenserId] == true) - { - return ERROR; - } +#ifndef LIGHT_COLORS + if ((DispenserId == CLEANER_DISPENSER)&&(DispenserPreSegmentControlId != 0xFF)) //not in presegment + { + return ERROR; + } + else if ((DispenserUsedInJob[DispenserId] == true)&&(DispenserId != CLEANER_DISPENSER)) + { + return ERROR; + } + +#else + if (DispenserUsedInJob[DispenserId] == true) + { + return ERROR; + } +#endif } if (Check_Pressure_Bypass == true) return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index d567f8ad9..559ffdecc 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -701,6 +701,8 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl { continue; } + if (DispenserId!=Dispenser_i) + ReportWithPackageFilter(IDSFilter,"DispenserId!=Dispenser_i",__FILE__,__LINE__,DispenserId,RpWarning,(int)Dispenser_i,0); //(Speed*uStep*PPR)/((2*PI*Dispenser_Radius) segmentfirst_speed = Dispensers[Dispenser_i]->nanolitterpersecond / Dispensers[Dispenser_i]->nanoliterperpulse; @@ -729,7 +731,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl { MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); } - CurrentDispenserSpeed[Dispenser_i] = segmentfirst_speed; + CurrentDispenserSpeed[DispenserId] = segmentfirst_speed; /*usnprintf(IdMessage, 80, "WFCF Dispenser %d nl/sec %d nl/pulse %d Pulse/sec %d speed %d", @@ -747,7 +749,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl if (DispenserUsedInJob[DispenserId] == true) { MotorStop(HW_Motor_Id, Hard_Hiz); - CurrentDispenserSpeed[Dispenser_i] = 0; + CurrentDispenserSpeed[DispenserId] = 0; //usnprintf(IdsMessage, 80,"WFCF Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); //ReportWithPackageFilter(IDSFilter,IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); } @@ -964,9 +966,12 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl } } #ifndef LIGHT_COLORS - TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; - MotorSetSpeed((TimerMotors_t)HW_Motor_Id,INITIAL_CLEANER_SPEED ); //set the dispenser to the - CurrentDispenserSpeed[CLEANER_DISPENSER] = INITIAL_CLEANER_SPEED; + if (GetDispenserPressure(CLEANER_DISPENSER) < 0.01) + { + TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; + MotorSetSpeed((TimerMotors_t)HW_Motor_Id,INITIAL_CLEANER_SPEED ); //set the dispenser to the + CurrentDispenserSpeed[CLEANER_DISPENSER] = INITIAL_CLEANER_SPEED; + } ReportWithPackageFilter(IDSFilter,"IDS start cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); #endif @@ -1085,9 +1090,9 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl / Dispensers[Dispenser_i]->nanoliterperpulse; if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) { - DispenserUsedInSegment[Dispenser_i] = true; + DispenserUsedInSegment[DispenserId] = true; MotorSetSpeed(HW_Motor_Id, DispenserPrepareSpeed); - CurrentDispenserSpeed[Dispenser_i] = DispenserPrepareSpeed; + CurrentDispenserSpeed[DispenserId] = DispenserPrepareSpeed; //usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d speed %d",DispenserId,(int) DispenserPrepareSpeed); //REPORT_MSG(segmentfirst_speed,IdsMessage); //ReportWithPackageFilter(IDSFilter,IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, DispenserPrepareSpeed, 0); @@ -1105,7 +1110,7 @@ bool AdjustDispenserSpeedToPressure(int DispenserId, double RefMaxPressure,doubl { MotorStop(HW_Motor_Id, Hard_Hiz); } - CurrentDispenserSpeed[Dispenser_i] = 0; + CurrentDispenserSpeed[DispenserId] = 0; //usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); //ReportWithPackageFilter(IDSFilter,IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); } @@ -1302,7 +1307,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); //Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer //IDS_Dispenser_Start_Motor_and_Open_Valve(DispenserId,segmentfirst_speed,NULL); MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); - CurrentDispenserSpeed[Dispenser_i] = segmentfirst_speed; + CurrentDispenserSpeed[DispenserId] = segmentfirst_speed; /*usnprintf(IdMessage, 80, "WFCF Dispenser %d nl/sec %d nl/pulse %d Pulse/sec %d speed %d", @@ -1422,47 +1427,8 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) } ReportWithPackageFilter(IDSFilter,"Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)lInterSegmentLength,0); } - /*if (EnableCleaning == true) - { - InterSegmentStartSprayCleaner = 500; - InterSegmentStartRocking = 1000; - InterSegmentCenterRockers = 3000; - }*/ - - //InterSegmentStartWFCFDispensers = (lInterSegmentLength>5000)?lInterSegmentLength-5000:lInterSegmentLength; } } - /*if (SegmentId == 0)//first segment - running the DTS out of the drier - { - Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste); //if intersegment is defined throw the ink away - for (Dispenser_i = 0; Dispenser_i < MAX_SYSTEM_DISPENSERS; Dispenser_i++) - { - HW_Motor_Id = DispenserIdToMotorId[Dispenser_i]; - //MotorStop(HW_Motor_Id,Hard_Hiz); //26/03/19 test without valves - if (DispenserUsedInJob[Dispenser_i]==true)//unconfigured dispenser - { - MotorStop(HW_Motor_Id, Soft_Hiz); - CurrentDispenserSpeed[Dispenser_i] = 0; - } - } - lInterSegmentLength = (dryerbufferCentimeters*1000/dyeingspeed); - lInterSegmentLength-=(lInterSegmentLength%100); //round to a 100 multiplication - InterSegmentStepsCount = 0; - DispenserPreSegmentControlId = AddControlCallback( IDSPreSegmentStateCallbackRunner, IDS_PRESEGMENT_TIME_STEP,TemplateDataReadCBFunction ,0, 0, 0 ); - if (DispenserPreSegmentControlId == 0xFF) - { - ReportWithPackageFilter(IDSFilter,"Add control callback failed",__FILE__,__LINE__,(int)100,RpWarning,(int)0,0); - return ERROR; - } - ReportWithPackageFilter(IDSFilter,"Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)lInterSegmentLength,0); - if (EnableCleaning == true) - { - InterSegmentStartSprayCleaner = 500; - InterSegmentStartRocking = 1000; - InterSegmentCenterRockers = 3000; - } - InterSegmentStartWFCFDispensers = lInterSegmentLength-5000; - }*/ if (uploadstrategy == JOB_UPLOAD_STRATEGY__Default) { @@ -1539,8 +1505,6 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) MotorStop(HW_Motor_Id,Soft_Hiz); //26/03/19 test without valves } CurrentDispenserSpeed[DispenserId] = 0; - //MotorSetSpeed(HW_Motor_Id, 5); - //CurrentDispenserSpeed[Dispenser_i] = 5; DispenserPreSegmentReady[DispenserId] = true; //27/03/19 check if job should be stopped REPORT_MSG(DispenserId,"Dispenser stopped pre Segment"); } diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Calculate.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Calculate.c index d26b3d814..3f1ceeabb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Calculate.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Calculate.c @@ -47,7 +47,7 @@ uint32_t CalculateRpeat(uint32_t IfIndex, uint32_t BusyFlag) void Stub_CalculateRequest(MessageContainer* requestContainer) { - MessageContainer responseContainer; + //MessageContainer responseContainer; CalculateRequest* request = calculate_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); ustrncpy (CalculateToken, requestContainer->token,36); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Procedure.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Procedure.c index c2871869d..c84dc5fb5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Procedure.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Procedure.c @@ -93,7 +93,7 @@ void Stub_ProcedureRequest(MessageContainer* requestContainer) response.replymessage = request->testname; if (n_param) { - response.replyvalue = (float**)my_malloc(sizeof(float *)*(request->n_param)); + response.replyvalue = (float*)my_malloc(sizeof(float *)*(request->n_param)); response.n_replyvalue = request->n_param; for(i=0;i<n_param;i++) { diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 096876cf1..659a308db 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -39,6 +39,7 @@ #include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h> #include "drivers/Heater/TemperatureSensor.h" #include "Drivers/I2C_Communication/Head_Card/PT100/ADS122X04.h" +#include "drivers/I2C_Communication/DAC/Blower.h" #include "Modules/IFS/ifs.h" #include "Modules/IDS/ids_ex.h" @@ -56,6 +57,7 @@ extern HeadBoardTempSensConfigStruc HeadTempSensConfig[MAX_HEAD_CARD_TEMP_SENS_ID]; extern float NumberOfRotationPerPassage; // how many rotations per spool passage extern void HeaterSafetyTestSetLimits(int limit); +extern uint32_t InitSequenceWHSAirFlowCalibration(void); //#include "graphics_adapter.h" extern uint8_t Input_Voltage; @@ -1044,7 +1046,9 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) Read_Dryer_ENC_Position(); Task_sleep(500); - response.progress = (double)MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CENTER,Read_Dryer_ENC_Position(0,0)); + (double)MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CENTER,Read_Dryer_ENC_Position(0,0)); + + response.progress = (double)Read_Dryer_ENC_Position(0,0); response.has_progress = true; } else @@ -1340,6 +1344,35 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } #endif + else + if(request->amount == 0xD11) + { + REPORT_MSG(request->delay, "stop/start blower control and blower"); + if (request->delay == 0) + { + WHS_enable_control_loop(false); + Turn_the_Blower_On();//Turn on with the Default_Voltage + Control_Voltage_To_Blower(1); //stop the blower + } + else + { + Turn_the_Blower_On();//Turn on with the Default_Voltage + Control_Voltage_To_Blower(2400); //stop the blower + WHS_enable_control_loop(true); + } + + response.progress = request->delay; + response.has_progress = true; + } + else + if(request->amount == 0xD12) + { + REPORT_MSG(request->delay, "stop/start blower control and blower"); + InitSequenceWHSAirFlowCalibration(); + + response.progress = request->delay; + response.has_progress = true; + } else if((request->amount == 0xDF) && (request->delay == 0xDF)) //Power off { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index f2ca4e8d7..ffbb504db 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -247,7 +247,8 @@ } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { - uint32_t angle, temp = Read_Dryer_ENC_Position(); + uint32_t temp = Read_Dryer_ENC_Position(); + int angle; ReportWithPackageFilter(DiagnosticsFilter,"Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,(int)numberOfCycles,(int)DrierPrevLocation,RpMessage,temp,0); @@ -258,12 +259,14 @@ { CallbackCounter--; } - if ((abs(angle)>14000 )&&(BusyFlag == NOTBUSY)) // OK - take another round + if (abs(angle)<10 ) // OK { Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0); Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); NumberOfDrierLoaderCycles=0; + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0); + //storeLoadArmParameters(); LoadStages++; @@ -272,7 +275,7 @@ else { load.color = fastBILNK; - usnprintf(LoadErrorMsg, 100, "Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM]); + usnprintf(LoadErrorMsg, 100, "^Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM]); Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0); LoadStatus = ERROR; @@ -317,7 +320,7 @@ { TimeoutsCounter = 0; load.color = fastBILNK; - usnprintf(LoadErrorMsg, 100, "Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[MotorId]); + usnprintf(LoadErrorMsg, 100, "/Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[MotorId]); Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0); LoadStatus = ERROR; @@ -687,7 +690,7 @@ TimeoutsCounter = 0; CallbackCounter = 0; load.color = fastBILNK; - usnprintf(LoadErrorMsg, 100, "Stage %s - Dryer load arm timeout",LoadStagesStr[LoadStages]); + usnprintf(LoadErrorMsg, 100, "$Stage %s - Dryer load arm timeout",LoadStagesStr[LoadStages]); Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0); LoadStatus = ERROR; MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200); @@ -729,6 +732,13 @@ { LoadArmRounds -= CurrentlyLoaded; } + if (LoadArmRounds == CurrentlyLoaded) + { + Report("Thread_Load_Dryer_Loading no need for cycles",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); + LoadStages++; + ThreadLoadStateMachine(LoadStages); + return OK; + } ThreadMotorIdToMotorId[FEEDER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_RDRIVING ; ThreadMotorIdToMotorId[DRYER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING; @@ -932,7 +942,7 @@ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz); load.color = fastBILNK; - usnprintf(LoadErrorMsg, 100, "Stage %s - Dryer load arm timeout",LoadStagesStr[LoadStages]); + usnprintf(LoadErrorMsg, 100, "&Stage %s - Dryer load arm timeout",LoadStagesStr[LoadStages]); Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0); Report("Dryer unloading timeout(1) or no movement",__FILE__,temp,DrierPrevLocation,RpWarning,ReadValue,0); LoadStatus = ERROR; @@ -1489,6 +1499,8 @@ uint32_t ThreadLoadingRestartReport(void) //sending after a failure in the final if (ThreadLoadingToken[0] == 0) return OK; + if (LoadStages == THREAD_LOAD_INIT) + return OK; ThreadLoadingRestartFlag = true; response.has_state = true; @@ -1520,6 +1532,12 @@ uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer) { responseContainer = createContainer(MESSAGE_TYPE__TryThreadLoadingResponse, requestContainer->token, true, &Cresponse, &try_thread_loading_response__pack, &try_thread_loading_response__get_packed_size); responseContainer.continuous = false; + if (JobIsActive()||(MachineReadyForHeating == false)||(FPGABurningActive==true)) + { + responseContainer.has_error = true; + responseContainer.error = ERROR_CODE__GENERAL_ERROR; + responseContainer.errormessage = "The machine is not ready for loading"; + } uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index a75241671..03bc9d24d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -50,6 +50,7 @@ bool WinderMotorSpeedRollOver = false; int StartWinderCalculation = 0; #define DEFAULT_SCREW_SPEED 1200 double ScrewSpeed = DEFAULT_SCREW_SPEED; +double RetreatTime = 0; double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone bool SCREW_TimerActivated = false; @@ -635,6 +636,7 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; + RetreatTime = ScrewNumberOfSteps*1000/ScrewSpeed; REPORT_MSG((int)ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); REPORT_MSG((int)ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); //MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); @@ -673,11 +675,11 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) //move the cart to the edge so the spool can be easily replaced //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, 1000, GPI_LS_SCREW_RIGHT, NULL,0); //MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,2000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,RetreatTime*2); #ifdef FOUR_WINDERS - MotorMovetoLimitSwitch (SCREW_2_Motor,MotorsCfg[SCREW_2_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE2_2, NULL,2000); - MotorMovetoLimitSwitch (SCREW_3_Motor,MotorsCfg[SCREW_3_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE1_2, NULL,2000); - MotorMovetoLimitSwitch (SCREW_4_Motor,MotorsCfg[SCREW_4_Motor].directionthreadwize, ScrewSpeed, GPI_LS_RDANCER_UP, NULL,2000); + MotorMovetoLimitSwitch (SCREW_2_Motor,MotorsCfg[SCREW_2_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE2_2, NULL,RetreatTime*2); + MotorMovetoLimitSwitch (SCREW_3_Motor,MotorsCfg[SCREW_3_Motor].directionthreadwize, ScrewSpeed, GPI_LS_SPARE1_2, NULL,RetreatTime*2); + MotorMovetoLimitSwitch (SCREW_4_Motor,MotorsCfg[SCREW_4_Motor].directionthreadwize, ScrewSpeed, GPI_LS_RDANCER_UP, NULL,RetreatTime*2); #endif return OK; @@ -685,10 +687,14 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) uint32_t WinderDistanceToSpoolState(void ) { double DTS_Time = (dryerbufferCentimeters/dyeingspeed)*1000;//distance to spool time in milliseconds - REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); + double WinderBackTimeBySpeed = WinderBackToBaseTime; + WinderBackTimeBySpeed *= 50; + WinderBackTimeBySpeed /= dyeingspeed; + Report("WinderDistanceToSpoolState start", __FILE__,DTS_Time,RetreatTime, RpMessage, (int)WinderBackTimeBySpeed, 0); + //REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); - ScrewDTSControlId = AddControlCallback("screw DTS",ScrewDTSCallback, DTS_Time-WinderBackToBaseTime,TemplateDataReadCBFunction,0,0,0); - Report("ScrewDTSCallback start", __FILE__,DTS_Time,msec_millisecondCounter, RpMessage, WinderBackToBaseTime, 0); + ScrewDTSControlId = AddControlCallback("screw DTS",ScrewDTSCallback, DTS_Time-RetreatTime,TemplateDataReadCBFunction,0,0,0); + Report("ScrewDTSCallback start", __FILE__,DTS_Time,msec_millisecondCounter, RpMessage, (int)WinderBackTimeBySpeed, 0); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 11a92ab63..4ce48a639 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -9,6 +9,10 @@ #define WINDER_DANCER HARDWARE_DANCER_TYPE__LeftDancer #define POOLER_DANCER HARDWARE_DANCER_TYPE__MiddleDancer #define FEEDER_DANCER HARDWARE_DANCER_TYPE__RightDancer +#define WINDER_2_DANCER HARDWARE_DANCER_TYPE__FourthDancer +#define WINDER_3_DANCER HARDWARE_DANCER_TYPE__ThirdDancer +#define WINDER_4_DANCER HARDWARE_DANCER_TYPE__RightDancer + #define NUM_OF_DANCERS NUM_OF_ROTENC //} DANCER_ENUM; typedef enum threadMotorsEnum diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index ba505493d..4ced1e5fe 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -629,6 +629,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) //pooler dancer is right sided: data is opposite TranslatedReadValue = (-1*TranslatedReadValue); } +#ifdef BTSR_ROTATED_WINDER_TFU + if (index == WINDER_MOTOR) + TranslatedReadValue = (-1*TranslatedReadValue); +#endif #ifdef FOUR_WINDERS if (index == WINDER_MOTOR) { @@ -653,7 +657,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) TranslatedReadValue = (-1*TranslatedReadValue); }*/ #endif - if (index == POOLER_MOTOR) + if (index == WINDER_MOTOR) { //pooler dancer is right sided: data is opposite JobCounter++; @@ -710,6 +714,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { NormalizedError = (-1*NormalizedError); } +/*#ifdef BTSR_ROTATED_WINDER_TFU + if (index == WINDER_MOTOR) + TranslatedReadValue = (-1*TranslatedReadValue); +#endif*/ MotorControlConfig[index].m_mesuredParam = NormalizedError; DancerError[DancerId] = NormalizedError; @@ -1061,7 +1069,7 @@ uint32_t ThreadPrepare_Tension (int DancerId, double tension) return status; } //******************************************************************************************************************** -bool SkipOpenLids = true; +bool SkipOpenLids = false; uint32_t ThreadPrepareState(void *JobDetails) { int Motor_i,i, HW_Motor_Id, Pid_Id; diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index 88722710c..402a40e2e 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,14 +1,30 @@ -Embedded SW Release note - Version 1.5.3(2) - Pack 3 +Embedded SW Release note - Version 1.5.3(4) - Pack 3 +============================================================= +remove ErrFile.txt handling (storing logs while report is disconnected) - from release version +add logs and indications for file handling +fix idle problem (#4269) +improve timing (QA - notice the COMM led blinking rate) +add parameters setting (B,C) for head air flow calculation. +remove low flow alarm during head flow recalibration +fix screw going back at the end of job time +bug #4240 (and others) - restart at the beginning of a job - resolved! + +Embedded SW Release note - Version 1.5.3(3) - Pack 3 ============================================================= for QA RFID - suprressed some bug fixes (persistent alarms, most of temperature spikes) remove repeated restart protections Blowers - read V0 on job prepare +*WHS - read V0 on job prepare Temperature build prepare failure handling End heaters before upgrade restart (#4172) fix alarm reports on prepare stage and in logs -#4170 +* multiple thread load fixes +* add flat head open alarm +* cancel ignoring open lids #4025 + +#4170 #4205 #4027 #4182 #4017 other separate tasks for RFID and dispensers EEPROM, and for the shinko @@ -16,7 +32,11 @@ support restart research procedure stub - better than progress!! store process parameter as long as they are not 0 some work for light colors and for BTSR +*Store reset reason in EEPROM in address 40(*4) and on, 40 is latest index +*improve job end processing #4162 +* fix default parameters to include pre-run +*1.5.3.3 Embedded SW Release note - Version 1.5.2(3) - Pack 3 ============================================================= diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 802ce81cc..0da78dc9c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -30,6 +30,7 @@ #include "modules/General/process.h" #include "StateMachines/Printing/PrintingSTM.h" +#include "StateMachines/Initialization/PowerIdle.h" #include "InitSequence.h" #include "drivers/I2C_Communication/DAC/Blower.h" @@ -83,7 +84,6 @@ uint32_t InitSequenceMachineReadyToDye(void); uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue); uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage); int InitFailures = 0; -extern uint32_t PressureSensorV0[2]; MACHINE_STATE_STAGES_ENUM GetMachineState(void) { @@ -112,19 +112,19 @@ uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,InitFailures+1); - if (InitFailures >= REPEATED_INIT_FAILURE_LIMIT+3) + /*if (InitFailures >= REPEATED_INIT_FAILURE_LIMIT+3) { InitFailures = 0; MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,0); - } - if (InitFailures > REPEATED_INIT_FAILURE_LIMIT) - { + }*/ + //if (InitFailures > REPEATED_INIT_FAILURE_LIMIT) + //{ Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); /*SetMachineState(MACHINE_STATE_HW_CONFIG_FAILED); AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON); SetMachineStatus(MACHINE_STATE__Error); return ERROR;*/ - } + //} status = (MACHINE_STATE_STAGES_ENUM)HWConfigurationInit(); if (status == OK) { @@ -472,6 +472,8 @@ uint32_t InitSequenceInitialBlowerActivation(void) Turn_the_Blower_On();//Turn on with the Default_Voltage Control_Voltage_To_Blower(1); //stop the blower HeadBlowersInit(); + PowerIdleInit(); + Task_sleep (1000); if (WHS_Type == WHS_TYPE_NEW) @@ -604,7 +606,7 @@ uint32_t InitSequenceStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t Bus bool InitialHeating = false; void InitSequenceSetStartHeating(bool StartHeating) { - REPORT_MSG(StartHeating,"InitSequenceStateMachine InitialHeating set"); + REPORT_MSG(StartHeating,"InitSequence StateMachine InitialHeating set"); InitialHeating = StartHeating; } uint32_t InitSequenceStartHeating(void) @@ -612,6 +614,7 @@ uint32_t InitSequenceStartHeating(void) TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DH_LID; SetMachineReadyForHeating(true); + SetMachineState(INIT_SEQUENCE_START_HEATING); if(Head_Type == HEAD_TYPE_ARC) { MotorMovetoLimitSwitch(MotorId,1-MotorsCfg[MotorId].directionthreadwize, 30, Motor_Id_to_LS_IdDown[MotorId], cleaningMotorCBFunction,30000); @@ -633,12 +636,12 @@ uint32_t InitSequenceStartHeating(void) { SetMachineState(MACHINE_STATE_NO_PROCESS_PARAMS); SetMachineStatus(MACHINE_STATE__Ready); - REPORT_MSG(MachineStateDetail,"InitSequenceStateMachine no process parameters file"); + REPORT_MSG(MachineStateDetail,"InitSequence StateMachine no process parameters file"); } } else { - REPORT_MSG(InitialHeating,"InitSequenceStateMachine InitialHeating is OFF"); + REPORT_MSG(InitialHeating,"InitSequence StateMachine InitialHeating is OFF"); SetMachineStatus(MACHINE_STATE__Ready); SetMachineState(MACHINE_STATE_MACHINE_READY_TO_DYE); InitStages++; @@ -778,8 +781,9 @@ uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage) case MACHINE_STATE_BUILT_IN_TEST: response.state = POWER_UP_STATE__BuiltInTest; response.progresspercentage = 15.0; - response.message = "Built In Test failed"; - Error = ERROR_CODE__POWER_UP_BUILT_IN_FAILED; + response.message = "Built In Test"; + //response.message = "Built In Test failed"; + //Error = ERROR_CODE__POWER_UP_BUILT_IN_FAILED; break; case MACHINE_STATE_INITIAL_BLOWER_ACTIVATION: response.state = POWER_UP_STATE__InitialBlowerActivation; @@ -834,6 +838,10 @@ uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage) calculate = (double)((MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1)/100)/(dryerzone1temp))*70.0; if (calculate > 0) result = (int)calculate; + if (result > 70.00) + result = 70.0; + if (HeaterCheckReady()==false) + result-=2; response.progresspercentage = 30.0 + result; } //Report("Heating calculation",__FILE__,(int)dryerzone1temp,(int)response.progresspercentage,RpWarning,(int)result,0); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 38fa539a8..dedf8ba98 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -1,32 +1,32 @@ /************************************************************************************************************************ * Printing.c - * High managment logical unit of slow motors in the system ( 6 dispensers and the screw motor) + * High management logical unit of slow motors in the system ( 6 dispensers and the screw motor) * profile run up begins from screw homing to begin position and only then from fast motors activation. - * when every slow motor tuches the limit switch (no matter whether its screw or dispenser) - * an interrupt occures in the system and as long as its pushing the limit switch all the system is prevented from operation. + * when every slow motor touches the limit switch (no matter whether its screw or dispenser) + * an interrupt occurred in the system and as long as its pushing the limit switch all the system is prevented from operation. * because of that the work flow with interrupts must be : * design a function handle (what to do in the moment the interrupt arrives) * configure the wanted interrupt in the cfg file (according to the defined port and pin and its interrupt number and the handler) - * enable interupt for predefined gpio in the application + * enable interrupt for predefined gpio in the application * when the interrupt arrives the handle will be automatically called * in case of the limit switches since the operation is continuess the interrupt must be disabled in order to continue the application running. * then the operation is not continues (like butten pushing) there is no need in disabling the interrupts * Printing module is responsible for : - * operating diffrent winding algorithms with predefined parameters from the UI + * operating different winding algorithms with predefined parameters from the UI * operating the dispensers according to predefined dispensing rate from the UI **************************************************************************************************************************/ ////////////////////////////////State machine operation//////////////////////////////////// //the state machine operation is used to operate in runtime correct profile flow execution -//by recieved esign flow of the user from the UI +//by received design flow of the user from the UI /////////////////////////////////////////////////////////////////////////////////////////// #include <Container.h> #include <DataDef.h> #include "include.h" -#include <ti/sysbios/knl/mailbox.h> -#include <ti/sysbios/knl/Clock.h> -#include <ti/sysbios/knl/task.h> +//#include <ti/sysbios/knl/mailbox.h> +//#include <ti/sysbios/knl/Clock.h> +//#include <ti/sysbios/knl/task.h> #include "Common/report/report.h" @@ -109,6 +109,7 @@ HeadCleaningParameters *CleaningParameters = NULL; bool CopyConfigured[MAX_SYSTEM_MODULES]; bool CleaningJobActive = false, JoggingJobActive = false; char ErrorMsg[100]; +uint32_t JobEndTimeMillisec = 0; ModuleStateEnum PrepareWaiting[MAX_SYSTEM_MODULES] = {ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle}; double job_length = 0.0; @@ -396,58 +397,77 @@ uint32_t ThreadJoggingFunc(int speed) { ProcessParameters ProcessParametersCopy; uint32_t status = OK; - if ((JobIsActive() == true)||(JoggingJobActive == true)||(MachineReadyForHeating == false)||(FPGABurningActive==true)) +// JobEndTimeMillisec = msec_millisecondCounter; + + if (JobIsActive() == true) { - status = ERROR; - Report("Jog JobIsActive or machine initialisation", __FILE__, __LINE__, JobIsActive(), RpWarning, JoggingJobActive, 0); + Report("cannot jog while JobIsActive", __FILE__, __LINE__, JobIsActive(), RpWarning, JoggingJobActive, 0); + return ERROR; } - else + if (JoggingJobActive == true) { - //memcpy(&CopyConfigured,&Configured,sizeof(CopyConfigured)); - //usnprintf(ErrorMsg, 80,"Copy Configured T %d W %d I %d H %d W %d",CopyConfigured[Module_Thread],CopyConfigured[Module_Winder],CopyConfigured[Module_IDS],CopyConfigured[Module_Heaters],CopyConfigured[Module_Waste]); - //Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); + Report("cannot jog while JoggingJobActive", __FILE__, __LINE__, JoggingJobActive, RpWarning, JoggingJobActive, 0); + return ERROR; + } + if (MachineReadyForHeating == false) + { + Report("cannot jog while Machine not ReadyForHeating", __FILE__, __LINE__, MachineReadyForHeating, RpWarning, JoggingJobActive, 0); + return ERROR; + } + if (FPGABurningActive==true) + { + Report("cannot jog while FPGABurningActive", __FILE__, __LINE__, FPGABurningActive, RpWarning, JoggingJobActive, 0); + return ERROR; + } + if ((msec_millisecondCounter - JobEndTimeMillisec) <2000) + { + Report("cannot jog while Job Is ending", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, JobEndTimeMillisec, 0); + return ERROR; + } + //memcpy(&CopyConfigured,&Configured,sizeof(CopyConfigured)); + //usnprintf(ErrorMsg, 80,"Copy Configured T %d W %d I %d H %d W %d",CopyConfigured[Module_Thread],CopyConfigured[Module_Winder],CopyConfigured[Module_IDS],CopyConfigured[Module_Heaters],CopyConfigured[Module_Waste]); + //Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); - //set the job handler to ignore heaters, ids and waste in the state machine - Configured[Module_Thread] = true; - Configured[Module_Winder] = true; - Configured[Module_IDS] = false; - Configured[Module_Heaters] = false; - Configured[Module_Waste] = false; - //set the requested speed without changing other process parameters - memcpy (&ProcessParametersCopy,&ProcessParametersKeep,sizeof(ProcessParameters)); - if(speed) - ProcessParametersCopy.dyeingspeed = speed; - else - ProcessParametersCopy.dyeingspeed = 40; - if (HandleProcessParameters(&ProcessParametersCopy,false)!= OK) - { - Report("Process parameters handling failed", __FILE__, __LINE__, 0, RpWarning, 0, 0); - status = FAILED; - } - else - { - //load essential job prameters to enable thread running - Ticket.n_segments = 1; - n_segments = 1; - Ticket.segments = my_malloc(sizeof(Ticket.segments)); - TSegment = my_malloc(sizeof(JobSegment)); - Tspool = my_malloc(sizeof(JobSpool)); - TSegment->length = 200.0; - TSegment->n_brushstops = 0; - Ticket.segments[0] = TSegment; - Tspool->backingrate = 32; - Tspool->bottombackingrate = 32; - Tspool->segmentoffsetpulses = 1000; - Tspool->startoffsetpulses = 220; - Tspool->rotationsperpassage = 3.1415926*2; - Tspool->has_limitswitchstartpointoffset = false; - Ticket.spool = Tspool; - Ticket.threadparameters = &SavedThreadParameters; - CurrentJob = &Ticket; - InternalWindingConfigMessage(Tspool); - JoggingJobActive = true; - StartJob(&Ticket); - } + //set the job handler to ignore heaters, ids and waste in the state machine + Configured[Module_Thread] = true; + Configured[Module_Winder] = true; + Configured[Module_IDS] = false; + Configured[Module_Heaters] = false; + Configured[Module_Waste] = false; + //set the requested speed without changing other process parameters + memcpy (&ProcessParametersCopy,&ProcessParametersKeep,sizeof(ProcessParameters)); + if(speed) + ProcessParametersCopy.dyeingspeed = speed; + else + ProcessParametersCopy.dyeingspeed = 40; + if (HandleProcessParameters(&ProcessParametersCopy,false)!= OK) + { + Report("Process parameters handling failed", __FILE__, __LINE__, 0, RpWarning, 0, 0); + status = FAILED; + } + else + { + //load essential job prameters to enable thread running + Ticket.n_segments = 1; + n_segments = 1; + Ticket.segments = my_malloc(sizeof(Ticket.segments)); + TSegment = my_malloc(sizeof(JobSegment)); + Tspool = my_malloc(sizeof(JobSpool)); + TSegment->length = 200.0; + TSegment->n_brushstops = 0; + Ticket.segments[0] = TSegment; + Tspool->backingrate = 32; + Tspool->bottombackingrate = 32; + Tspool->segmentoffsetpulses = 1000; + Tspool->startoffsetpulses = 220; + Tspool->rotationsperpassage = 3.1415926*2; + Tspool->has_limitswitchstartpointoffset = false; + Ticket.spool = Tspool; + Ticket.threadparameters = &SavedThreadParameters; + CurrentJob = &Ticket; + InternalWindingConfigMessage(Tspool); + JoggingJobActive = true; + StartJob(&Ticket); } return status; } @@ -1227,10 +1247,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes CurrentRequest = NULL; } JobStopReporting(); - JobMessageStruc JobMessage; - HandleJobEnd(JobEndReason); - } // if (responseContainer.data.data) // my_free(responseContainer.data.data); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 7db59946e..d6262119c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -59,6 +59,7 @@ uint16_t n_units = 1; uint16_t n_unit_segments = 0; extern bool JobActive; +extern uint32_t JobEndTimeMillisec; /********************************************************************** * the array and enum of PrintingState_t below must be in sync order ***********************************************************************/ @@ -124,7 +125,7 @@ FRESULT OpenJobFile() { readbBytes = 0; } - REPORT_MSG(bBytes,"OpenJobFile"); + Report("OpenJobFile",__FILE__,__LINE__,(int)Fresult,RpMessage,(int)bBytes,0); } return Fresult; } @@ -145,6 +146,7 @@ FRESULT RewindJobFile() FRESULT CloseJobFile() { Fresult = f_close(JobRequestFileHandle); + Report("CloseJobFile",__FILE__,__LINE__,(int)Fresult,RpMessage,(int)JobRequestFileHandle,0); readbBytes = 0; ImmediateRead = 0; @@ -162,7 +164,6 @@ FRESULT CloseJobFile() my_free(SegmentPtr); SegmentPtr = NULL; } - REPORT_MSG(Fresult,"CloseJobFile"); return Fresult; } @@ -202,7 +203,7 @@ JobDescriptionFileSegment *GetNextSegmentFromJobFile() }//segment malloc else { - LOG_ERROR (SegmentPtr, "malloc error"); + LOG_ERROR (SegmentSize, "malloc error"); //status = ERROR; } }//segment read size @@ -269,7 +270,7 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() }//brushstop size read ok else { - LOG_ERROR (BrushStopPtr, "malloc error"); + Report("malloc error", __FILE__, __LINE__, BrushStopSize, RpWarning, (int)0, 0); //status = ERROR; } }// if brush stop count @@ -656,6 +657,7 @@ uint32_t EndState(void *JobDetails, char *Message) CloseJobFile(); //ROM_IntMasterEnable(); JobActive = false; //bug 4162 - test carefully + JobEndTimeMillisec = msec_millisecondCounter; //#4027 SendJobProgress(0.0,0,true,Message); if ((JoggingJobActive==false)&&(CleaningJobActive == false)) { |
