From cd18fb27a2499072f18cb0320ddeb85a0500a93e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 31 Oct 2019 10:16:10 +0200 Subject: version 1.4.6.0 - going forward --- Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index 8818d51e5..e15ae2dc4 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -130,7 +130,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) CurrentRunningFile = 0; File_i = 0; //add control 1 second - ActivateVersionControlId = AddControlCallback( ActivateVersionCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + ActivateVersionControlId = AddControlCallback(NULL, ActivateVersionCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); } for (File_i = 0;File_in_filedescriptors;File_i++) { -- cgit v1.3.1 From a282b0a50f0b19712a11e16320a5de7d337ffa30 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 19 Nov 2019 16:46:51 +0200 Subject: update mastrer with latest changes in Alpha + embedded version --- .../Embedded/Common/SWUpdate/FileSystem.c | 4 - .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 1 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 12 +- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.h | 1 + .../Embedded/Common/report/reportInit.c | 2 + Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c | 1 + .../I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c | 2 +- .../I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c | 44 +- .../I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h | 2 +- .../Embedded/Drivers/Motors/MotorActions.c | 39 +- .../Embedded_SW/Embedded/Drivers/Valves/Valve.c | 3 + .../Embedded/Drivers/flash_ram/MCU_E2Prom.c | 5 + .../Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.c | 281 ++++++ .../Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.h | 22 + .../Embedded/Drivers/logi-tag/LT_NFC_Info.h | 74 ++ .../Embedded/Drivers/logi-tag/LT_NFC_Settings.h | 75 ++ .../Embedded/Drivers/logi-tag/LT_RFID.c | 946 +++++++++++++++++++++ .../Embedded/Drivers/logi-tag/LT_RFID.h | 97 +++ Software/Embedded_SW/Embedded/Embedded.cfg | 2 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 39 +- .../Embedded/Modules/Control/MillisecTask.c | 2 + .../Embedded_SW/Embedded/Modules/Control/control.c | 2 + .../Modules/Diagnostics/DiagnosticsHoming.c | 19 +- .../Embedded/Modules/General/GeneralHardware.c | 19 +- .../Embedded_SW/Embedded/Modules/General/Safety.c | 8 +- .../Embedded_SW/Embedded/Modules/General/process.c | 56 +- .../Embedded_SW/Embedded/Modules/General/process.h | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 1 + Software/Embedded_SW/Embedded/Modules/IDS/IDS.h | 3 +- .../Embedded/Modules/IDS/IDS_dispenser.c | 10 +- Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h | 2 + .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 206 ++--- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 87 +- Software/Embedded_SW/Embedded/Modules/IFS/ifs.c | 136 ++- Software/Embedded_SW/Embedded/Modules/IFS/ifs.h | 1 + .../Embedded/Modules/Stubs_Handler/Progress.c | 34 +- .../Embedded/Modules/Thread/ThreadLoad.c | 67 +- .../Embedded/Modules/Thread/Thread_Winder.c | 17 +- .../Embedded/Modules/Thread/Thread_init.c | 7 +- .../Embedded/Modules/Thread/Thread_print.c | 7 +- .../Embedded/Modules/Waste/Waste_init.c | 14 +- .../Embedded/Software Release Notes.txt | 22 + .../StateMachines/Initialization/InitSequence.c | 4 +- .../StateMachines/Initialization/PowerIdle.c | 19 +- .../Initialization/PowerOffSequence.c | 2 +- .../Embedded/StateMachines/Printing/JobSTM.c | 40 +- .../PMR/Messages/MachineStatus/MachineStatus.proto | 1 + 47 files changed, 2135 insertions(+), 305 deletions(-) create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.c create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.h create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Info.h create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Settings.h create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c create mode 100644 Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.h (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 018e83ce0..7871c5e28 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -31,14 +31,10 @@ #include #include -#include "third_party/fatfs/src/ffconf.h" -#include "third_party/fatfs/src/diskio.h" #include "drivers/Flash_Memory/Flash_Memory.h" #include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" -#include "third_party/fatfs/src/ffconf.h" - #include "StateMachines/Printing/PrintingSTM.h" diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index e15ae2dc4..12f336749 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -139,6 +139,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) switch(VersionPackage->filedescriptors[File_i]->destination) { case VERSION_FILE_DESTINATION__MCU: + CurrentRunningFile++; break; case VERSION_FILE_DESTINATION__FPGA1: case VERSION_FILE_DESTINATION__FPGA2: 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 5e0a5c31a..92ef02008 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,6,0}; +TangoVersion_t _gTangoVersion = {1,4,8,0}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d @@ -56,5 +56,15 @@ uint16_t GetTangoVersion(uint8_t* _buffer) //_buffer[size++] = '\0'; return size; } +char EmbMessage[50]; +void ReportEmbeddedVersion(void) +{ + memset (EmbMessage,0,sizeof(EmbMessage)); + + strcpy(EmbMessage, "Embedded Version "); + usnprintf(EmbMessage, 50, "Embedded Version %d.%d.%d.%d build %s",_gTangoVersion.m_major,_gTangoVersion.m_minor, _gTangoVersion.m_patch,_gTangoVersion.m_build,BUILD_DATE); + + Report(EmbMessage, __FILE__, __LINE__, _gTangoVersion.m_patch, RpWarning, _gTangoVersion.m_build, 0); +} diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.h b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.h index 7cec18731..873b5da70 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.h +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.h @@ -22,6 +22,7 @@ extern char _gTangoName [MAX_STRING_LEN];//d uint16_t GetTangoVersion(uint8_t* _buffer); +void ReportEmbeddedVersion(void); #endif /* COMMON_SW_INFO_SW_INFO_H_ */ diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index 857c0ad82..5ae55736d 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -41,6 +41,7 @@ #include "PMR/debugging/SetDebugLogCategoryResponse.pb-c.h" #include "modules/General/process.h" +#include "Common/SW_Info/SW_Info.h" PackageHandle ControlFilter; PackageHandle HeatersFilter; @@ -193,6 +194,7 @@ uint32_t ReportInitMessage(MessageContainer* requestContainer) */ ReportResetReason(); Task_sleep (100); + ReportEmbeddedVersion(); /*SysCtlResetCauseClear(RESC);*/ #ifdef TEST_PID_THREAD diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c index 867f0c336..e2e71c4cc 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c @@ -6,6 +6,7 @@ #include "driverlib/epi.h" #include "inc/hw_memmap.h" #include +#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "FPGA_Rename.h" #include "FPGA_COMM.h" diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c index 03fbb3aa2..a6391e2ef 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c @@ -20,7 +20,7 @@ #define I2C_MUX_Slave_Add 0xE0//Mux I2C address #define I2C_NFC_Slave_Add (0x28<<1)//The OM5578/PN7150S kit comes with default 0x28 (7 bits) I2C address. -#define MaxNoBytesToRead 7// +#define MaxNoBytesToRead 100// #define MaxNoBytesToWrite 100// uint8_t NFC_I2C_Read_buf[MaxNoBytesToRead]; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c index 8b5ea642d..e2886c4bc 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c @@ -17,7 +17,7 @@ uint32_t NCICoreReset() //stage 1 uint32_t Status = OK; const uint8_t CORE_RESET_CMD[] = {0x20,0x00,0x01,0x01}; - const uint8_t Expedted_Answer_Length = 6;// CORE_RESET_RSP 40 00 03 00 11 01 (PN7150 RESET RESPONSE) + const uint8_t CORE_RESET_RSP[] = {0x40,0x00,0x03,0x00,0x11,0x01};//PN7150 RESET RESPONSE int i = 0; @@ -30,18 +30,24 @@ uint32_t NCICoreReset() //stage 1 delayms(1000); I2C_NFC_Set_For_Read_Ch(); SysCtlDelay(5); - I2C_NFC_Read_Ch(Expedted_Answer_Length); + I2C_NFC_Read_Ch(sizeof(CORE_RESET_RSP)); delayms(5); + for(i=0; i>8 != IfTypeMotors) { LOG_ERROR (IfIndex, "Wrong Interface type"); @@ -213,17 +219,34 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) / } Read_Dryer_ENC_Position(); //trigger the next call + ArmSamples[ArmSamplePointer] = MotorPosition;//(-1 * TranslatedReadValue); if (FirstCall<5) { FirstCall++; return OK; } + ArmSamples[ArmSamplePointer] = MotorPosition;//(-1 * TranslatedReadValue); + ArmSamplePointer++; + if (ArmSamplePointer >= MAX_CONTROL_SAMPLES) + ArmSamplePointer = 0; + for (i=0;i=10)) /*Motor did not move in the last time lag*/ - if (abs(MotorPosition - StoredMotorPosition[MotorId])<=10) +// if (abs(MotorPosition - StoredMotorPosition[MotorId])<=10) + if (abs(avreageSampleValue-StoredavreageSampleValue)<=2) { //stop this control loop - REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction stopped"); + //REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction stopped"); + Report("Motor to stopper stopped",__FILE__,avreageSampleValue,StoredavreageSampleValue,RpWarning,avreageSampleSum,0); SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; @@ -246,7 +269,11 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) / MotorCallback[MotorId](MotorId,ArmPosition); } - else StoredMotorPosition[MotorId] = MotorPosition; + else + { + StoredMotorPosition[MotorId] = MotorPosition; + StoredavreageSampleValue = avreageSampleValue; + } return OK; } @@ -278,13 +305,15 @@ uint32_t MotorMoveToStopper (TimerMotors_t MotorId,bool direction, uint32_t Spee CallbackCalls = 0; FirstCall = 0; MotorGetPositionFromFPGA(MotorId); + memset(ArmSamples,0,sizeof(ArmSamples)); + ArmSamplePointer = 0; Task_sleep(5); Read_Dryer_ENC_Position(); //trigger the next call StoredMotorPosition[MotorId] = MotorGetPosition(MotorId); - REPORT_MSG(StoredMotorPosition[MotorId],"MotorMoveToStopper initial position"); + Report("MotorMoveToStopper initial position",__FILE__,__LINE__,StoredMotorPosition[MotorId],RpWarning,Speed,0); MotorSetSpeed (MotorId, Speed); - MotorControlId[MotorId] = AddControlCallback(NULL, MotorVerifiedCallBackFunction, 10,Control_Read_Dryer_Position,(IfTypeMotors*0x100+MotorId), MotorId, 0 ); + MotorControlId[MotorId] = AddControlCallback(NULL, MotorVerifiedCallBackFunction, 30,Control_Read_Dryer_Position,(IfTypeMotors*0x100+MotorId), MotorId, 0 ); MotorControlCallback[MotorId] = MotorVerifiedCallBackFunction; return MotorControlId[MotorId]; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c index 06e5b4b0d..bc5cb5096 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c +++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c @@ -362,6 +362,7 @@ uint32_t Valve3WayCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callback_fptr callback) //direction: MidTank_Dispenser or Dispenser_Mixer { + uint32_t busy = false; //Report("Control3WayValvesWithCallback ",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)direction,0); if (Valve3WayControlId[_ValveId] != 0xFF) { @@ -371,6 +372,8 @@ uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callb Valve3WayModuleCallback[_ValveId] = callback; + busy = FPGA_GetDispenserValveBusyOCD(_ValveId,0); + Report("Set valve id, dir, busy",__FILE__,_ValveId,(int)direction,RpWarning,(int)busy,0); Valve3WayControlId[_ValveId] = AddControlCallback("Valve3WayControlId", Valve3WayCallBackFunction, eOneSecond/*eHundredMillisecond*/, FPGA_GetDispenserValveBusyOCD,(IfTypeDisopenser*0x100+_ValveId), _ValveId, 0 ); if (Valve3WayControlId[_ValveId] == 0xFF) Report("Add control callback failed",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0); diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c index 96ff259b2..aae9ce2e9 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c @@ -20,6 +20,11 @@ uint32_t MCU_E2PromProgram(int Address,uint32_t Data) Report("MCU_E2PromProgram Error",__FILE__,__LINE__,Address,RpWarning,Data,0); return ERROR; } + if ((Address>=EEPROM_STORAGE_DANCER_0)&&(Address<=EEPROM_STORAGE_DANCER_2)) + { + Report("~~~~~~Store dancers eeprom ",__FILE__,__LINE__,(int)Address,RpWarning,(int)Data,0); + + } Report("MCU_E2PromProgram",__FILE__,__LINE__,Address,RpWarning,Data,0); return (EEPROMProgram((uint32_t *)&Buffer, Address*4, 4)); diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.c b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.c new file mode 100644 index 000000000..68ae6c107 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.c @@ -0,0 +1,281 @@ +#include "LT_NFC.h" +#include "LT_NFC_Settings.h" +#include + +uint8_t rBuf[MAX_NCI_FRAME_SIZE]; +uint16_t readLen = 0; + +uint32_t I2C_Base = I2C6_BASE; +uint32_t EN_Port = GPIO_PORTK_BASE; +uint32_t EN_Pin = GPIO_PIN_1; +uint32_t IRQ_Port = GPIO_PORTK_BASE; +uint32_t IRQ_Pin = GPIO_PIN_2; + +void NFC_HardwareReset(){ + ROM_GPIOPinWrite(EN_Port, EN_Pin, 0); + delayms(10); + ROM_GPIOPinWrite(EN_Port, EN_Pin, EN_Pin); + delayms(10); +} + +bool NFC_WaitForIRQ(uint16_t timeout){ + uint16_t i = 0; + for(i=0; i= 2) && (rBuf[0] == 0x40) && (rBuf[1] == 0x00)) + return true; + } + delayms(500); + } + return false; +} + +bool NFC_CoreInit(uint32_t *fwVersion){ + const uint8_t NCICoreInit[] = {0x20, 0x01, 0x00}; + if(!NFC_Transceive(NCICoreInit, sizeof(NCICoreInit))) + return false; + if ((readLen < 20) || (rBuf[0] != 0x40) || (rBuf[1] != 0x01) || (rBuf[3] != 0x00)) + return false; + if (rBuf[17+rBuf[8]] != 0x10) // PN7150 is generation 2 + return false; + *fwVersion = rBuf[17+rBuf[8]]; + *fwVersion |= ((uint32_t)rBuf[18+rBuf[8]]) << 8; + *fwVersion |= ((uint32_t)rBuf[19+rBuf[8]]) << 16; + return true; +} + +bool NFC_Connect(uint32_t *fwVersion){ + NFC_HardwareReset(); + if(!NFC_CoreReset()) + return false; + if(!NFC_CoreInit(fwVersion)) + return false; + return true; +} + +void NFC_Disconnect(){ + ROM_GPIOPinWrite(EN_Port, EN_Pin, 0); +} + +bool NFC_ConfigSettings(){ + if(!NFC_Config(NxpNci_CORE_CONF, sizeof(NxpNci_CORE_CONF))) + return false; + if(!NFC_Transceive(NxpNci_CORE_STANDBY, sizeof(NxpNci_CORE_STANDBY))) + return false; + if ((readLen < 4) || (rBuf[0] != 0x4F) || (rBuf[1] != 0x00) || (rBuf[3] != 0x00)) + return false; + const uint8_t NCIReadTS[] = {0x20, 0x03, 0x03, 0x01, 0xA0, 0x14}; + if(!NFC_Transceive(NCIReadTS, sizeof(NCIReadTS))) // Read timestamp stored in NFC Controller + return false; + if ((readLen < 9) || (rBuf[0] != 0x40) || (rBuf[1] != 0x03) || (rBuf[3] != 0x00)) + return false; + uint8_t currentTS[32] = __TIMESTAMP__; + if(memcmp(&rBuf[8], currentTS, sizeof(currentTS)) != 0){ // Compare stored timestamp with current build timestamp + if(!NFC_Config(NxpNci_CORE_CONF_EXTN, sizeof(NxpNci_CORE_CONF_EXTN))) + return false; + if(!NFC_Config(NxpNci_CLK_CONF, sizeof(NxpNci_CLK_CONF))) + return false; + if(!NFC_Config(NxpNci_TVDD_CONF_2ndGen, sizeof(NxpNci_TVDD_CONF_2ndGen))) + return false; + if(!NFC_Config(NxpNci_RF_CONF_2ndGen, sizeof(NxpNci_RF_CONF_2ndGen))) + return false; + uint8_t NCIWriteTS[7+32] = {0x20, 0x02, 0x24, 0x01, 0xA0, 0x14, 0x20}; + memcpy(&NCIWriteTS[7], currentTS, sizeof(currentTS)); + if(!NFC_Config(NCIWriteTS, sizeof(NCIWriteTS))) // Save current build timestamp + return false; + } + if(!NFC_CoreReset()) + return false; + uint32_t tmp; + if(!NFC_CoreInit(&tmp)) + return false; + return true; +} + +bool NFC_ConfigMode(){ + const uint8_t NxpNci_PropAct[] = {0x2F, 0x02, 0x00}; + if(!NFC_Transceive(NxpNci_PropAct, sizeof(NxpNci_PropAct))) // Enable Proprietary interface for T4T card presence check procedure + return false; + if ((readLen < 4) || (rBuf[0] != 0x4F) || (rBuf[1] != 0x02) || (rBuf[3] != 0x00)) + return false; + if(!NFC_Transceive(NxpNci_DiscoverMap, sizeof(NxpNci_DiscoverMap))) + return false; + if ((readLen < 4) || (rBuf[0] != 0x41) || (rBuf[1] != 0x00) || (rBuf[3] != 0x00)) + return false; + return true; +} + +bool NFC_StartDiscovery(){ + if(!NFC_Transceive(NxpNci_StartDiscoveryChars, sizeof(NxpNci_StartDiscoveryChars))) + return false; + if ((readLen < 4) || (rBuf[0] != 0x41) || (rBuf[1] != 0x03) || (rBuf[3] != 0x00)) + return false; + return true; +} + +bool NFC_StopDiscovery(){ + const uint8_t NxpNci_StopDiscovery[] = {0x21, 0x06, 0x01, 0x00}; + if(!NFC_Transceive(NxpNci_StopDiscovery, sizeof(NxpNci_StopDiscovery))) + return false; + if ((readLen < 4) || (rBuf[0] != 0x41) || (rBuf[1] != 0x06) || (rBuf[3] != 0x00)) + return false; + if(!NFC_Receive(TIMEOUT_COMMAND)) + return false; + return true; +} + +void NFC_FillInterfaceInfo(NxpNci_RfIntf_t* tagInfo){ + uint8_t* pBuf = &rBuf[10]; + uint8_t i, temp; + switch(tagInfo->ModeTech){ + case (MODE_POLL | TECH_PASSIVE_NFCA): + memcpy(tagInfo->Info.NFC_APP.SensRes, &pBuf[0], 2); + temp = 2; + tagInfo->Info.NFC_APP.NfcIdLen = pBuf[temp]; + temp++; + memcpy(tagInfo->Info.NFC_APP.NfcId, &pBuf[3], tagInfo->Info.NFC_APP.NfcIdLen); + temp+=pBuf[2]; + tagInfo->Info.NFC_APP.SelResLen = pBuf[temp]; + temp++; + if(tagInfo->Info.NFC_APP.SelResLen == 1) tagInfo->Info.NFC_APP.SelRes[0] = pBuf[temp]; + temp+=4; + if(pBuf[temp] != 0){ + temp++; + tagInfo->Info.NFC_APP.RatsLen = pBuf[temp]; + memcpy(tagInfo->Info.NFC_APP.Rats, &pBuf[temp+1], pBuf[temp]); + } + else tagInfo->Info.NFC_APP.RatsLen = 0; + break; + case (MODE_POLL | TECH_PASSIVE_NFCB): + tagInfo->Info.NFC_BPP.SensResLen = pBuf[0]; + memcpy(tagInfo->Info.NFC_BPP.SensRes, &pBuf[1], tagInfo->Info.NFC_BPP.SensResLen); + temp = pBuf[0] + 4; + if(pBuf[temp] != 0){ + temp++; + tagInfo->Info.NFC_BPP.AttribResLen = pBuf[temp]; + memcpy(tagInfo->Info.NFC_BPP.AttribRes, &pBuf[temp+1], pBuf[temp]); + } + else tagInfo->Info.NFC_BPP.AttribResLen = 0; + break; + case (MODE_POLL | TECH_PASSIVE_NFCF): + tagInfo->Info.NFC_FPP.BitRate = pBuf[0]; + tagInfo->Info.NFC_FPP.SensResLen = pBuf[1]; + memcpy(tagInfo->Info.NFC_FPP.SensRes, &pBuf[2], tagInfo->Info.NFC_FPP.SensResLen); + break; + case (MODE_POLL | TECH_PASSIVE_15693): + tagInfo->Info.NFC_VPP.AFI = pBuf[0]; + tagInfo->Info.NFC_VPP.DSFID = pBuf[1]; + for(i=0; i<8; i++) + tagInfo->Info.NFC_VPP.ID[7-i] = pBuf[2+i]; + break; + default: break; + } +} + +uint8_t NFC_WaitForDiscoveryNotification(NxpNci_RfIntf_t *tagInfo){ + do { + if(!NFC_Receive(TIMEOUT_DISCOVERY)) + return 0; + } while((rBuf[0] != 0x61) || ((rBuf[1] != 0x05) && (rBuf[1] != 0x03))); + if (rBuf[1] == 0x05){ + tagInfo->Interface = rBuf[4]; + tagInfo->Protocol = rBuf[5]; + tagInfo->ModeTech = rBuf[6]; + NFC_FillInterfaceInfo(tagInfo); + } + else{ + uint8_t protocol = rBuf[4]; + while(rBuf[readLen-1] == 0x02){ // Remaining NTF ? + if(!NFC_Receive(TIMEOUT_EXT)) + return 2; + } + uint8_t NCIRfDiscoverSelect[] = {0x21, 0x04, 0x03, 0x01, PROT_ISODEP, INTF_ISODEP}; + NCIRfDiscoverSelect[4] = protocol; + if (tagInfo->Protocol == PROT_ISODEP) + NCIRfDiscoverSelect[5] = INTF_ISODEP; + else if (tagInfo->Protocol == PROT_NFCDEP) + NCIRfDiscoverSelect[5] = INTF_NFCDEP; + else if (tagInfo->Protocol == PROT_MIFARE) + NCIRfDiscoverSelect[5] = INTF_TAGCMD; + else NCIRfDiscoverSelect[5] = INTF_FRAME; + if(!NFC_Transceive(NCIRfDiscoverSelect, sizeof(NCIRfDiscoverSelect))) // In case of multiple cards, select the first one + return 2; + if ((readLen < 4) || (rBuf[0] != 0x41) || (rBuf[1] != 0x04) || (rBuf[3] != 0x00)) + return 2; + if(!NFC_Receive(TIMEOUT_EXT)) + return 2; + if ((rBuf[0] == 0x61) || (rBuf[1] == 0x05)) + { + tagInfo->Interface = rBuf[4]; + tagInfo->Protocol = rBuf[5]; + tagInfo->ModeTech = rBuf[6]; + NFC_FillInterfaceInfo(tagInfo); + } + else return 2; + } + if (tagInfo->Interface == INTF_UNDETERMINED) // In case of unknown target align protocol information + tagInfo->Protocol = PROT_UNDETERMINED; + if((tagInfo->ModeTech & MODE_MASK) != MODE_POLL) + return 2; + return 1; +} + +bool NFC_ReaderTagCmd(uint8_t *command, uint8_t commandSize, uint8_t *answer, uint8_t *answerSize){ + uint8_t cmd[MAX_NCI_FRAME_SIZE] = {0, 0, commandSize}; + memcpy(&cmd[3], command, commandSize); + if(!NFC_Transceive(cmd, commandSize + 3)) + return false; + if(!NFC_Receive(TIMEOUT_COMMAND)) + return false; + if((rBuf[0] != 0) || (rBuf[1] != 0)) + return false; + *answerSize = rBuf[2]; + memcpy(answer, &rBuf[3], *answerSize); + return true; +} diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.h b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.h new file mode 100644 index 000000000..622d7dcec --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC.h @@ -0,0 +1,22 @@ +#ifndef LT_NFC_H +#define LT_NFC_H + +#include "include.h" +#include "LT_NFC_Info.h" + +extern uint32_t I2C_Base; +extern uint32_t EN_Port; +extern uint32_t EN_Pin; +extern uint32_t IRQ_Port; +extern uint32_t IRQ_Pin; + +bool NFC_Connect(uint32_t *fwVersion); +void NFC_Disconnect(); +bool NFC_ConfigSettings(); +bool NFC_ConfigMode(); +bool NFC_StartDiscovery(); +bool NFC_StopDiscovery(); +uint8_t NFC_WaitForDiscoveryNotification(NxpNci_RfIntf_t *tagInfo); +bool NFC_ReaderTagCmd(uint8_t *command, uint8_t commandSize, uint8_t *answer, uint8_t *answerSize); + +#endif diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Info.h b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Info.h new file mode 100644 index 000000000..a12d875e4 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Info.h @@ -0,0 +1,74 @@ +#ifndef LT_NFC_INFO_H +#define LT_NFC_INFO_H + +// Flag definition used as Interface values +#define INTF_UNDETERMINED 0x0 +#define INTF_FRAME 0x1 +#define INTF_ISODEP 0x2 +#define INTF_NFCDEP 0x3 +#define INTF_TAGCMD 0x80 +// Flag definition used as Protocol values +#define PROT_UNDETERMINED 0x0 +#define PROT_T1T 0x1 +#define PROT_T2T 0x2 +#define PROT_T3T 0x3 +#define PROT_ISODEP 0x4 +#define PROT_NFCDEP 0x5 +#define PROT_ISO15693 0x6 +#define PROT_MIFARE 0x80 +// Flag definition used as Mode values +#define MODE_POLL 0x00 +#define MODE_LISTEN 0x80 +#define MODE_MASK 0xF0 +// Flag definition used as Technologies values +#define TECH_PASSIVE_NFCA 0 +#define TECH_PASSIVE_NFCB 1 +#define TECH_PASSIVE_NFCF 2 +#define TECH_ACTIVE_NFCA 3 +#define TECH_ACTIVE_NFCF 5 +#define TECH_PASSIVE_15693 6 + +typedef struct{ + unsigned char SensRes[2]; + unsigned char NfcIdLen; + unsigned char NfcId[10]; + unsigned char SelResLen; + unsigned char SelRes[1]; + unsigned char RatsLen; + unsigned char Rats[20]; +} NxpNci_RfIntf_info_APP_t; // POLL passive type A + +typedef struct{ + unsigned char SensResLen; + unsigned char SensRes[12]; + unsigned char AttribResLen; + unsigned char AttribRes[17]; +} NxpNci_RfIntf_info_BPP_t; // POLL passive type B + +typedef struct{ + unsigned char BitRate; + unsigned char SensResLen; + unsigned char SensRes[18]; +} NxpNci_RfIntf_info_FPP_t; // POLL passive type F + +typedef struct{ + unsigned char AFI; + unsigned char DSFID; + unsigned char ID[8]; +} NxpNci_RfIntf_info_VPP_t; // POLL passive type ISO15693 + +typedef union{ + NxpNci_RfIntf_info_APP_t NFC_APP; + NxpNci_RfIntf_info_BPP_t NFC_BPP; + NxpNci_RfIntf_info_FPP_t NFC_FPP; + NxpNci_RfIntf_info_VPP_t NFC_VPP; +} NxpNci_RfIntf_Info_t; + +typedef struct{ + unsigned char Interface; + unsigned char Protocol; + unsigned char ModeTech; + NxpNci_RfIntf_Info_t Info; +} NxpNci_RfIntf_t; // Definition of discovered remote device properties + +#endif diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Settings.h b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Settings.h new file mode 100644 index 000000000..5cadc151d --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_NFC_Settings.h @@ -0,0 +1,75 @@ +#ifndef LT_NFC_SETTINGS_H +#define LT_NFC_SETTINGS_H + +#define NXPNCI_I2C_ADDR 0x28 +#define MAX_NCI_FRAME_SIZE 258 +#define TIMEOUT_COMMAND 1000 +#define TIMEOUT_DISCOVERY 200 +#define TIMEOUT_EXT 100 + +// NCI standard dedicated settings +// Refer to NFC Forum NCI standard for more details +const unsigned char NxpNci_CORE_CONF[]={0x20, 0x02, 0x05, 0x01, /* CORE_SET_CONFIG_CMD */ + 0x00, 0x02, 0x00, 0x01 /* TOTAL_DURATION */ +}; + +// NXP-NCI extension dedicated setting +// Refer to NFC controller User Manual for more details +const unsigned char NxpNci_CORE_CONF_EXTN[]={0x20, 0x02, 0x0D, 0x03, /* CORE_SET_CONFIG_CMD */ + 0xA0, 0x40, 0x01, 0x00, /* TAG_DETECTOR_CFG */ + 0xA0, 0x41, 0x01, 0x04, /* TAG_DETECTOR_THRESHOLD_CFG */ + 0xA0, 0x43, 0x01, 0x00 /* TAG_DETECTOR_FALLBACK_CNT_CFG */ +}; + +// NXP-NCI standby enable setting +// Refer to NFC controller User Manual for more details +const unsigned char NxpNci_CORE_STANDBY[]={0x2F, 0x00, 0x01, 0x01}; /* last byte indicates enable/disable */ + +// NXP-NCI CLOCK configuration +// Refer to NFC controller Hardware Design Guide document for more details +// Xtal configuration +const unsigned char NxpNci_CLK_CONF[]={0x20, 0x02, 0x05, 0x01, /* CORE_SET_CONFIG_CMD */ + 0xA0, 0x03, 0x01, 0x08 /* CLOCK_SEL_CFG */ +}; + +// NXP-NCI TVDD configuration +// Refer to NFC controller Hardware Design Guide document for more details +// CFG2: external 5V is used to generate the VDD(TX) through TXLDO +const unsigned char NxpNci_TVDD_CONF_2ndGen[]={0x20, 0x02, 0x07, 0x01, 0xA0, 0x0E, 0x03, 0x06, 0x64, 0x00}; + +// RF configuration related to 2nd generation of NXP-NCI controller (e.g PN7150) +// Following configuration relates to performance optimization of OM5578/PN7150 NFC Controller demo kit +const unsigned char NxpNci_RF_CONF_2ndGen[]={0x20, 0x02, 0xA3, 0x13, + 0xA0, 0x0D, 0x06, 0x04, 0x35, 0x90, 0x01, 0xF4, 0x01, /* RF_CLIF_CFG_INITIATOR CLIF_AGC_INPUT_REG */ + 0xA0, 0x0D, 0x06, 0x06, 0x44, 0x01, 0x90, 0x03, 0x00, /* RF_CLIF_CFG_TARGET CLIF_ANA_RX_REG */ + 0xA0, 0x0D, 0x06, 0x06, 0x30, 0xB0, 0x01, 0x10, 0x00, /* RF_CLIF_CFG_TARGET CLIF_SIGPRO_ADCBCM_THRESHOLD_REG */ + 0xA0, 0x0D, 0x06, 0x06, 0x42, 0x02, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_TARGET CLIF_ANA_TX_AMPLITUDE_REG */ + 0xA0, 0x0D, 0x03, 0x06, 0x3F, 0x04, /* RF_CLIF_CFG_TARGET CLIF_TEST_CONTROL_REG */ + 0xA0, 0x0D, 0x06, 0x20, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_TECHNO_I_TX15693 CLIF_ANA_TX_AMPLITUDE_REG */ + 0xA0, 0x0D, 0x04, 0x22, 0x44, 0x22, 0x00, /* RF_CLIF_CFG_TECHNO_I_RX15693 CLIF_ANA_RX_REG */ + 0xA0, 0x0D, 0x06, 0x22, 0x2D, 0x50, 0x34, 0x0C, 0x00, /* RF_CLIF_CFG_TECHNO_I_RX15693 CLIF_SIGPRO_RM_CONFIG1_REG */ + 0xA0, 0x0D, 0x06, 0x32, 0x42, 0xF8, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_106_I_TXA CLIF_ANA_TX_AMPLITUDE_REG */ + 0xA0, 0x0D, 0x06, 0x34, 0x2D, 0x24, 0x37, 0x0C, 0x00, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_SIGPRO_RM_CONFIG1_REG */ + 0xA0, 0x0D, 0x06, 0x34, 0x33, 0x86, 0x80, 0x00, 0x70, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_AGC_CONFIG0_REG */ + 0xA0, 0x0D, 0x04, 0x34, 0x44, 0x22, 0x00, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_ANA_RX_REG */ + 0xA0, 0x0D, 0x06, 0x42, 0x2D, 0x15, 0x45, 0x0D, 0x00, /* RF_CLIF_CFG_BR_848_I_RXA CLIF_SIGPRO_RM_CONFIG1_REG */ + 0xA0, 0x0D, 0x04, 0x46, 0x44, 0x22, 0x00, /* RF_CLIF_CFG_BR_106_I_RXB CLIF_ANA_RX_REG */ + 0xA0, 0x0D, 0x06, 0x46, 0x2D, 0x05, 0x59, 0x0E, 0x00, /* RF_CLIF_CFG_BR_106_I_RXB CLIF_SIGPRO_RM_CONFIG1_REG */ + 0xA0, 0x0D, 0x06, 0x44, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_106_I_TXB CLIF_ANA_TX_AMPLITUDE_REG */ + 0xA0, 0x0D, 0x06, 0x56, 0x2D, 0x05, 0x9F, 0x0C, 0x00, /* RF_CLIF_CFG_BR_212_I_RXF_P CLIF_SIGPRO_RM_CONFIG1_REG */ + 0xA0, 0x0D, 0x06, 0x54, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_212_I_TXF CLIF_ANA_TX_AMPLITUDE_REG */ + 0xA0, 0x0D, 0x06, 0x0A, 0x33, 0x80, 0x86, 0x00, 0x70 /* RF_CLIF_CFG_I_ACTIVE CLIF_AGC_CONFIG0_REG */ +}; + +const unsigned char NxpNci_DiscoverMap[] = {0x21, 0x00, 0x10, 0x5, /* Discover Map Command */ + 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x3, 0x1, 0x1, 0x4, 0x1, 0x2, 0x80, 0x01, 0x80 /* DM_RW */ +}; + +const unsigned char NxpNci_StartDiscoveryChars[] = {0x21, 0x03, 0x09, 0x04, + 0x00, 0x01, /* MODE_POLL | TECH_PASSIVE_NFCA */ + 0x02, 0x01, /* MODE_POLL | TECH_PASSIVE_NFCF */ + 0x01, 0x01, /* MODE_POLL | TECH_PASSIVE_NFCB */ + 0x06, 0x01, /* MODE_POLL | TECH_PASSIVE_15693 */ +}; + +#endif diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c new file mode 100644 index 000000000..2b340c535 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c @@ -0,0 +1,946 @@ +#include "LT_RFID.h" +#include "LT_NFC.h" + +#define NUM_OF_READERS 4 +#define T2T_BLOCK_SIZE 4 // tested only in NTAG216 + +#define READER_0_I2C I2C6_BASE +#define READER_0_EN_PORT GPIO_PORTK_BASE +#define READER_0_EN_PIN GPIO_PIN_1 +#define READER_0_IRQ_PORT GPIO_PORTK_BASE +#define READER_0_IRQ_PIN GPIO_PIN_2 +#define READER_1_I2C I2C6_BASE // to be changed +#define READER_1_EN_PORT GPIO_PORTK_BASE // to be changed +#define READER_1_EN_PIN GPIO_PIN_1 // to be changed +#define READER_1_IRQ_PORT GPIO_PORTK_BASE // to be changed +#define READER_1_IRQ_PIN GPIO_PIN_2 // to be changed +#define READER_2_I2C I2C6_BASE // to be changed +#define READER_2_EN_PORT GPIO_PORTK_BASE // to be changed +#define READER_2_EN_PIN GPIO_PIN_1 // to be changed +#define READER_2_IRQ_PORT GPIO_PORTK_BASE // to be changed +#define READER_2_IRQ_PIN GPIO_PIN_2 // to be changed +#define READER_3_I2C I2C6_BASE // to be changed +#define READER_3_EN_PORT GPIO_PORTK_BASE // to be changed +#define READER_3_EN_PIN GPIO_PIN_1 // to be changed +#define READER_3_IRQ_PORT GPIO_PORTK_BASE // to be changed +#define READER_3_IRQ_PIN GPIO_PIN_2 // to be changed + +bool readerInitialized[NUM_OF_READERS] = {false}; +bool readerFwVersion[NUM_OF_READERS] = {0}; + +bool SetReader(uint32_t readerID){ + switch(readerID){ + case 0: + I2C_Base = READER_0_I2C; + EN_Port = READER_0_EN_PORT; + EN_Pin = READER_0_EN_PIN; + IRQ_Port = READER_0_IRQ_PORT; + IRQ_Pin = READER_0_IRQ_PIN; + break; + case 1: + I2C_Base = READER_1_I2C; + EN_Port = READER_1_EN_PORT; + EN_Pin = READER_1_EN_PIN; + IRQ_Port = READER_1_IRQ_PORT; + IRQ_Pin = READER_1_IRQ_PIN; + break; + case 2: + I2C_Base = READER_2_I2C; + EN_Port = READER_2_EN_PORT; + EN_Pin = READER_2_EN_PIN; + IRQ_Port = READER_2_IRQ_PORT; + IRQ_Pin = READER_2_IRQ_PIN; + break; + case 3: + I2C_Base = READER_3_I2C; + EN_Port = READER_3_EN_PORT; + EN_Pin = READER_3_EN_PIN; + IRQ_Port = READER_3_IRQ_PORT; + IRQ_Pin = READER_3_IRQ_PIN; + break; + default: return false; + } + return true; +} + +RFID_RETURN_CODE RFID_Connect(uint32_t readerID){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!NFC_Connect(&readerFwVersion[readerID])) + return ERR_CONNECTION; + if(!NFC_ConfigSettings()) + return ERR_CONFIG_SETTINGS; + if(!NFC_ConfigMode()) + return ERR_CONFIG_MODE; + readerInitialized[readerID] = true; + return SUCCESS; +} + +RFID_RETURN_CODE RFID_Disconnect(uint32_t readerID){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + NFC_Disconnect(); + readerInitialized[readerID] = false; + return SUCCESS; +} + +RFID_RETURN_CODE RFID_HardReset(uint32_t readerID){ + RFID_RETURN_CODE retCode = RFID_Disconnect(readerID); + if(retCode != SUCCESS) + return retCode; + return RFID_Connect(readerID); +} + +RFID_RETURN_CODE RFID_GetFwVersion(uint32_t readerID, uint32_t *fwVersion){ + if(readerID >= NUM_OF_READERS) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + *fwVersion = readerFwVersion[readerID]; + return SUCCESS; +} + +RFID_RETURN_CODE RFID_ConfigureSettings(RFID_SERTTINGS rfidSettings){ + // to be defined + return SUCCESS; +} + +RFID_RETURN_CODE RFID_StartDiscovery(uint32_t readerID){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + if(!NFC_StartDiscovery()) + return ERR_START_DISCOVERY; + return SUCCESS; +} + +RFID_RETURN_CODE RFID_StopDiscovery(uint32_t readerID){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + if(!NFC_StopDiscovery()) + return ERR_STOP_DISCOVERY; + return SUCCESS; +} + +RFID_RETURN_CODE RFID_WaitForDiscoveryNotification(uint32_t readerID, NxpNci_RfIntf_t *tagInfo){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + uint8_t retCode = NFC_WaitForDiscoveryNotification(tagInfo); + if(retCode == 1) + return SUCCESS; + else if(retCode == 2){ + if(!NFC_StopDiscovery()) + return ERR_STOP_DISCOVERY; + if(!NFC_StartDiscovery()) + return ERR_START_DISCOVERY; + } + return TAG_NOT_DETECTED; + +} + +bool ReadISO14443_3A(uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ + uint8_t commandRead[2] = {0x30}; + uint8_t answerSize = 0; + *succeededSize = 0; + while(*succeededSize < dataSize){ + commandRead[1] = startBlock + (*succeededSize / T2T_BLOCK_SIZE); + if(!NFC_ReaderTagCmd(commandRead, sizeof(commandRead), &data[*succeededSize], &answerSize)) + return false; + if(answerSize < (T2T_BLOCK_SIZE + 1)) + return false; + if(data[*succeededSize + answerSize - 1] != 0) + return false; + *succeededSize += answerSize - 1; + } + return true; +} + +int checkPwd(uint8_t *pwd, uint8_t *PACK) +{ + uint8_t commandWrite[1 + T2T_BLOCK_SIZE] = {0x1B}; + uint8_t tmpBuf[64]; + uint8_t answerSize = 0; + uint16_t dataSize = BLOCK_SIZE; + + memcpy(&commandWrite[1], pwd, dataSize); + if(!NFC_ReaderTagCmd(commandWrite, sizeof(commandWrite), tmpBuf, &answerSize)) + return -1; + if(answerSize < 2) + return -1; + if(tmpBuf[answerSize - 1] != 0) + return -1; + if ( tmpBuf[0] != PACK[0] || tmpBuf[1] != PACK[1] )// check PACK competability + return -2; + + return 1; +} + +bool setPwdValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *newPwd ) +{ + uint8_t succeededSize, pwdAddr = 0xE5; + //if ( pwdAuth( oldPwd, BLOCK_SIZE, &succeededSize) == true) + //{ + if ( RFID_CardModeSend( readerID, tagInfo, newPwd, pwdAddr, BLOCK_SIZE, &succeededSize) == SUCCESS ) + return true; + //} + return false; +} + +bool setPACKValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *newPwd ) +{ + uint8_t succeededSize, pwdAddr = 0xE6, dataSize = 2; + + if ( RFID_CardModeSend( readerID, tagInfo, newPwd, pwdAddr, dataSize, &succeededSize) == SUCCESS ) + return true; + + return false; +} + +bool activatePwd( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t startingBlock ) +{ + uint8_t pageData[100], dataAddr = 0xE3; + uint16_t succeededSize; + if ( RFID_CardModeReceive( readerID, tagInfo, pageData, dataAddr, BLOCK_SIZE, &succeededSize ) != SUCCESS ) + return false; + pageData[3] = startingBlock; + if ( RFID_CardModeSend( readerID, tagInfo, pageData, dataAddr, BLOCK_SIZE, &succeededSize) == SUCCESS ) + return true; + return false; + +} + +bool WriteISO14443_3A(uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ + uint8_t commandWrite[2 + T2T_BLOCK_SIZE] = {0xA2}; + uint8_t tmpBuf[64]; + uint8_t answerSize = 0; + *succeededSize = 0; + while(*succeededSize < dataSize){ + commandWrite[1] = startBlock + (*succeededSize / T2T_BLOCK_SIZE); + memcpy(&commandWrite[2], &data[*succeededSize], T2T_BLOCK_SIZE); + if(!NFC_ReaderTagCmd(commandWrite, sizeof(commandWrite), tmpBuf, &answerSize)) + return false; + if(answerSize < 2) + return false; + if(tmpBuf[answerSize - 1] != 0) + return false; + *succeededSize += T2T_BLOCK_SIZE; + } + if ( ( tmpBuf[0] & 0x0A ) == 0x0A ) + return true; + return false; +} + +bool ReadISO14443_4(uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ // test + #define KEY 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + uint8_t commandAuthenticate[] = {0x40, startBlock/4, 0x10, KEY}; + uint8_t answerSize = 0; + *succeededSize = 0; + if(!NFC_ReaderTagCmd(commandAuthenticate, sizeof(commandAuthenticate), data, &answerSize)) + return false; + if(data[answerSize-1] != 0) + return false; + + + return true; +} + +bool WriteISO14443_4(uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ // test + + + return false; +} + +RFID_RETURN_CODE RFID_CardModeReceive(uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + if(dataSize == 0) + return ERR_LENGTH; + if(tagInfo->Protocol == PROT_T2T){ + if(ReadISO14443_3A(data, startBlock, dataSize, succeededSize)) + return SUCCESS; + return ERR_TAG_MEMORY_READ; + } + else if(tagInfo->Protocol == PROT_ISODEP){ + if(ReadISO14443_4(data, startBlock, dataSize, succeededSize)) + return SUCCESS; + return ERR_TAG_MEMORY_READ; + } + return UNSUPPORTED_PROTOCOL; +} + +RFID_RETURN_CODE RFID_CardModeSend(uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize){ + if(!SetReader(readerID)) + return ERR_UNDEFINED_READER; + if(!readerInitialized[readerID]) + return ERR_NOT_INITIALIZED; + if(dataSize == 0) + return ERR_LENGTH; + if(tagInfo->Protocol == PROT_T2T){ + if(WriteISO14443_3A(data, startBlock, dataSize, succeededSize)) + return SUCCESS; + return ERR_TAG_MEMORY_WRITE; + } + if(tagInfo->Protocol == PROT_ISODEP){ + if(WriteISO14443_4(data, startBlock, dataSize, succeededSize)) + return SUCCESS; + return ERR_TAG_MEMORY_WRITE; + } + return UNSUPPORTED_PROTOCOL; +} + +bool IsTagValid(uint32_t readerID, NxpNci_RfIntf_t *tagInfo){ + uint8_t data[16], tagValid; + if ( ReadValue( readerID, tagInfo, data, 29, &tagValid ) == SUCCESS ) + return (bool)tagValid; + return false; + + + +} + +uint32_t GetCounter (uint32_t readerID, NxpNci_RfIntf_t *tagInfo) +{ + uint8_t data[16]; + uint32_t counter = 0; + if ( ReadValue( readerID, &tagInfo, data, 28, &counter ) == SUCCESS ) + return counter; + return 0; +} + +uint16_t GetBlockLocation(uint16_t byte) +{ + return byte / BLOCK_SIZE; +} + +void GetBlocksToRead( uint16_t* firstBlock, uint16_t* lastBlock, uint16_t beginByte, uint16_t length) +{ + *firstBlock = (uint16_t)(beginByte / BLOCK_SIZE); + *lastBlock = (uint16_t)( ( beginByte + length - 1 ) / BLOCK_SIZE); +} + +// the function gets a value and places it into an array that can be written back to the memory +RFID_RETURN_CODE SetFieldValueIntoBlocks( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t* dataLen, uint8_t *value, uint8_t valueIndex ){ + uint16_t firstBlock, lastBlock; + RFID_RETURN_CODE retCode; + uint16_t succeededReadSize = 0; + GetBlocksToRead( &firstBlock, &lastBlock, Fields[valueIndex].fieldLocation, Fields[valueIndex].fieldLength ); + retCode = RFID_CardModeReceive( readerID, tagInfo, data, firstBlock, ( lastBlock - firstBlock + 1 ) * BLOCK_SIZE, &succeededReadSize); + *dataLen = 0; + if ( retCode == SUCCESS ) + { + //memcpy( data, dataRead, Fields[valueIndex].fieldLength ) ;//get current value of the memory + memcpy( &data[Fields[valueIndex].fieldLocation - firstBlock*BLOCK_SIZE], value, Fields[valueIndex].fieldLength ) ;// put the new value into the array + //memcpy( &data[Fields[valueIndex].fieldLocation + Fields[valueIndex].fieldLength], &dataRead[Fields[valueIndex].fieldLocation + Fields[valueIndex].fieldLength], succeededReadSize - Fields[valueIndex].fieldLocation - Fields[valueIndex].fieldLength ) ;//add the rest of the array (behind the value) + *dataLen = succeededReadSize > ( lastBlock - firstBlock + 1 ) * BLOCK_SIZE ? ( lastBlock - firstBlock + 1 ) * BLOCK_SIZE : succeededReadSize; + } + + return retCode; + +} + +RFID_RETURN_CODE WriteValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *value, uint8_t valueIndex, uint32_t valueNum ) +{ + RFID_RETURN_CODE retCode; + uint8_t dataSize; + int i; + uint8_t data[512], valueNumChar[4] = {0}; + uint16_t succeededSize = 0; + uint8_t startBlock; + if ( Fields[valueIndex].isNum == true ) + { + for ( i = Fields[valueIndex].fieldLength - 1; i >= 0 ; i-- ) + { + valueNumChar[i] = (uint8_t)valueNum; + valueNum >>= 8; + } + retCode = SetFieldValueIntoBlocks( readerID, tagInfo, data, &dataSize, valueNumChar, valueIndex); + } + else + retCode = SetFieldValueIntoBlocks( readerID, tagInfo, data, &dataSize, value, valueIndex); + if ( retCode != SUCCESS ) + return retCode; + startBlock = GetBlockLocation( Fields[valueIndex].fieldLocation ); + retCode = RFID_CardModeSend( readerID, tagInfo, data, startBlock, dataSize, &succeededSize); + return retCode; +} + +RFID_RETURN_CODE ReadValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *value, uint8_t valueIndex, uint32_t *valueNum ) +{ + RFID_RETURN_CODE retCode; + uint8_t i, data[512]; + uint16_t succeededSize = 0; + uint8_t startBlock = GetBlockLocation( Fields[valueIndex].fieldLocation ); + retCode = RFID_CardModeReceive( readerID, tagInfo, data, startBlock, Fields[valueIndex].fieldLength + BLOCK_SIZE, &succeededSize); + if ( retCode != SUCCESS ) + return retCode; + memcpy( value, &data[ Fields[valueIndex].fieldLocation % BLOCK_SIZE], Fields[valueIndex].fieldLength ) ; + if ( Fields[valueIndex].isNum == true ) + { + *valueNum = 0; + for ( i = 0; i < Fields[valueIndex].fieldLength; i++ ) + { + *valueNum += value[i]; + if ( i < Fields[valueIndex].fieldLength - 1 ) + *valueNum <<= 8; + } + } + return retCode; +} + +RFID_RETURN_CODE getUID( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid ) +{ + RFID_RETURN_CODE retCode = 0; + uint16_t succeededSize = 0, block = 0, bytes = 7; + uint8_t data[512]; + retCode = RFID_CardModeReceive( readerID, tagInfo, data, block, bytes, &succeededSize); + if ( retCode != SUCCESS ) + return retCode; + memcpy( uid, &data[0], 3 ) ;//first 3 bytes of block 0 + memcpy( &uid[3], &data[4], 4 ) ;//all 4 bytes of block 1 + return retCode; +} + +RFID_RETURN_CODE getPwd( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *pwd ) +{ + RFID_RETURN_CODE retCode = 0; + uint16_t succeededSize = 0, block = 230, bytes = 4; + retCode = RFID_CardModeReceive( readerID, tagInfo, pwd, block, bytes, &succeededSize); + if ( retCode != SUCCESS ) + return retCode; + return retCode; +} + +void InitFields() +{ + //serial + Fields[0].fieldLocation = 16; + Fields[0].fieldLength = 16; + Fields[0].isNum = false; + + //factory ID + Fields[1].fieldLocation = 32; + Fields[1].fieldLength = 3; + Fields[1].isNum = false; + //filling system ID + Fields[2].fieldLocation = 35; + Fields[2].fieldLength = 2; + Fields[2].isNum = true; + //work order + Fields[3].fieldLocation = 37; + Fields[3].fieldLength = 10; + Fields[3].isNum = false; + //color name + Fields[4].fieldLocation = 47; + Fields[4].fieldLength = 12; + Fields[4].isNum = false; + //category + Fields[5].fieldLocation = 59; + Fields[5].fieldLength = 2; + Fields[5].isNum = false; + //type + Fields[6].fieldLocation = 61; + Fields[6].fieldLength = 4; + Fields[6].isNum = true; + //cartSize + Fields[7].fieldLocation = 65; + Fields[7].fieldLength = 4; + Fields[7].isNum = true; + //inkVolume + Fields[8].fieldLocation = 69; + Fields[8].fieldLength = 4; + Fields[8].isNum = true; + //inkBatch + Fields[9].fieldLocation = 73; + Fields[9].fieldLength = 10; + Fields[9].isNum = false; + //inkMfgDate + Fields[10].fieldLocation = 83; + Fields[10].fieldLength = 8; + Fields[10].isNum = false; + //inkEolDate + Fields[11].fieldLocation = 91; + Fields[11].fieldLength = 8; + Fields[11].isNum = false; + //CartFillDate + Fields[12].fieldLocation = 99; + Fields[12].fieldLength = 8; + Fields[12].isNum = false; + //WasteFillDate + Fields[13].fieldLocation = 128; + Fields[13].fieldLength = 8; + Fields[13].isNum = false; + //Misc + Fields[14].fieldLocation = 136; + Fields[14].fieldLength = 4; + Fields[14].isNum = true; + //pluginCounter + Fields[15].fieldLocation = 140; + Fields[15].fieldLength = 2; + Fields[15].isNum = true; + //inkFill + Fields[16].fieldLocation = 142; + Fields[16].fieldLength = 1; + Fields[16].isNum = true; + //inkUsed + Fields[17].fieldLocation = 143; + Fields[17].fieldLength = 1; + Fields[17].isNum = true; + //inkEmpty + Fields[18].fieldLocation = 144; + Fields[18].fieldLength = 1; + Fields[18].isNum = true; + //wasteEmpty + Fields[19].fieldLocation = 145; + Fields[19].fieldLength = 1; + Fields[19].isNum = true; + //wasteFilling + Fields[20].fieldLocation = 146; + Fields[20].fieldLength = 1; + Fields[20].isNum = true; + //wasteFull + Fields[21].fieldLocation = 147; + Fields[21].fieldLength = 1; + Fields[21].isNum = true; + //blocked + Fields[22].fieldLocation = 148; + Fields[22].fieldLength = 1; + Fields[22].isNum = true; + //fail + Fields[23].fieldLocation = 149; + Fields[23].fieldLength = 1; + Fields[23].isNum = true; + //wasteCounter + Fields[24].fieldLocation = 150; + Fields[24].fieldLength = 2; + Fields[24].isNum = true; + //MachineIdInl + Fields[25].fieldLocation = 152; + Fields[25].fieldLength = 16; + Fields[25].isNum = false; + //MachineIdWst + Fields[26].fieldLocation = 168; + Fields[26].fieldLength = 16; + Fields[26].isNum = false; + //reserved + Fields[27].fieldLocation = 184; + Fields[27].fieldLength = 16; + Fields[27].isNum = false; + //counter + Fields[28].fieldLocation = 197; + Fields[28].fieldLength = 4; + Fields[28].isNum = true; + //tagValid + Fields[29].fieldLocation = 201; + Fields[29].fieldLength = 1; + Fields[29].isNum = true; + //hash + Fields[30].fieldLocation = 202; + Fields[30].fieldLength = 16; + Fields[30].isNum = false; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//MD5 +/* Constants for MD5Transform routine. + */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform( uint32_t State[4], uint8_t Block[64] ); +static void Encode( uint8_t *, uint32_t *, uint32_t ); +static void Decode( uint32_t *, uint8_t *, uint32_t ); + +static uint8_t PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. */ +/* Rotation is separate from addition to prevent recomputation. */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* + * MD5Init() + * MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void MD5Init( MD5_CTX *context ) +{ + context->count[0] = context->count[1] = 0; + + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* + * MD5Update() + * + * MD5 block update operation. Continues an MD5 message-digest + * operation, processing another message block, and updating the + * context. + */ +void MD5Update( MD5_CTX *context, uint8_t *input, uint32_t inputLen) +{ + uint32_t i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (uint32_t)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if( (context->count[0]+=((uint32_t)inputLen << 3)) < ((uint32_t)inputLen << 3) ) + context->count[1]++; + context->count[1] += ((uint32_t)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. */ + if( inputLen >= partLen ) + { + memcpy((uint8_t *)&context->buffer[index], (uint8_t *)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + memcpy((uint8_t *)&context->buffer[index],(uint8_t *)&input[i],inputLen-i); +} + + +/* + * MD5Final() + * + * MD5 finalization. Ends an MD5 message-digest operation, writing the + * the message digest and zeroizing the context. + */ +void MD5Final( uint8_t digest[16], MD5_CTX *context ) +{ + uint8_t bits[8]; + uint32_t index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + index = (uint32_t)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); + + /* Store state in digest */ + Encode( digest, context->state, 16 ); + + /* Zeroize sensitive information. */ + //mmZeroInit( (uint8_t *)context, sizeof(*context) ); + memset( (uint8_t *)context, 0, sizeof(*context)); +} + + +/* + * MD5Transform() + * + * MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform( uint32_t state[4], uint8_t block[64] ) +{ + uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + //mmZeroInit( (uint8_t *)x, sizeof(x) ); + memset( (uint8_t *)x, 0, sizeof(x) ); +} + +/* + * Encode() + * + * Encodes input (uint32_t) into output (uint8_t). Assumes len is + * a multiple of 4. + */ +static void Encode( uint8_t *output, uint32_t *input, uint32_t len) +{ + uint32_t i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + { + output[j] = (uint8_t)(input[i] & 0xff); + output[j+1] = (uint8_t)((input[i] >> 8) & 0xff); + output[j+2] = (uint8_t)((input[i] >> 16) & 0xff); + output[j+3] = (uint8_t)((input[i] >> 24) & 0xff); + } +} + +/* + * Decode() + * + * Decodes input (uint8_t) into output (uint32_t). Assumes len is + * a multiple of 4. + */ +static void Decode( uint32_t *output, uint8_t *input, uint32_t len ) +{ + uint32_t i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | + (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void calcHash( uint8_t *input, uint16_t inputLen, uint8_t *output ) +{ + MD5_CTX context; + //uint8_t md5Val[16] = {0}; + MD5Init( &context ); + MD5Update( &context, input, inputLen); + MD5Final( output, &context); +} + +bool setHashValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid, uint16_t inputLen ) +{ + RFID_RETURN_CODE retCode; + uint8_t hashValue[16], dummy = 0; + calcHash( uid, inputLen, hashValue); + retCode = WriteValue( readerID, tagInfo, hashValue, 30, dummy ); + if ( retCode == SUCCESS ) + return true; + return false; +} + +int checkHashValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid, uint16_t inputLen ) +{ + RFID_RETURN_CODE retCode; + uint8_t i, hashValueCalc[16], hashValueOnTag[16], dummy = 0; + int ret; + calcHash( uid, inputLen, hashValueCalc); + retCode = ReadValue( readerID, tagInfo, hashValueOnTag, 30, &dummy ); + if ( retCode == SUCCESS ) + { + for ( i = 0; i < 7; i++ ) + { + if ( hashValueCalc[i] != hashValueOnTag[i] ) + { + setTagInvalidAndLock( readerID, tagInfo ); + return -1; + } + + } + return 1; + } + return -2; +} + +bool lockDataSetOnInit( uint32_t readerID, NxpNci_RfIntf_t *tagInfo ) +{ + RFID_RETURN_CODE retCode; + uint16_t succeededSize = 0; + uint8_t block = 2, data[16]; + + retCode = RFID_CardModeReceive( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize); + if ( retCode == SUCCESS ) + { + data[2] = 0xFF; + data[3] = 0xFF; + retCode = RFID_CardModeSend( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize);//lock blocks 3 - 15 + if ( retCode == SUCCESS ) + { + block = 0xE2; + retCode = RFID_CardModeReceive( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize); + if ( retCode == SUCCESS ) + { + data[0] = 0x01;//lock pages 16 - 31 + retCode = RFID_CardModeSend( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize);//lock blocks 16 - 31 + if ( retCode == SUCCESS ) + { + return true; + } + } + + } + + } + return false; +} + +bool setTagInvalidAndLock( uint32_t readerID, NxpNci_RfIntf_t *tagInfo ) +{ + RFID_RETURN_CODE retCode; + uint16_t succeededSize = 0; + uint8_t block = 0xE2, data[16], tagValid = 0; + //set TagValid = 0 + retCode = WriteValue( readerID, tagInfo, data, 29, tagValid ); + //lock page 50, pages 48 - 63 (bit 02 of byte 1) + retCode = RFID_CardModeReceive( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize); + if ( retCode == SUCCESS ) + { + retCode = RFID_CardModeReceive( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize); + if ( retCode == SUCCESS ) + { + data[0] |= 0x08;//lock pages 48 - 63 (bit 02 of byte 1) + retCode = RFID_CardModeSend( readerID, tagInfo, data, block, BLOCK_SIZE, &succeededSize); + if ( retCode == SUCCESS ) + { + return true; + } + } + + } + return false; +} + +int incrementCounterAndCompare( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, int limit ) +{ + RFID_RETURN_CODE retCode; + uint16_t succeededSize = 0; + uint32_t counter; + uint8_t tagMemory[1024]; + retCode = ReadValue( readerID, tagInfo, tagMemory, 28, &counter ); + if ( retCode != SUCCESS ) + return -2; + if ( counter >= limit ) + return -1; + counter++; + retCode = WriteValue( readerID, tagInfo, tagMemory, 28, counter ); + if ( retCode != SUCCESS ) + return -2; + return 1; +} + diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.h b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.h new file mode 100644 index 000000000..315831f91 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.h @@ -0,0 +1,97 @@ +#ifndef LT_RFID_H +#define LT_RFID_H + +#include "include.h" +#include "LT_NFC_Info.h" + +typedef enum { + SUCCESS = 0, + ERR_UNDEFINED_READER, + ERR_NOT_INITIALIZED, + ERR_CONNECTION, + ERR_CONFIG_SETTINGS, + ERR_CONFIG_MODE, + ERR_START_DISCOVERY, + ERR_STOP_DISCOVERY, + ERR_LENGTH, + ERR_TAG_MEMORY_READ, + ERR_TAG_MEMORY_WRITE, + TAG_NOT_DETECTED, + UNSUPPORTED_PROTOCOL +} RFID_RETURN_CODE; + +#define CCM_LOOP_TIMEOUT 500000 + +/* +volatile bool g_bContextReadyFlag; +volatile bool g_bParthashReadyFlag; +volatile bool g_bInputReadyFlag; +volatile bool g_bOutputReadyFlag; +volatile bool g_bContextInDMADoneFlag; +volatile bool g_bDataInDMADoneFlag; +volatile bool g_bContextOutDMADoneFlag; +*/ + +/* MD5 context. */ +typedef struct { + uint32_t state[4]; /* state (ABCD) */ + uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +#define BLOCK_SIZE 4 +#define BLK_TAG_VALID 49 +#define BLK_COUNTER 48 +#define NUMBER_OF_FIELDS 32 +typedef struct{ + // to be defined +} RFID_SERTTINGS; + +typedef struct{ + uint16_t fieldLocation; + uint16_t fieldLength; + bool isNum; +} FIELDS_LOCATIONS; + +FIELDS_LOCATIONS Fields[NUMBER_OF_FIELDS]; + +RFID_RETURN_CODE RFID_Connect(uint32_t readerID); +RFID_RETURN_CODE RFID_Disconnect(uint32_t readerID); +RFID_RETURN_CODE RFID_HardReset(uint32_t readerID); +RFID_RETURN_CODE RFID_GetFwVersion(uint32_t readerID, uint32_t *fwVersion); +RFID_RETURN_CODE RFID_ConfigureSettings(RFID_SERTTINGS rfidSettings); +RFID_RETURN_CODE RFID_StartDiscovery(uint32_t readerID); +RFID_RETURN_CODE RFID_StopDiscovery(uint32_t readerID); +RFID_RETURN_CODE RFID_WaitForDiscoveryNotification(uint32_t readerID, NxpNci_RfIntf_t *pRfIntf); +RFID_RETURN_CODE RFID_CardModeReceive(uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize); +RFID_RETURN_CODE RFID_CardModeSend(uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t startBlock, uint16_t dataSize, uint16_t *succeededSize); +bool IsTagValid(uint32_t readerID, NxpNci_RfIntf_t *tagInfo); +uint32_t GetCounter (uint32_t readerID, NxpNci_RfIntf_t *tagInfo); +RFID_RETURN_CODE WriteValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *value, uint8_t valueIndex, uint32_t valueNum ); +RFID_RETURN_CODE ReadValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *value, uint8_t valueIndex, uint32_t *valueNum ); +RFID_RETURN_CODE getUID( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid ); +void calcHash( uint8_t *input, uint16_t inputLen, uint8_t *output ); +bool setHashValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid, uint16_t inputLen ); +int checkHashValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *uid, uint16_t inputLen ); +RFID_RETURN_CODE getPwd( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *pwd ); +int checkPwd(uint8_t *pwd, uint8_t *PACK ); +bool setPwdValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *newPwd ); +bool setPACKValue( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *newPwd ); +bool activatePwd( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t startingBlock ); +bool lockDataSetOnInit( uint32_t readerID, NxpNci_RfIntf_t *tagInfo ); +bool setTagInvalidAndLock( uint32_t readerID, NxpNci_RfIntf_t *tagInfo ); +int incrementCounterAndCompare( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, int limit ); +///////////////////////////////////////////////////////////////////////////////////// +void MD5Init( MD5_CTX * ); +void MD5Update( MD5_CTX *, unsigned char *, unsigned int ); +void MD5Final( unsigned char results[16], MD5_CTX * ); + +////////////////////////////////////// +// helpers +void InitFields(); +void SetFieldsLocationLen(); +uint16_t GetBlockLocation(uint16_t byte); +void GetBlocksToRead( uint16_t* firstBlock, uint16_t* lastBlock, uint16_t beginByte, uint16_t length); +RFID_RETURN_CODE SetFieldValueIntoBlocks( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, uint8_t *data, uint8_t* dataLen, uint8_t *value, uint8_t valueIndex ); +///////////////////////////////////// +#endif diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index 8cdb27e47..1f8651545 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -169,7 +169,7 @@ Program.global.adcProcess = Task.create("&ADCProcessTask", ADCProcessTaskParams) var ReportTaskParams = new Task.Params(); ReportTaskParams.instance.name = "report"; -ReportTaskParams.stackSize = 2048; +ReportTaskParams.stackSize = 4096; ReportTaskParams.priority = 7; Program.global.report = Task.create("&reportService", ReportTaskParams); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 44caacc55..6d5dc00b2 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -215,21 +215,21 @@ AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ /* 7006 */ {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_7_OVERPRESSURE}, /* 7007 */ {eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_8_OVERPRESSURE}, -/* 8000 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_1_LOW_LEVEL}, -/* 8001 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_2_LOW_LEVEL}, -/* 8002 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_3_LOW_LEVEL}, -/* 8003 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_4_LOW_LEVEL}, -/* 8004 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_5_LOW_LEVEL}, -/* 8005 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_6_LOW_LEVEL}, -/* 8006 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_7_LOW_LEVEL}, -/* 8007 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,500/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_8_LOW_LEVEL}, +/* 8000 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_1_LOW_LEVEL}, +/* 8001 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_2_LOW_LEVEL}, +/* 8002 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_3_LOW_LEVEL}, +/* 8003 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_4_LOW_LEVEL}, +/* 8004 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_5_LOW_LEVEL}, +/* 8005 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_6_LOW_LEVEL}, +/* 8006 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_7_LOW_LEVEL}, +/* 8007 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,300/*300cc*/,false,DEBUG_LOG_CATEGORY__Warning, 0xFF,2,EVENT_TYPE__MID_TANK_8_LOW_LEVEL}, /* 8008 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_1_EMPTY}, /* 8009 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_2_EMPTY}, /* 8010 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_3_EMPTY}, /* 8011 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_4_EMPTY}, /* 8012 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_5_EMPTY}, /* 8013 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_6_EMPTY}, -/* 8014 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_7_EMPTY}, +/* 8014 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_7_EMPTY}, /* 8015 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,200/*200cc*/,false,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_8_EMPTY}, /* 8016 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_1_OVERFLOW}, @@ -238,7 +238,7 @@ AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={ /* 8019 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_4_OVERFLOW}, /* 8020 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_5_OVERFLOW}, /* 8021 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,5,5,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_6_OVERFLOW}, -/* 8022 */ //{eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_7_OVERFLOW}, +/* 8022 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,6,6,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_7_OVERFLOW}, /* 8023 */ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,1800/*1800cc*/,true,DEBUG_LOG_CATEGORY__Error, 0xFF,2,EVENT_TYPE__MID_TANK_8_OVERFLOW}, @@ -989,7 +989,8 @@ uint32_t AlarmHandlingLoop(uint32_t tick) { int Alarm_i; uint32_t value; - uint32_t valueL; + double doubleValue = 0.0; +/* uint32_t valueL; uint32_t valueR; uint32_t valueN; uint32_t drawer_big; @@ -997,8 +998,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) uint32_t drawer_small1; uint32_t drawer_small2; uint32_t drawer_small3; - - double doubleValue = 0.0; +*/ @@ -1126,6 +1126,11 @@ uint32_t AlarmHandlingLoop(uint32_t tick) case ALARM_SOURCE_TYPE__MotorAlarm: if (CheckMotorAlarms) { + if (FPGA_WD_Occurred == true) + { + Status = false; + break; + } if (isMotorConfigured((TimerMotors_t)AlarmItem[Alarm_i].DeviceId) == false) { Status = false; @@ -1189,12 +1194,12 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (AlarmItem[Alarm_i].Severity == DEBUG_LOG_CATEGORY__Critical ) { value = getSystemFansStatus(); - valueR = value & MASKSYSTEMRIGHT; +/* valueR = value & MASKSYSTEMRIGHT; valueL = value & MASKSYSTEMLEFT; valueN = value & MASKSYSTEMnotUSED; - /*if (valueR) + if (valueR) ReportWithPackageFilter(AlarmFilter,"----------- Right FAN System is not connected----------------", __FILE__,__LINE__,valueR, RpMessage, value, 0); else ReportWithPackageFilter(AlarmFilter,"----------- Right FAN System is connected----------------", __FILE__,__LINE__,valueR, RpMessage, value, 0); @@ -1217,12 +1222,12 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (AlarmItem[Alarm_i].Severity == DEBUG_LOG_CATEGORY__Critical ) { value = getDrawerFansStatus(); - drawer_big = value & MASKDRYERBIG; +/* drawer_big = value & MASKDRYERBIG; drawer_small0 = value & MASKDRYERSMALL0; drawer_small1 = value & MASKDRYERSMALL1; drawer_small2 = value & MASKDRYERSMALL2; drawer_small3 = value & MASKDRYERSMALL3; -/* + if (drawer_big) ReportWithPackageFilter(AlarmFilter,"----------- drawer_big FAN is not connected----------------", __FILE__,__LINE__,drawer_big, RpMessage, value, 0); else diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 28febe8f2..2f4a1e2d2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -41,6 +41,7 @@ #include "Drivers/I2C_Communication/I2C.h" #include "modules/thread/thread_ex.h" +#include "modules/ifs/ifs.h" #include "modules/ids/ids_ex.h" #include "modules/Diagnostics/Diagnostics.h" #include "Modules/General/MachineStatus.h" @@ -662,6 +663,7 @@ uint32_t MillisecLowLoop(uint32_t tick) PumpActivation(900); PumpCounter = 0; } + MidTankReading(); } //ROM_IntMasterEnable(); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index b7d117efe..1f5e008d3 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -172,6 +172,8 @@ uint32_t ControlActivityLed( uint32_t Parameter1) ACTIVITY_GREEN_LED_ON; HWConfigurationInit(); } + else + ACTIVITY_GREEN_LED_OFF; if(power.color == fastBILNK) Pannel_Leds(POWER_ON_OFF,MODE_OFF); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index 497556878..38f9b73ba 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -58,7 +58,7 @@ return OK; uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) { uint32_t numberOfSteps = 0; - uint32_t LoadArmRounds = 0; + uint32_t LoadArmRounds = (int)dryerbufferlength; MessageContainer responseContainer; @@ -67,14 +67,8 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT; TimerMotors_t MotorId = (TimerMotors_t)request->motortype; - - if (dryerbufferlength) - LoadArmRounds = (int)dryerbufferlength; - else - MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds); - if (LoadArmRounds <= 2) - LoadArmRounds = 20; + LoadArmRounds = 30; int speed = request->speed; if (speed == 0) speed = 150; @@ -96,8 +90,11 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) { numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius; Report("MotorHomingRequestFunc Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,numberOfSteps,RpMessage,LoadArmRounds,0); - MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), - numberOfSteps, MotorHomingRequestCallback,1000); + MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, MotorHomingRequestCallback,0,1000); + + //MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), + // numberOfSteps, MotorHomingRequestCallback,1000); return OK; } if ( Motor_Id_to_LS_IdDown[MotorId] != MAX_GPI) @@ -120,7 +117,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) if(MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM) { if (LoadArmRounds <= 2) - LoadArmRounds = 20; + LoadArmRounds = 30; numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius; numberOfSteps -= 100; diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 40bc50b4f..fab62d6ee 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -184,7 +184,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters->has_dispenserbuildpressurelimit = true; EmbeddedParameters->dispenserbuildpressurelimit=1.0 ; EmbeddedParameters->has_dispenserbuildpressuretimeout = true; - EmbeddedParameters->dispenserbuildpressuretimeout=60000; + EmbeddedParameters->dispenserbuildpressuretimeout=150000; EmbeddedParameters->has_dispenserbuildpressurelag = true; EmbeddedParameters->dispenserbuildpressurelag=50; EmbeddedParameters->has_acheatersloweroperationlimit = true; @@ -212,7 +212,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters->generalparameters[4] = 800.0; //Winder homing time at end of job EmbeddedParameters->generalparameters[5] = 1000.0; //Dispenser initial pressure speed EmbeddedParameters->generalparameters[6] = Diagnostic_Extended_Mode; //Diagnostic Mode SetDiagnosticMode - EmbeddedParameters->generalparameters[7] = AutoHoming_PowerOn_off; // + EmbeddedParameters->generalparameters[7] = AutoHoming_JobEnd_PowerOn_off; // } EmbeddedParameters->has_currentalarmlowlimit = true; EmbeddedParameters->currentalarmlowlimit = 0.78; @@ -295,7 +295,7 @@ uint32_t EmbeddedParametersInit(void) } else { - IDS_Dispenser_SetBackLashValues(EmbeddedParameters->initialdispenserpressure, EmbeddedParameters->initialdispensertimeout, EmbeddedParameters->initialdispensertimelag,900); + IDS_Dispenser_SetBackLashValues(EmbeddedParameters->initialdispenserpressure, EmbeddedParameters->initialdispensertimeout, EmbeddedParameters->initialdispensertimelag,1000); } IDS_Dispenser_SetTimeOutValues(EmbeddedParameters->closevalvetimeout, EmbeddedParameters->openvalvetimeout); @@ -437,6 +437,8 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) { for (Dispenser_i = 0; Dispenser_i < request->n_dispensers ; Dispenser_i++) { + Valve_Set(IDS_Id_to_AirValve[Dispenser_i], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON + Valve_Set(IDS_Id_to_CartrideValve[Dispenser_i], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON status += DispenserConfigMessage(request->dispensers[Dispenser_i]); if (Check_Dispenser_Type(request->dispensers[Dispenser_i]->index) == LS_STATUS_ERROR) { @@ -565,12 +567,13 @@ uint32_t MidTankDataSetupFunc(MessageContainer* requestContainer) Report("MidTankData Read", __FILE__,__LINE__,(int)(a*1000), RpMessage, (int)(b*1000), 0); } //debug only + /* Task_sleep(1000); MCU_E2PromSerialNumProgram ("Take me to the sky"); memset (Serial,0,20); MCU_E2PromSerialNumRead(&Serial); Report(Serial, __FILE__,__LINE__,22, RpMessage, 21, 0); - + */ MidTankDataSetupResponse response = MID_TANK_DATA_SETUP_RESPONSE__INIT; @@ -642,8 +645,14 @@ void HWSystemResetRequest(MessageContainer* requestContainer) uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); SendChars((char*)container_buffer, container_size); + Report("HWSystemResetRequest before sleep", __FILE__,__LINE__,0, RpMessage, 2, 0); + + //ROM_SysCtlDelay(SYS_CLK_FREQ); + Task_sleep(2000); + Report("HWSystemResetRequest after sleep", __FILE__,__LINE__,2, RpMessage, 4, 0); - ROM_SysCtlDelay(SYS_CLK_FREQ); + //ROM_SysCtlDelay(SYS_CLK_FREQ); + Task_sleep(2000); SysCtlReset(); diff --git a/Software/Embedded_SW/Embedded/Modules/General/Safety.c b/Software/Embedded_SW/Embedded/Modules/General/Safety.c index 73736f8d4..139763c75 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/Safety.c +++ b/Software/Embedded_SW/Embedded/Modules/General/Safety.c @@ -39,9 +39,10 @@ void Safety_Init(void) uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) { int Disp_i; + bool Indication = false; bool AllDispensersInSafety = true; bool AnyDispensersInSafety = false; - bool DispenserBypass = false; + //bool DispenserBypass = false; bool mDrierDoorAlarmState = false; bool mAirFlowAlarmState = false; bool mAirFilterAlarmState = false; @@ -50,8 +51,9 @@ uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag) { if (isMotorConfigured(Disp_i + HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)==true) { - AllDispensersInSafety &= Check_Disp_Safety_Stop_Indication(Disp_i); - AnyDispensersInSafety |= Check_Disp_Safety_Stop_Indication(Disp_i); + Indication = Check_Disp_Safety_Stop_Indication(Disp_i); + AllDispensersInSafety &= Indication; + AnyDispensersInSafety |= Indication; } } diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index b74ba79b3..d7de5797d 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -65,9 +65,9 @@ void HeatersStopControlOnHeatersOff(ProcessParameters* ProcessParams) REPORT_MSG(temp_sum,"Heating control off - temperatures off"); } } -uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) +uint32_t HandleProcessParameters(ProcessParameters* ProcessParams,bool saveData) { - uint32_t status = 0; + uint32_t status = 0,Bytes = 0; if (ProcessParams==NULL) { status = ERROR_CODE__INVALID_PARAMETER; @@ -89,7 +89,19 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) { memcpy (&ProcessParametersKeep,ProcessParams,sizeof(ProcessParameters)); } - if (ProcessParams->mixertemp) + if (saveData == true) + { + if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters + { + Bytes = sizeof(ProcessParameters); + FileWrite(ProcessParams,Bytes,ProcessParamsConfigPath,BIOS_WAIT_FOREVER); + EraseFlashSection(PROCESS_PARAMETERS_MAP_IN_FLASH,Bytes+4); + ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH, 4,&Bytes); + ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH+4, Bytes, ProcessParams); + REPORT_MSG(Bytes,"Bytes write to flash"); + } + } + if (ProcessParams->mixertemp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__MixerHeater, true, ProcessParams->mixertemp); @@ -97,7 +109,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__MixerHeater, false, ProcessParams->mixertemp); - if (ProcessParams->headzone1temp) + if (ProcessParams->headzone1temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, true, ProcessParams->headzone1temp); @@ -105,7 +117,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, false, ProcessParams->headzone1temp); - if (ProcessParams->headzone2temp) + if (ProcessParams->headzone2temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, true, ProcessParams->headzone2temp); @@ -113,7 +125,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, false, ProcessParams->headzone2temp); - if (ProcessParams->headzone3temp) + if (ProcessParams->headzone3temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3, true, ProcessParams->headzone3temp); @@ -121,7 +133,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3, false, ProcessParams->headzone3temp); - if (ProcessParams->headzone4temp) + if (ProcessParams->headzone4temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, true, ProcessParams->headzone4temp); @@ -129,7 +141,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, false, ProcessParams->headzone4temp); - if (ProcessParams->headzone5temp) + if (ProcessParams->headzone5temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, true, ProcessParams->headzone5temp); @@ -137,7 +149,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, false, ProcessParams->headzone5temp); - if (ProcessParams->headzone6temp) + if (ProcessParams->headzone6temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, true, ProcessParams->headzone6temp); @@ -145,7 +157,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, false, ProcessParams->headzone6temp); - if (ProcessParams->dryerzone1temp) + if (ProcessParams->dryerzone1temp>1) status |= HeaterCommandRequestMessage( HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, true, ProcessParams->dryerzone1temp); @@ -193,20 +205,9 @@ void ProcessRequestFunc(MessageContainer* requestContainer) MessageContainer responseContainer; uint8_t* container_buffer; uint32_t status = 0; - uint32_t Bytes = 0; UploadProcessParametersRequest* request = upload_process_parameters_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); ProcessParameters* ProcessParams = request->processparameters; - if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters - { - FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath,BIOS_WAIT_FOREVER); - Bytes = sizeof(ProcessParameters); - EraseFlashSection(PROCESS_PARAMETERS_MAP_IN_FLASH,Bytes+4); - ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH, 4,&Bytes); - ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH+4, Bytes, ProcessParams); - REPORT_MSG(Bytes,"Bytes write to flash"); - - } //////////////////////////////////////////////////////////////////////// /*UploadProcessParametersRequest* requesttest; uint8_t* buffer = NULL; @@ -234,7 +235,7 @@ void ProcessRequestFunc(MessageContainer* requestContainer) PowerIdleOutOfIdleState(); if (status == 0) - status = HandleProcessParameters(ProcessParams); + status = HandleProcessParameters(ProcessParams,true); if (status) { responseContainer.has_error = true; @@ -255,10 +256,9 @@ uint32_t LoadProcessParamsFromFile(void) Fresult = FileRead(ProcessParamsConfigPath, &Bytes, &buffer); if (Fresult == FR_OK) { - UploadProcessParametersRequest* request = upload_process_parameters_request__unpack(NULL, Bytes, buffer); - ProcessParameters* ProcessParams = request->processparameters; + ProcessParameters* ProcessParams = (ProcessParameters*)buffer; - if ((request!= NULL)&&(ProcessParams!=NULL)) + if (ProcessParams!=NULL) { if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters { @@ -272,7 +272,7 @@ uint32_t LoadProcessParamsFromFile(void) } else { - Report("process parameters not loaded",__FILE__,__LINE__,(int)request,RpWarning,(int)request,0); + Report("process parameters not loaded",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0); return ERROR; } } @@ -290,7 +290,7 @@ uint32_t ProcessParamsInit(void) if ((Bytes)&&(Bytes < 1000)) { ProcessParameters* ProcessParams = (ProcessParameters *)(PROCESS_PARAMETERS_MAP_IN_FLASH+4); - Fresult = HandleProcessParameters(ProcessParams); + Fresult = HandleProcessParameters(ProcessParams,false); } else { @@ -302,7 +302,7 @@ uint32_t ProcessParamsInit(void) if ((Bytes)&&(Bytes < 1000)) { ProcessParameters* ProcessParams = (ProcessParameters *)(PROCESS_PARAMETERS_MAP_IN_FLASH+4); - Fresult = HandleProcessParameters(ProcessParams); + Fresult = HandleProcessParameters(ProcessParams,false); } } } diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.h b/Software/Embedded_SW/Embedded/Modules/General/process.h index 2b02c28c7..97d28f1ef 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.h +++ b/Software/Embedded_SW/Embedded/Modules/General/process.h @@ -25,7 +25,7 @@ extern double dryerbufferCentimeters; extern ProcessParameters ProcessParametersKeep; extern void ProcessRequestFunc(MessageContainer* requestContainer); -extern uint32_t HandleProcessParameters(ProcessParameters* ProcessParams); +extern uint32_t HandleProcessParameters(ProcessParameters* ProcessParams,bool saveData); uint32_t ProcessParamsInit(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index b05f236c5..4d1fbddba 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -37,6 +37,7 @@ #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "StateMachines/Printing/PrintingSTM.h" +#include "StateMachines/Initialization/PowerIdle.h" /******************** Data Structures ********************************************/ diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index 3e2cf6ecb..eba93d445 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -12,10 +12,10 @@ extern uint32_t DispenserPrepareSpeed ; extern double DispenserPreparePressure ; extern uint32_t DispenserPrepareTimeout ; extern uint32_t DispenserPrepareTimeLag ; +extern uint32_t InitialDispenserSpeed; extern int32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS]; extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS]; -extern bool JobStartStopBackLash[MAX_SYSTEM_DISPENSERS]; extern float DispenserPressure[MAX_SYSTEM_DISPENSERS]; uint32_t DispenserConfigMessage(HardwareDispenser * request); @@ -26,6 +26,7 @@ extern bool DispensersAlarmState[ MAX_SYSTEM_DISPENSERS]; extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS]; extern bool HomingActive[MAX_SYSTEM_DISPENSERS]; +extern bool PrimingActive[MAX_SYSTEM_DISPENSERS]; uint32_t IDS_Dispenser_EmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 9c15885fc..3d1ba6e78 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -189,7 +189,7 @@ uint32_t IDS_Dispenser_Start_Motor_and_Open_Valve(int DispenserId, int MotorSpee DispenserCallback[DispenserId] = callback; TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId]; - if (CurrentDispenserSpeed[DispenserId]) //motor already running + /*if (CurrentDispenserSpeed[DispenserId]) //motor already running { MotorSetSpeed(HW_Motor_Id, MotorSpeed); CurrentDispenserSpeed[DispenserId] = MotorSpeed; @@ -200,7 +200,7 @@ uint32_t IDS_Dispenser_Start_Motor_and_Open_Valve(int DispenserId, int MotorSpee } } else - { + {*/ MotorSetSpeed(HW_Motor_Id, MotorSpeed); CurrentDispenserSpeed[DispenserId] = MotorSpeed; if (DispenserControlId[DispenserId] != 0xFF) @@ -212,7 +212,7 @@ uint32_t IDS_Dispenser_Start_Motor_and_Open_Valve(int DispenserId, int MotorSpee Report("Add control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); //else // Report("Add control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - } + //} return OK; } @@ -224,7 +224,7 @@ char DispenserStorePath[50] = "0://SysInfo//DispStor.cfg"; void IDS_Dispenser_Content_Init (void) { int i; - FRESULT Fresult = FR_OK; + //FRESULT Fresult = FR_OK; void* buffer = NULL; TimerMotors_t HW_Motor_Id; uint32_t Bytes = 0; @@ -287,7 +287,7 @@ uint16_t seconds_counter = 0; bool DispenserDataUpdated = false; uint32_t IDS_Dispenser_Store_Data (void) { - uint32_t timing = msec_millisecondCounter; + //uint32_t timing = msec_millisecondCounter; FRESULT Status = FR_OK; IDSDispenserData.n_dispenserinfo = MAX_SYSTEM_DISPENSERS; IDSDispenserData.dispenserinfo = dispenserdata; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h index ac3928c3e..9074f867a 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h @@ -68,9 +68,11 @@ uint32_t IDS_StopLubrication(void); uint32_t IDS_DispenserPidRequestMessage(HardwarePidControl* request); uint32_t IDS_DispenserControlInit(); +void IDS_Dispenser_Init(uint8_t DispenserId); uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback); uint32_t IDS_StopHomeDispenser (uint32_t deviceID); uint32_t IDS_HomeDispenserWaitForHomingEnd(uint32_t DispenserId, uint32_t timeout , callback_fptr callback); +bool IDS_IsHomingActive(uint32_t DispenserId); uint32_t IDS_EmptyDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback); uint32_t IDS_Dispenser_Alarm_On (uint8_t deviceID); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index db6184fdb..5fe02bb71 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -143,16 +143,16 @@ uint32_t IDS_HomeDispenserWaitForHomingEnd(uint32_t DispenserId, uint32_t timeo return OK; } -uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) +/*uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) { uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; - if ((GetDispenserPressure(DispenserId)>=InitialDispenserPressure)||(DispenserHomingTime[DispenserId]>InitialDispenserTimeout)||(JobStartStopBackLash[DispenserId] == true)) + if ((GetDispenserPressure(DispenserId)>=InitialDispenserPressure)||(DispenserHomingTime[DispenserId]>InitialDispenserTimeout)) { MotorStop(motorId,Hard_Hiz); CurrentDispenserSpeed[DispenserId] = 0; if (Extended_Motor_Param == true) Power_Step_01_Dispenser_Mode(DispenserId,Voltage); - MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); + //MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); HomingActive[DispenserId]= false; PrimingActive[DispenserId]= false; Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE @@ -161,8 +161,6 @@ uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Disable_MidTank_Pressure_Reading(DispenserId); - if (JobStartStopBackLash[DispenserId] == true) - JobStartStopBackLash[DispenserId] = false; Report("End backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); if (SafeRemoveControlCallback(DispenserHomingControlId[DispenserId], IDS_HomeDispenserBackMoveCallback )==OK) DispenserHomingControlId[DispenserId] = 0xFF; @@ -175,23 +173,16 @@ uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) DispenserHomingTime[DispenserId]+=InitialDispenserTimeLag; } return OK; -} +}*/ uint32_t IDS_HomeDispenserCallback(uint32_t motorId, uint32_t ReadValue) { uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; - MotorStop(motorId,Hard_Hiz); - CurrentDispenserSpeed[DispenserId] = 0; - if (Extended_Motor_Param == true) - Power_Step_01_Dispenser_Mode(DispenserId,Voltage); Read_MidTank_Pressure_Sensor(DispenserId); //close dry air valve in the dispenser - Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); - Disable_MidTank_Pressure_Reading(DispenserId); - MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); - HomingActive[DispenserId]= false; - PrimingActive[DispenserId]= false; - Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE + //Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + //Disable_MidTank_Pressure_Reading(DispenserId); + // MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); if (HomingRequestCallback[DispenserId]) { HomingRequestCallback[DispenserId](DispenserId,0); @@ -199,16 +190,31 @@ uint32_t IDS_HomeDispenserCallback(uint32_t motorId, uint32_t ReadValue) } // HomingActive[DispenserId]= false; IDS_Dispenser_RefillEnded ( DispenserId, MotorsCfg[motorId].microstep); - Report("End homing no backlash backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - /*Report("Start backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); + Report("Homing ended",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); +// DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); MotorSetDirection(motorId,MotorsCfg[motorId].directionthreadwize); Task_sleep(10); - MotorSetSpeed(motorId, InitialDispenserSpeed); - CurrentDispenserSpeed[DispenserId] = InitialDispenserSpeed;*/ +// MotorSetSpeed(motorId, InitialDispenserSpeed); + CurrentDispenserSpeed[DispenserId] = 0; +///////////////////////////////////////////////////////////// + if (Extended_Motor_Param == true) + Power_Step_01_Dispenser_Mode(DispenserId,Voltage); + //MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); + HomingActive[DispenserId]= false; + PrimingActive[DispenserId]= false; + Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE + + //close dry air valve in the dispenser + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Disable_MidTank_Pressure_Reading(DispenserId); + + //////////////////////////////////////////////////////// return OK; } - +bool IDS_IsHomingActive(uint32_t DispenserId) +{ + return HomingActive[DispenserId]; +} uint32_t IDS_HomeDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { assert(DispenserId < MAX_SYSTEM_DISPENSERS); @@ -219,11 +225,17 @@ uint32_t IDS_HomeDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr if (FPGA_Read_limit_Switches(Dispenser_Id_to_LS_Id[DispenserId]) == LIMIT) { Report("IDS_HomeDispenser - Disp is full",__FILE__,Dispenser_Id_to_LS_Id[DispenserId],(int)DispenserId,RpWarning,LIMIT,0); - return OK; + return ERROR; } if (Get_MidTank_Pressure_Sensor(DispenserId)<0.2) { - Report("IDS_HomeDispenser - Midtank is empty",__FILE__,Get_MidTank_Int1000_Sensor(DispenserId),(int)DispenserId,RpWarning,LIMIT,0); + Report("IDS_HomeDispenser - Midtank is empty",__FILE__,Get_MidTank_Int100_Sensor(DispenserId),(int)DispenserId,RpWarning,LIMIT,0); + return ERROR; + } + midTankContent = Read_MidTank_Pressure_Sensor(DispenserId); + if (midTankContent < 0.2) //midtank is empty - abort!!!! + { + Report("IDS_HomeDispenser - Mid Tank Empty!!! ",__FILE__,__LINE__,(int)(midTankContent * 1000),RpWarning,DispenserId,0); return ERROR; } //if Safety is active @@ -233,8 +245,6 @@ uint32_t IDS_HomeDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr Report("IDS_HomeDispenser - Homing/priming already active",__FILE__,HomingActive[DispenserId],(int)DispenserId,RpWarning,PrimingActive[DispenserId],0); return ERROR; } - else - HomingActive[DispenserId] = true; if (Check_Disp_Safety_Stop_Indication(DispenserId) == true) { @@ -249,62 +259,35 @@ uint32_t IDS_HomeDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; if ( Dispenser_Id_to_LS_Id[DispenserId] != MAX_GPI) { + HomingActive[DispenserId] = true; //open dispenser valve dispenser to midtank direction Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - KeepMicrostep[DispenserId] = MotorsCfg[MotorId].microstep; if (Extended_Motor_Param == true) Power_Step_01_Dispenser_Mode(DispenserId,Current); - MotorSetMicroStep(MotorId, 1); - SysCtlDelay(180000); + KeepMicrostep[DispenserId] = MotorsCfg[MotorId].microstep; + //MotorSetMicroStep(MotorId, 1); //open dry air valve in the dispenser Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_ON); Enable_MidTank_Pressure_Reading(DispenserId); - SysCtlDelay(1200000); - midTankContent = Read_MidTank_Pressure_Sensor(DispenserId); - if (midTankContent < 0.2) //midtank is empty - abort!!!! - { - Report("IDS_HomeDispenser - Mid Tank Empty!!! ",__FILE__,__LINE__,(int)(midTankContent * 1000),RpWarning,DispenserId,0); - Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); - STATUS_GREEN_LED_OFF; - STATUS_RED_LED_ON; - - return ERROR; - } IDS_Dispenser_RefillStarted(DispenserId,1); - MotorMovetoLimitSwitch (MotorId,1-MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Id[DispenserId], IDS_HomeDispenserCallback,0); - CurrentDispenserSpeed[DispenserId] = speed; + if (DispenserId== LUBRICANT_DISPENSER) + { + MotorMovetoLimitSwitch (MotorId,1-MotorsCfg[MotorId].directionthreadwize, speed/2, Dispenser_Id_to_LS_Id[DispenserId], IDS_HomeDispenserCallback,0); + CurrentDispenserSpeed[DispenserId] = speed/2; + Report("IDS_HomeDispenser ",__FILE__,__LINE__,(int)DispenserId,RpWarning,speed/2,0); + } + else + { + MotorMovetoLimitSwitch (MotorId,1-MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Id[DispenserId], IDS_HomeDispenserCallback,0); + CurrentDispenserSpeed[DispenserId] = speed; + Report("IDS_HomeDispenser ",__FILE__,__LINE__,(int)DispenserId,RpWarning,speed,0); + } CurrentDispenserSpeed[DispenserId] = (-1*CurrentDispenserSpeed[DispenserId]); - Report("IDS_HomeDispenser ",__FILE__,__LINE__,(int)DispenserId,RpWarning,speed,0); return OK; } return ERROR; } -uint32_t IDS_Dispenser_Alarm_On (uint8_t DispenserId) -{ - uint32_t status = OK; - Report("IDS_Dispenser_Alarm_On",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,0,0); - DispensersAlarmState[DispenserId] = true; - TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; - status |= MotorAbortMovetoLimitSwitch(MotorId); - Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); - Enable_MidTank_Pressure_Reading(DispenserId); - if (Extended_Motor_Param == true) - Power_Step_01_Dispenser_Mode(DispenserId,Voltage); - status |= MotorSetMicroStep(MotorId, KeepMicrostep[DispenserId]); - status |= MotorStop(DispenserId, Hard_Hiz); - CurrentDispenserSpeed[DispenserId] = 0; - JobEndReason = JOB_OUT_OF_DYE; - return status; -} -uint32_t IDS_Dispenser_Alarm_Off (uint8_t DispenserId) -{ - uint32_t status = OK; - DispensersAlarmState[DispenserId] = false; - Report("IDS_Dispenser_Alarm_Off",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,0,0); - return status; -} - uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) { assert(DispenserId < MAX_SYSTEM_DISPENSERS); @@ -323,24 +306,24 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - if (HomingActive[DispenserId] == true) +/* if (HomingActive[DispenserId] == true) { IDS_StopHomeDispenserBuildPressure(DispenserId); - } - if (PrimingActive[DispenserId] == true) + }*/ + if (HomingActive[DispenserId] == true) { if (DispenserId == LUBRICANT_DISPENSER) { Lubricant_2Way_Valve (STOP); } - PrimingActive[DispenserId] = false; - Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE - if (Extended_Motor_Param == true) - Power_Step_01_Dispenser_Mode(DispenserId,Voltage); - MotorSetMicroStep(MotorId, KeepMicrostep[DispenserId]); - CurrentDispenserSpeed[DispenserId] = 0; - CurrentDispenserSpeed[DispenserId] = 0; } + HomingActive[DispenserId] = false; + PrimingActive[DispenserId] = false; + Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE + if (Extended_Motor_Param == true) + Power_Step_01_Dispenser_Mode(DispenserId,Voltage); + //MotorSetMicroStep(MotorId, KeepMicrostep[DispenserId]); + CurrentDispenserSpeed[DispenserId] = 0; return OK; } uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) @@ -365,25 +348,15 @@ uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) //close dry air valve in the dispenser Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Disable_MidTank_Pressure_Reading(DispenserId); - CurrentDispenserSpeed[DispenserId] = 0; - if (Extended_Motor_Param == true) - Power_Step_01_Dispenser_Mode(DispenserId,Voltage); - MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); - + // MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); if (HomingRequestCallback[DispenserId]) { HomingRequestCallback[DispenserId](DispenserId,0); HomingRequestCallback[DispenserId] = NULL; } // HomingActive[DispenserId]= false; - JobStartStopBackLash[DispenserId] = false; - Report("End homing no backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - /*if (JobStartStopBackLash[DispenserId] == true) - { - JobStartStopBackLash[DispenserId] = false; - Report("End homing for job start",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - } - else + Report("End homing for job start",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); + /* else { Report("homing aborted,start backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); @@ -393,7 +366,7 @@ uint32_t IDS_StopHomeDispenserBuildPressure (uint32_t DispenserId) MotorSetSpeed(motorId, 1000); CurrentDispenserSpeed[DispenserId] = 1000; }*/ - IDS_Dispenser_RefillEnded ( DispenserId, MotorsCfg[motorId].microstep); + //IDS_Dispenser_RefillEnded ( DispenserId, MotorsCfg[motorId].microstep); return OK; } @@ -427,7 +400,7 @@ uint32_t IDS_EmptyDispenserCallback(uint32_t motorId, uint32_t ReadValue) CurrentDispenserSpeed[DispenserId] = 0; if (Extended_Motor_Param == true) Power_Step_01_Dispenser_Mode(DispenserId,Voltage); - MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); + //MotorSetMicroStep(motorId, KeepMicrostep[DispenserId]); PrimingActive[DispenserId]= false; Control_TCA9534ByPass(DispenserId,DISABLE);// use ENABLE or DISABLE if (DispenserId == LUBRICANT_DISPENSER) @@ -451,10 +424,10 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt //if (DispensersAlarmState[DispenserId] == true) // return ERROR; if ((HomingActive[DispenserId] == true)||(PrimingActive[DispenserId] == true)) + { + Report("IDS_HomeDispenser - Homing/priming already active",__FILE__,HomingActive[DispenserId],(int)DispenserId,RpWarning,PrimingActive[DispenserId],0); return ERROR; - else - PrimingActive[DispenserId] = true; - HomingRequestCallback[DispenserId] = callback; + } if (Check_Disp_Safety_Stop_Indication(DispenserId) == true) { if ((Get_Notification_Disp_Down(DispenserId) == false)||(Get_Notification_Over_Press(DispenserId) == false)) @@ -466,13 +439,15 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; if ( Dispenser_Id_to_LS_Empty_Id[DispenserId] != MAX_GPI) { + PrimingActive[DispenserId] = true; + HomingRequestCallback[DispenserId] = callback; //open dispenser valve dispenser to midtank direction Control3WayValvesWithCallback ((Valves_t)DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer if (Extended_Motor_Param == true) Power_Step_01_Dispenser_Mode(DispenserId,Current); //Valve_Set((Valves_t) request->index, Dispenser_Mixer); KeepMicrostep[DispenserId] = MotorsCfg[MotorId].microstep; - MotorSetMicroStep(MotorId, 1); + //MotorSetMicroStep(MotorId, 1); Task_sleep(100); //open dry air valve in the dispenser //Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_ON); @@ -486,3 +461,40 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt } return ERROR; } +uint32_t IDS_Dispenser_Alarm_On (uint8_t DispenserId) +{ + uint32_t status = OK; + Report("IDS_Dispenser_Alarm_On",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,0,0); + assert(DispenserId < MAX_SYSTEM_DISPENSERS); + DispensersAlarmState[DispenserId] = true; + TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; + status |= MotorAbortMovetoLimitSwitch(MotorId); + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Disable_MidTank_Pressure_Reading(DispenserId); + if (Extended_Motor_Param == true) + Power_Step_01_Dispenser_Mode(DispenserId,Voltage); + //status |= MotorSetMicroStep(MotorId, KeepMicrostep[DispenserId]); + status |= MotorStop(DispenserId, Hard_Hiz); + IDS_Dispenser_Init(DispenserId); + JobEndReason = JOB_OUT_OF_DYE; + return status; +} +uint32_t IDS_Dispenser_Alarm_Off (uint8_t DispenserId) +{ + uint32_t status = OK; + assert(DispenserId < MAX_SYSTEM_DISPENSERS); + DispensersAlarmState[DispenserId] = false; + Report("IDS_Dispenser_Alarm_Off",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,0,0); + return status; +} + +void IDS_Dispenser_Init(uint8_t DispenserId) +{ + assert(DispenserId < MAX_SYSTEM_DISPENSERS); + Report("IDS_Dispenser_Init",__FILE__,DispenserId,HomingActive[DispenserId],RpWarning,PrimingActive[DispenserId],0); + CurrentDispenserSpeed[DispenserId] = 0; + HomingActive[DispenserId]= false; + PrimingActive[DispenserId]= false; + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer +} diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 1bab2c65d..ca9a15008 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -55,10 +55,10 @@ uint32_t IDS_Valve_DistanceToSpoolReady(uint32_t deviceID, uint32_t ReadValue); uint32_t IDS_Valve_PresegmentReady(uint32_t deviceID, uint32_t ReadValue); uint32_t IDSBrushStopRestartCallback(uint32_t IfIndex, uint32_t readValue); //bool IDS_isDispenserUsedNextSegment(void *JobDetails,int DispenserId, int SegmentId); -bool JobStartStopBackLash[MAX_SYSTEM_DISPENSERS] = {false,false,false,false,false,false,false,false}; /******************** GLOBAL PARAMETERS ********************************************/ DispenserControlConfig_t DispenserControlConfig[MAX_SYSTEM_DISPENSERS]; uint32_t ControlIdtoDispenserId [MAX_SYSTEM_DISPENSERS] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; +uint32_t ControlIdtoInactiveDispenserId [MAX_SYSTEM_DISPENSERS] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; int OriginalDispenserSpd_2PPS[MAX_SYSTEM_DISPENSERS] = {0,0,0,0,0,0,0,0}; bool DispenserPreSegmentReady[MAX_SYSTEM_DISPENSERS] = {true,true,true,true,true,true,true,true}; bool DispenserSegmentReady[MAX_SYSTEM_DISPENSERS] = {true,true,true,true,true,true,true,true}; @@ -375,6 +375,22 @@ c. Go to step 2.a x Segment.BrushStopsCount. int NumOfActiveDispensers = 0; int DispenserBuildTimeCounter = 0; #define PRESSURE_READ_TIME_GAP 100 +uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) +{ + if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) + { + if ((HomingActive[DispenserId] == false)&&(PrimingActive == false)) + { + Report("Homing Inactive dispenser",__FILE__,DispenserId,HomingActive[DispenserId],RpWarning,PrimingActive[DispenserId],0); + IDS_HomeDispenser (DispenserId, 1000 , NULL); + } + else + { + Report("Inactive dispenser already homing",__FILE__,DispenserId,HomingActive[DispenserId],RpWarning,PrimingActive[DispenserId],0); + } + } + return OK; +} void DispenserPrepareReady(void) { int i; @@ -387,6 +403,17 @@ c. Go to step 2.a x Segment.BrushStopsCount. } REPORT_MSG(Module_IDS,"All Dispensers Prepare Ready"); PrepareReady(Module_IDS,ModuleDone); + for (i=0;i3.0) + { + Report("Pulling dispenser down to reduce pressure",__FILE__,DispenserId,(int)(GetDispenserPressure(DispenserId)*100),RpWarning,200,0); + MotorMove(HW_Motor_Id,1-MotorsCfg[HW_Motor_Id].directionthreadwize,200); + } + return OK; } + void IDSPrepareStart(void) { int i; @@ -545,20 +593,24 @@ c. Go to step 2.a x Segment.BrushStopsCount. } NumOfActiveDispensers = 0; + IDS_StopHomeDispenser(CLEANER_DISPENSER); for (i = 0; i < MAX_DYE_DISPENSERS; i++) { if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { - IDS_StopHomeDispenser(i); - JobStartStopBackLash[i] = true; NumOfActiveDispensers++; + if (HomingActive[i] == true) + { + Report("Stop active dispenser homing ",__FILE__,i,HomingActive[i],RpWarning,CurrentDispenserSpeed[i],0); + IDS_StopHomeDispenser(i); + } } else { - if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) + if ((HomingActive[i] == false)&&(PrimingActive == false)) { - REPORT_MSG((int)i, "Homing inactive dispenser"); - IDS_HomeDispenser (i, 1000 , NULL); + Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer } } } @@ -572,17 +624,17 @@ c. Go to step 2.a x Segment.BrushStopsCount. if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { - if (HomingActive[i] == false) + //if (HomingActive[i] == false) { - Report("Prepare Speed",__FILE__,__LINE__,i,RpWarning,(int)dispenserspeed,0); + Report("Prepare Speed",__FILE__,HomingActive[i],i,RpWarning,(int)dispenserspeed,0); MotorSetDirection((TimerMotors_t)HW_Motor_Id,MotorsCfg[HW_Motor_Id].directionthreadwize); //set the dispenser to the IDS_Dispenser_Start_Motor_and_Open_Valve(i,dispenserspeed, NULL); } - else + /*else { Report("IDSPrepare Stop Dispenser Homing",__FILE__,__LINE__,i,RpWarning,(int)HomingActive[i],0); IDS_HomeDispenserWaitForHomingEnd(i, DispenserPrepareTimeout/2 , IDSPrepareStartDispenserAfterHoming); - } + }*/ } } } @@ -890,11 +942,12 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); CurrentDispenserSpeed[Dispenser_i] = segmentfirst_speed; usnprintf(IdMessage, 80, - "WFCF Dispenser %d nl/sec %d nl/pulse %d speed %d", + "WFCF Dispenser %d nl/sec %d nl/pulse %d Pulse/sec %d speed %d", DispenserId, (int) Dispensers[Dispenser_i]->nanolitterpersecond, (int) Dispensers[Dispenser_i]->nanoliterperpulse, - (int) segmentfirst_speed); + (int) Dispensers[Dispenser_i]->pulsepersecond*1000, + (int) segmentfirst_speed*1000); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); //SendJobProgress(0.0, 0, false, IdsMessage); @@ -1159,10 +1212,11 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); CurrentDispenserSpeed[DispenserId] = segmentfirst_speed; usnprintf(IdsMessage, 80, - "Dispenser %d nl/sec %d nl/pulse %d speed %d steps %d/%d", + "Dispenser %d nl/sec %d nl/pulse %d Pulse/sec %d speed %d steps %d/%d", DispenserId, (int) Dispensers[Dispenser_i]->nanolitterpersecond, (int) Dispensers[Dispenser_i]->nanoliterperpulse, + (int) Dispensers[Dispenser_i]->pulsepersecond*1000, (int) (segmentfirst_speed*1000),Dispensers[Dispenser_i]->dispenserstepdivision,MotorsCfg[HW_Motor_Id].microstep); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); @@ -1231,6 +1285,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); + IDS_Cleaning_Stop_Cleaning_Solution(NULL); SegmentNumOfBrushStops = Segment->n_brushstops; BrushStopTime = Segment->length/SegmentNumOfBrushStops; //brushstop in meters BrushStopTime = ((BrushStopTime*100)/dyeingspeed);//brushstop in seconds @@ -1400,6 +1455,8 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) } else { + RemoveControlCallback(ControlIdtoInactiveDispenserId[Dispenser_i], IDS_Check_Pressure_Callback ); + ControlIdtoInactiveDispenserId[Dispenser_i] = 0xFF; IDS_Valve_EndValveReady(Dispenser_i,false); } diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c index fc50173fc..545495646 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c @@ -18,6 +18,7 @@ #include "include.h" #include "Modules/Waste/Waste.h" +#include "Modules/IDS/ids_ex.h" #include "Modules/IFS/ifs.h" #include "Modules/AlarmHandling/AlarmHandling.h" #include "CartridgeValidationRequest.pb-c.h" @@ -25,6 +26,7 @@ #include #include "drivers/Valves/Valve.h" #include "Modules/Waste/Waste.h" +#include "../control/control.h" bool IFS_TimeOutAlarm(bool status); bool ColorMatch(); @@ -49,8 +51,37 @@ void IFS_Init(void) }*/ +/** + * + * @brief detect cartridge INK Empty + * this function detect changes in IFS INK cartridge + * when MidTank average is bigger the 98% of midtank pressure + * the INK cartridge is empty + * @return bool ret OK = 0 , CartridgeFinished = 1 + */ +bool DetectIfCartridgeFinished(int int_MidTank_Pressure_1000) +{ +#define CartridgeFinished 1 + bool ret = OK; + static int measure_midtank[5] ; + static int count_measure_midtank = 0; + int i=0; + int sum = 0; + int average = 0; + + if ( count_measure_midtank == 5) count_measure_midtank = 0; + measure_midtank[count_measure_midtank] = int_MidTank_Pressure_1000; + count_measure_midtank += 1; + for (i=0;i<5;i++) + sum += measure_midtank[i]; + average = sum/5; + if (abs(average - int_MidTank_Pressure_1000)<10) ret = CartridgeFinished; + //if (average > (int_MidTank_Pressure_1000 * 0.98) ) ret = CartridgeFinished; + + return ret; +} @@ -99,14 +130,18 @@ WHS_sensor CartridgeInkTimeOutCallBackFunction() { WHS_sensor ret = WHS_no_event; double MidTank_Pressure = 0; + int int_MidTank_Pressure_1000 = 0; + + //Enable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); MidTank_Pressure = Read_MidTank_Pressure_Sensor(IFS_info.Ink.cart_color);// Get_MidTank_Pressure_Sensor(IFS_info.Ink.cart_color); - ReportWithPackageFilter(WasteFilter,"------------ IFS_info.Ink.time_out and Pressure -----------------", __FILE__,__LINE__,(IFS_info.Ink.time_out * SECONDS_5), RpMessage, (int)(MidTank_Pressure*1000), 0); + //Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); + int_MidTank_Pressure_1000 = ((int)(MidTank_Pressure*1000)); + ReportWithPackageFilter(WasteFilter,"------------ IFS_info.Ink.time_out and Pressure -----------------", __FILE__,__LINE__,(IFS_info.Ink.time_out * SECONDS_5), RpMessage, (int_MidTank_Pressure_1000), 0); if (IFS_info.Ink.time_out) IFS_info.Ink.time_out += 1; /*** counter ***/ -//#ifdef timeout_capacity /*** detect the MidTank capacity is full ***/ //Read_MidTank_Pressure_Sensor(IFS_info.Ink.cart_color); if (MidTank_Pressure >= IFS_info.MidTank_capacity + CARTRIDGE_CAPATICY) @@ -115,7 +150,18 @@ WHS_sensor CartridgeInkTimeOutCallBackFunction() WHS_info.event = IFS_MidTankFull; return IFS_MidTankFull; } -//#endif + + /**** detect if the MidTank_Pressure is the same, 5 times ****/ + if (DetectIfCartridgeFinished(int_MidTank_Pressure_1000)) + { + ReportWithPackageFilter(WasteFilter,"------------ INK Cartrigde is empty (by average) -----------------", __FILE__,__LINE__,(IFS_info.Ink.time_out * SECONDS_5), RpMessage, (int_MidTank_Pressure_1000), 0); + IFS_info.Ink.time_out = 0; + WHS_info.event = IFS_MidTankFull; + return IFS_MidTankFull; + } + + + /*** first TimeOut ***/ if (IFS_info.Ink.time_out == CARTRIDGE_INK_TIMEOUT) { @@ -156,36 +202,9 @@ WHS_sensor CartridgeInkTimeOutCallBackFunction() bool IFS_TimeOutAlarm(bool status) { bool ret = OK; - switch (IFS_info.Ink.cart_color) //todo enter the correct color from RFID - { - case 1 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_1_FILL_TIMEOUT, status); - break; - case 2 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_2_FILL_TIMEOUT, status); - break; - case 3 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_3_FILL_TIMEOUT, status); - break; - case 4 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_4_FILL_TIMEOUT, status); - break; - case 5 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_5_FILL_TIMEOUT, status); - break; - case 6 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_6_FILL_TIMEOUT, status); - break; - case 7 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_7_FILL_TIMEOUT, status); - break; - case 8 : - AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_8_FILL_TIMEOUT, status); - break; - default: //wrong color - ret = notOK; - break; - } + + AlarmHandlingSetAlarm( EVENT_TYPE__MID_TANK_1_FILL_TIMEOUT+IFS_info.Ink.cart_color, status); + return ret; } @@ -211,6 +230,7 @@ bool MidTankValvesAction(bool action) //Cartridge_MidTank_ON of Cartridge_MidTan { Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); } +#warning check that the dispenser is not in homing before CLOSING the air valve Valve_Set(IDS_Id_to_AirValve[IFS_info.Ink.cart_color], action ); //Atm_MidTank_OFF/ON Valve_Set(IDS_Id_to_CartrideValve[IFS_info.Ink.cart_color], action ); //Atm_MidTank_OFF/ON @@ -330,6 +350,56 @@ void ResponseDemo(int MidtankId) IFS_info.Ink.cart_color = MidtankId; WasteTankCBFunction();//call cart is ok } +uint32_t MidTankReadControlId = 0xFF; +int MidTankCounter = 0; +uint32_t MidTankCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + int MidTankOpenAir = 8; + int MidTankReadPressure = 16; + int MidTankCloseAir = 40; + int MidTankEnd = 48; + int portId; + + if (MidTankCounter >= MidTankEnd) + { + SafeRemoveControlCallback(MidTankReadControlId, MidTankCallBackFunction); + } + else if (MidTankCounter >= MidTankCloseAir) + { + //close air valve for midtank (MidTankCounter-MidTankCloseAir) + portId = (MidTankCounter - MidTankCloseAir) ; //0-7 + if (IDS_IsHomingActive(portId) == false) + { + Disable_MidTank_Pressure_Reading(portId); + Valve_Set(IDS_Id_to_AirValve[portId], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON + } + } + else if (MidTankCounter >= MidTankReadPressure) + { + //read pressure for midtank (MidTankCounter-MidTankCloseAir) + for (portId = 0;portId < MAX_SYSTEM_DISPENSERS;portId++) + { + Read_MidTank_Pressure_Sensor(portId); + } + } + else if (MidTankCounter >= MidTankOpenAir) + { + //open air valve for midtank (MidTankCounter-MidTankOpenAir) + portId = (MidTankCounter - MidTankOpenAir) ; //0-7 + Enable_MidTank_Pressure_Reading(portId); + Valve_Set(IDS_Id_to_AirValve[portId], Atm_MidTank_ON ); //Atm_MidTank_OFF/ON + } + MidTankCounter++; + return OK; +} + +uint32_t MidTankReading(void) +{ + MidTankCounter = 0; + MidTankReadControlId = AddControlCallback( MidTankCallBackFunction, 300/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); + + return OK; +} bool INKCartridgeAuthentication(cartridge_name cart_name) { diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h index a7e80a31e..11ae5b008 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h @@ -55,5 +55,6 @@ void ResponseDemo(int MidtankId); bool CartridgeValidationResponseFunc(MessageContainer* requestContainer); +uint32_t MidTankReading(void); #endif /* MODULES_IFS_IFS_H_ */ diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 3504c3134..5850ff7cf 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -15,12 +15,14 @@ #include "drivers/Heater/TemperatureSensor.h" #include "drivers/ADC_Sampling/adc.h" -#include "Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.h" +#include "Drivers/I2C_Communication/Head_Card/PT100/PT100_ADC.h" #include "Drivers/I2C_Communication/Head_Card/Fan/fan_click.h" #include "Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h" #include "drivers/Motors/Motor.h" #include "drivers/FPGA/FPGA_SPI_Comm.h" #include "Modules/IFS/ifs.h" +#include "Modules/IDS/ids_ex.h" +#include "Modules/Control/MillisecTask.h" //#include "graphics_adapter.h" extern uint8_t Input_Voltage; @@ -45,20 +47,14 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } else - if((request->amount == 0xAD) && (request->delay == 0xAD01)) //undef AUTO_HOME_DISPENSERS - { - #undef AUTO_HOME_DISPENSERS - response.progress = 01; - response.has_progress = true; - } - else - if((request->amount == 0xAD) && (request->delay == 0xAD00)) //define AUTO_HOME_DISPENSERS - { - #define AUTO_HOME_DISPENSERS - response.progress = 01; - response.has_progress = true; - } - else + if(request->amount == 0xAD) //undef AUTO_HOME_DISPENSERS + { + if ((request->delay >=AutoHoming_off )&&(request->delay<=AutoHoming_JobEnd_PowerOn_off )) + IDS_Dispenser_SetAutoHoming_Config(request->delay); + response.progress = 01; + response.has_progress = true; + } + else if((request->amount == 0x01) && ((request->delay &0x010000) == 0x010000)) //change mode powerset01 { response.progress = Power_Step_01_Mode(((request->delay &0x00FF00)>>8), request->delay &0x0000FF); @@ -167,6 +163,14 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.progress = (double)OK; response.has_progress = true; + } + else + if(request->amount == 0xE0) //fast refresh for pressure + { + setRapidPressureRead(request->delay); + response.progress = (double)OK; + 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 c5cdb00d6..5a2307384 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -18,6 +18,7 @@ #include "Modules/control/pidalgo.h" #include "Modules/heaters/heaters_ex.h" +#include "Modules/General/buttons.h" #include "StateMachines/Initialization/InitSequence.h" #include "PMR/Hardware/HardwareMotor.pb-c.h" @@ -151,7 +152,7 @@ ProcessParametersClear.headzone6temp = 0; ProcessParametersClear.dyeingspeed = 40; ProcessParametersClear.dryerbufferlength = ProcessParametersKeep.dryerbufferlength; - if (HandleProcessParameters(&ProcessParametersClear)!= OK) + if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) { LOG_ERROR (LoadStages, "Thread_Load_Init failed"); } @@ -223,7 +224,7 @@ ThreadLoadStateMachine(LoadStages); return OK; } - uint32_t Thread_Load_Set_Load_Arm_To_Start_Position(void) + /*uint32_t Thread_Load_Set_Load_Arm_To_Start_Position(void) { uint32_t numberOfSteps = 0; REPORT_MSG(LoadStages, "Thread Load State Machine step"); @@ -238,14 +239,14 @@ } else //number of circles is not known - compare to position of the motor to verify location at the stopper { - Report("Thread_Load_Set_Load_Arm_To_Start_Position unknown cycles",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); } //Use Notation How Many Rotations In The Drier, Or Check Against Stopper. Move Slowly return OK; - } + }*/ uint32_t Thread_Load_Jog_Feeder_To_Middle_Point_Callback(uint32_t deviceID, uint32_t BusyFlag) { CallbackCounter--; @@ -265,6 +266,12 @@ { if((MotorId == HARDWARE_MOTOR_TYPE__MOTO_RLOADING)||(MotorId == HARDWARE_MOTOR_TYPE__MOTO_LLOADING)) { + if(LoadStages == THREAD_LOAD_CLOSE_ROCKERS) + { + MotorMove(MotorId,MotorsCfg[MotorId].directionthreadwize,400); + Report("Move rockers further down",__FILE__,__LINE__,MotorId,RpMessage,400,0); + Task_sleep(200); + } MotorSetMicroStep(MotorId, keepmicrostep); MotorSetKvalRun(MotorId, keepkvalrun); } @@ -273,6 +280,7 @@ if (CallbackCounter) { CallbackCounter--; + load.color = BLINK; if (ReadValue != LIMIT) { //returned with a timeout @@ -284,10 +292,12 @@ { LOG_ERROR(LoadStages,"Load sequence timeout"); TimeoutsCounter = 0; + load.color = fastBILNK; } else { LoadStages++; + load.color = colorON; if (LoadStages == THREAD_LOAD_CLOSE_DANCERS) { MotorSetKvalHold(HARDWARE_MOTOR_TYPE__MOTO_RDANCER, keepkvalhold); @@ -296,6 +306,10 @@ { ThreadLoadStateMachine(LoadStages); } + else + { + load.color = fastBILNK; + } } } } @@ -334,7 +348,7 @@ CallbackCounter++; MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,15000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 600, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); return OK; } @@ -403,7 +417,7 @@ CallbackCounter++; MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 600, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); return OK; } @@ -426,7 +440,7 @@ REPORT_MSG(LoadStages, "Thread Load State Machine step"); ActivateHeadMagnet(); - if (HandleProcessParameters(&ProcessParametersRecover)!= OK) + if (HandleProcessParameters(&ProcessParametersRecover,false)!= OK) { LOG_ERROR (LoadStages, "Thread_Load_Resume_Heating failed"); } @@ -494,8 +508,8 @@ if (dryerbufferlength) LoadArmInfo.LoadArmRounds = (int)dryerbufferlength; - //if (LoadArmInfo.LoadArmRounds <= 2) - // LoadArmInfo.LoadArmRounds = 20; + if (LoadArmInfo.LoadArmRounds <= 2) + LoadArmInfo.LoadArmRounds = 30; float numberOfSteps = 0; //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 SetOriginMotorSpeed(19); @@ -591,6 +605,7 @@ MotorStopAction(HARDWARE_MOTOR_TYPE__MOTO_DH_LID); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop); LoadStages = THREAD_LOAD_INIT; + load.color = colorOFF; return OK; } uint32_t Thread_Load_Dryer_UnLoading(void) @@ -664,7 +679,8 @@ //Keep Notation How Many Rotations In The Dryer LoadArmInfo.LoadArmBackLash = 5; LoadArmInfo.LoadArmRounds = (int)dryerbufferlength; - //FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); + FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); + load.color = BLINK; return OK; } @@ -825,6 +841,35 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } + if (index == POOLER_MOTOR) + { + if ((TranslatedReadValue)<(-1200)) + { + if(PullerControlId != 0xFF) + { + Report("Puller stoped",__FILE__,__LINE__,ReadValue,RpWarning,(int)DancersCfg[DancerId].zeropoint,0); + MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); + RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction ); + PullerControlId = 0xFF; + } + } + + } + if (index == WINDER_MOTOR) + { + if ((TranslatedReadValue)<(-1200)) + { + if(WinderControlId != 0xFF) + { + Report("Winder stoped",__FILE__,__LINE__,ReadValue,RpWarning,(int)DancersCfg[DancerId].zeropoint,0); + MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz); + RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction ); + WinderControlId = 0xFF; + } + + } + + } /* LoadCounter++; if ((LoadCounter % 5001) == 0) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index a93387e0a..741fed7af 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -66,6 +66,7 @@ InternalWinderConfigStruc InternalWinderCfg = {0}; #ifdef READ_SCREW_ENCODER uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; uint32_t ScrewLocationRun[3]; +uint32_t ScrewLocationPrev[3]; float WinderRunAverage = 0.0,WinderRunSum = 0.0; int WinderRunSamples = 0; #endif @@ -305,7 +306,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) // WinderMotorSpeedCounter=0; } // } - if (flipflop == 0) + /*if (flipflop == 0) { MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } @@ -314,11 +315,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } flipflop ++; - + */ if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; //deley TODO - flipflop = 0; + //flipflop = 0; ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; @@ -342,6 +343,16 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); } } + if (abs(ScrewLocationPrev[1]-ScrewLocationRun[1])>21) + { + Report("Winder difference",__FILE__,CalculationDirectionChangeCounter,ScrewLocationPrev[1],RpWarning,ScrewLocationRun[1], 0); + } + ScrewLocationPrev[1] = ScrewLocationRun[1]; + if (abs(ScrewLocationPrev[0]-ScrewLocationRun[0])>21) + { + Report("Winder difference",__FILE__,CalculationDirectionChangeCounter,ScrewLocationPrev[0],RpWarning,ScrewLocationRun[0], 0); + } + ScrewLocationPrev[0] = ScrewLocationRun[0]; //else // Report("winder run error value" ,__FILE__,WinderRun,ScrewLocationRun[0],RpWarning,ScrewLocationRun[1], 0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 416b53494..226bb2559 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -23,6 +23,7 @@ #include "drivers/Flash_ram/FlashProgram.h" #include "drivers/Flash_ram/MCU_E2Prom.h" +#include "modules/ids/ids_ex.h" #include "thread.h" MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS]={0}; @@ -105,6 +106,10 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest) MotorsCfg[Motor_i].toffmin = request->toffmin ; status = MotorConfig( Motor_i, &MotorsCfg[Motor_i]); + if ((Motor_i >= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)&&(Motor_i <= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8)) + { + IDS_Dispenser_Init(Motor_i-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1); + } // if (Motor_i == MOTOR_RDRIVING) // ThreadInitialTestStub(request); } @@ -173,7 +178,7 @@ uint32_t StoreDancerConfigMessage() status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_0,DancersCfg[0].zeropoint); status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_1,DancersCfg[1].zeropoint); status |= MCU_E2PromProgram(EEPROM_STORAGE_DANCER_2,DancersCfg[2].zeropoint); - Report("Store eeprom 0",__FILE__,DancersCfg[0].zeropoint,(int)DancersCfg[1].zeropoint,RpWarning,(int)DancersCfg[2].zeropoint,0); + Report("~~~~~~Store eeprom 0",__FILE__,DancersCfg[0].zeropoint,(int)DancersCfg[1].zeropoint,RpWarning,(int)DancersCfg[2].zeropoint,0); /* response_buffer = my_malloc(hardware_configuration__get_packed_size(&DancerConfig)); if (response_buffer) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 41d98e892..9d408a4a6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -883,9 +883,10 @@ void ThreadPreSegmentEnded(void) } #define DRYER_RAMPUP 1 #ifdef DRYER_RAMPUP +int DrierDivider = 10; uint32_t ThreadDryerRampUp(uint32_t IfIndex, uint32_t BusyFlag) { - InitialDryerSpeed += (OriginalMotorSpd_2PPS[DRYER_MOTOR]/10); + InitialDryerSpeed += (OriginalMotorSpd_2PPS[DRYER_MOTOR]/DrierDivider); if (InitialDryerSpeed >= OriginalMotorSpd_2PPS[DRYER_MOTOR]) { InitialDryerSpeed = OriginalMotorSpd_2PPS[DRYER_MOTOR]; @@ -924,7 +925,9 @@ uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId) #ifndef DRYER_RAMPUP MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]); #else - InitialDryerSpeed = OriginalMotorSpd_2PPS[DRYER_MOTOR]/10; + DrierDivider = dyeingspeed/5; //ramp up drier in 5 cm/sec steps + Report("Drier ramp up",__FILE__,__LINE__,(int)dyeingspeed,RpWarning,(int)DrierDivider,0); + InitialDryerSpeed = OriginalMotorSpd_2PPS[DRYER_MOTOR]/DrierDivider; MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,InitialDryerSpeed ); ControlIdtoMotorId[DRYER_MOTOR] = AddControlCallback("DryerRampUp",ThreadDryerRampUp, 200,TemplateDataReadCBFunction,0,0,0); #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index f3812cc2c..9c4628f4f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -830,6 +830,7 @@ bool WasteTankCBFunction() { //WHS_info.cartridge_1.autheticate = PASSED; //='0' //???WHS_info.WHS_valve = waste_cartridge1; // or we should do it only before pumping???? + AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, false); } else { @@ -858,6 +859,7 @@ bool WasteTankCBFunction() //WHS_info.cartridge_2.autheticate = PASSED; //='0' //???WHS_info.WHS_valve = waste_cartridge2; // or we should do it only before pumping???? //???SetValveDirection(); // or we should do it only before pumping???? + AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, false); } else { @@ -917,12 +919,12 @@ bool WasteTankCBFunction() REPORT_MSG(WHS_full," ------------ call customer support ----------------- "); Pannel_Leds(CART_1, MODE_ON); cart1.color = fastBILNK; - IFS_TimeOutAlarm(true); + //IFS_TimeOutAlarm(); break; case IFS_MidTankFull: // Disable_MidTank_Pressure_Reading(IFS_info.Ink.cart_color); - WHS_info.Cartridge_Ink_TimeOut_device_Id = RemoveControlCallback(WHS_info.Cartridge_Ink_TimeOut_device_Id, WasteTankCBFunction ); + IFS_info.Cartridge_Ink_TimeOut_device_Id = RemoveControlCallback(IFS_info.Cartridge_Ink_TimeOut_device_Id, WasteTankCBFunction ); REPORT_MSG(WHS_full," ------------ Change cartridge status to Waste Empty ----------------- "); Pannel_Leds(CART_1, MODE_OFF); cart1.color = colorOFF; @@ -1157,11 +1159,11 @@ bool InitCartStatus() if (WHS_info.WHS_sensors.cartridge_cover == WHS_CartridgeCoverOPEN) { REPORT_MSG(parameter," ------------ WHS_CartridgeCoverOPEN : add callback for cart1 and cart 2 ----------------- "); - IFS_info.Cartridge_Ink_device_Id = AddControlCallback("Ink Cartridge CB" , WasteTankCBFunction, eOneSecond, CartridgeInkCallBackFunction , 0,0,0 ); - WHS_info.Cartridge_Waste1_device_Id = AddControlCallback("Waste1 Cartridge CB", WasteTankCBFunction, eOneSecond, CartridgeWaste1CallBackFunction, 0,0,0 ); - WHS_info.Cartridge_Waste2_device_Id = AddControlCallback("Waste2 Cartridge CB", WasteTankCBFunction, eOneSecond, CartridgeWaste2CallBackFunction, 0,0,0 ); + IFS_info.Cartridge_Ink_device_Id = AddControlCallback(NULL, WasteTankCBFunction, eOneSecond, CartridgeInkCallBackFunction, 0,0,0 ); + WHS_info.Cartridge_Waste1_device_Id = AddControlCallback(NULL, WasteTankCBFunction, eOneSecond, CartridgeWaste1CallBackFunction, 0,0,0 ); + WHS_info.Cartridge_Waste2_device_Id = AddControlCallback(NULL, WasteTankCBFunction, eOneSecond, CartridgeWaste2CallBackFunction, 0,0,0 ); } - WHS_info.Cartridge_Cover_device_Id = AddControlCallback("Cartridge Cover Door", WasteTankCBFunction, eOneSecond, CartridgeCoverCallBackFunction, 0,0,0 ); + WHS_info.Cartridge_Cover_device_Id = AddControlCallback(NULL, WasteTankCBFunction, eOneSecond, CartridgeCoverCallBackFunction, 0,0,0 ); return OK; } diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index a652e9035..091d74d92 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -38,6 +38,28 @@ state machines print: job length fixed. +94=>97 +Add job error types +Ouf of idle restarts heating, activated by pressing the power for 1 seconds, +Thread: dryer ramp-up, prevent job if a lid is opened +Fix the reset button in machine studio +Process parameters are stored from job request too. +Idle to power down after 2 hours +93=>94 +Fix read safety indication +Fix valve handling in IDS and on init +Alarm handling – improve reporting phase 1, fix current alarms +Machine status improved and fixed +Ouf of idle by pressing the power for 2 seconds +Heaters – fix 2 bugs (dryer underheat and machine temp) +IDS – fix bugs in ink filling +Stubs – Dispensers auto homing control +Thread load improved (press rockers down, , fix current problem) +Jobs – fix a length bug +Press rockers a step down after closing + + + Embedded SW Release note - Version 1.4.4.6 ============================================================= drivers: diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index a6e0f7d12..f384210b4 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -152,8 +152,8 @@ uint32_t InitSequenceMidTankCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag { int MidTankOpenAir = 8; int MidTankReadPressure = 16; - int MidTankCloseAir = 24; - int MidTankEnd = 32; + int MidTankCloseAir = 40; + int MidTankEnd = 48; int portId; if (MidTankOperationCounter >= MidTankEnd) diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c index 9fb7e097d..b0d101809 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c @@ -17,6 +17,7 @@ #include "Modules/General/MachineStatus.h" #include "StateMachines/Printing/PrintingSTM.h" +#include "StateMachines/Initialization/PowerOffSequence.h" #include "InitSequence.h" #include "drivers/I2C_Communication/DAC/Blower.h" @@ -38,9 +39,20 @@ bool powerIdleState = false; bool machineActive = false; uint32_t IdleControlId = 0xFF; uint32_t IdleHeatingControlId = 0xFF; +uint32_t IdleToPowerDownControlId = 0xFF; ProcessParameters ActiveProcessParameters,ProcessParametersClear; + +uint32_t PowerIdleToPowerDownCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + if (SafeRemoveControlCallback(IdleToPowerDownControlId, PowerIdleToPowerDownCallBackFunction )==OK) + IdleToPowerDownControlId = 0xFF; + Report("PowerIdle calling power off ",__FILE__,__LINE__,(int)eOneHour*2,RpWarning,(int)0,0); + PowerOffInit(); + return OK; +} void PowerIdleSetIdle(void) { + Report("PowerIdle Set ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0); memcpy (&ActiveProcessParameters,&ProcessParametersKeep,sizeof(ProcessParameters)); ProcessParameters ProcessParametersClear; ProcessParametersClear.dryerzone1temp = (ActiveProcessParameters.dryerzone1temp<80)? ActiveProcessParameters.dryerzone1temp:IdleDrierTemperature; @@ -54,7 +66,7 @@ void PowerIdleSetIdle(void) ProcessParametersClear.headzone5temp = (ActiveProcessParameters.headzone5temp <80)? ActiveProcessParameters.headzone5temp :IdleHeadTemperature; ProcessParametersClear.headzone6temp = (ActiveProcessParameters.headzone6temp <80)? ActiveProcessParameters.headzone6temp :IdleHeadTemperature; ProcessParametersClear.dyeingspeed = (ActiveProcessParameters.dyeingspeed <40)? ActiveProcessParameters.dyeingspeed :IdleHeadTemperature; - if (HandleProcessParameters(&ProcessParametersClear)!= OK) + if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) { LOG_ERROR (1, "Turn Heaters idle failed"); return; @@ -68,6 +80,7 @@ void PowerIdleSetIdle(void) Control_Voltage_To_Blower(BlowerCfg.voltage-500); } SetMachineStatus(MACHINE_STATE__Sleep); + IdleToPowerDownControlId = AddControlCallback("IdleToPowerDown",PowerIdleToPowerDownCallBackFunction, eOneHour*2, TemplateDataReadCBFunction,0,0, 0 ); } uint32_t PowerIdleCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) @@ -139,8 +152,10 @@ void PowerIdleOutOfIdleState(void) if (powerIdleState == true) { powerIdleState = false; + RemoveControlCallback(IdleToPowerDownControlId, PowerIdleToPowerDownCallBackFunction ); + IdleToPowerDownControlId = 0xFF; SetPowerMachineState(sttON); - if (HandleProcessParameters(&ActiveProcessParameters)!= OK) + if (HandleProcessParameters(&ActiveProcessParameters,false)!= OK) { LOG_ERROR (1, "Turn Heaters active failed"); return ; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index 285c6ee74..909135c71 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -223,7 +223,7 @@ uint32_t PowerOffHeatersOff(void) ProcessParametersClear.headzone5temp = 0; ProcessParametersClear.headzone6temp = 0; ProcessParametersClear.dyeingspeed = 40; - if (HandleProcessParameters(&ProcessParametersClear)!= OK) + if (HandleProcessParameters(&ProcessParametersClear,false)!= OK) { LOG_ERROR (PowerOffMachineState, "Turn Off Heaters failed"); return ERROR; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 5c0c77baa..42f5572cf 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -82,7 +82,7 @@ JobEndReasonEnum JobEndReason = JOB_OK; ErrorCode JobError_to_ErrorCode[JOB_ERRORS_MAX+1] = {ERROR_CODE__NONE,ERROR_CODE__JOB_UNSPECIFIED_ERROR,ERROR_CODE__JOB_THREAD_BREAK,ERROR_CODE__JOB_WINDER_DANCER_FAIL, ERROR_CODE__JOB_POOLER_DANCER_FAIL,ERROR_CODE__JOB_FEEDER_DANCER_FAIL,ERROR_CODE__JOB_OUT_OF_DYE,ERROR_CODE__JOB_OTHER_ALARM, ERROR_CODE__JOB_TEMPERATURE_ALARM,ERROR_CODE__JOB_LS_ALARM,ERROR_CODE__JOB_PRESSURE_ALARM,ERROR_CODE__JOB_CURRENT_ALARM, - ERROR_CODE__JOB_MOTOR_ALARM,ERROR_CODE__JOB_LIDS_OPEN,ERROR_CODE__JOB_ABORTED_BY_USER,ERROR_CODE__JOB_SAFETY_ALARM,ERROR_CODE__JOB_OTHER_ALARM}; + ERROR_CODE__JOB_MOTOR_ALARM,ERROR_CODE__JOB_LIDS_OPEN,ERROR_CODE__JOB_LIDS_OPEN,ERROR_CODE__JOB_ABORTED_BY_USER,ERROR_CODE__JOB_SAFETY_ALARM}; JobTicket *CurrentJob = NULL; JobRequest *CurrentRequest = NULL; @@ -389,7 +389,7 @@ uint32_t ThreadJoggingFunc(int speed) ProcessParametersCopy.dyeingspeed = speed; else ProcessParametersCopy.dyeingspeed = 40; - if (HandleProcessParameters(&ProcessParametersCopy)!= OK) + if (HandleProcessParameters(&ProcessParametersCopy,false)!= OK) { status = FAILED; } @@ -435,6 +435,14 @@ uint32_t ThreadCleaningJobFunc(int speed) status = ERROR; LOG_ERROR(JobIsActive(),"Jog No cleaner dispenser"); } + else if ((ProcessParametersKeep.dryerzone1temp == 0)||((ProcessParametersKeep.headzone1temp == 0)&&(ProcessParametersKeep.headzone2temp == 0)&&(ProcessParametersKeep.headzone3temp == 0))) + { + status = ERROR; + usnprintf(ErrorMsg, 80,"Cleaning job Heaters are off D %d H1 %d H2 %d H3 %d M %d", + (int)ProcessParametersKeep.dryerzone1temp,(int)ProcessParametersKeep.headzone1temp,(int)ProcessParametersKeep.headzone2temp, + (int)ProcessParametersKeep.headzone3temp,(int)ProcessParametersKeep.mixertemp); + Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); + } else { memcpy(&CopyConfigured,&Configured,sizeof(CopyConfigured)); @@ -454,7 +462,7 @@ uint32_t ThreadCleaningJobFunc(int speed) ProcessParametersCopy.dyeingspeed = speed; else ProcessParametersCopy.dyeingspeed = 40; - if (HandleProcessParameters(&ProcessParametersCopy)!= OK) + if (HandleProcessParameters(&ProcessParametersCopy,false)!= OK) { LOG_ERROR(FAILED,"Jog HandleProcessParameters"); status = FAILED; @@ -518,23 +526,7 @@ void ThreadJoggingRequestFunc(MessageContainer* requestContainer) ThreadJoggingResponse response = THREAD_JOGGING_RESPONSE__INIT; - if (JobIsActive() == true) - { - AbortJob(0); - //set the job handler to handle heaters, ids and waste in the state machine - Task_sleep(100); //let the job end procedure role before returning the configuration to normal. - 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); - - - my_free(Ticket.segments); - my_free(TSegment); - my_free(Tspool); - } - else - { - status = ThreadJoggingFunc(request->speed); - } + status = ThreadJoggingFunc(request->speed); responseContainer = createContainer(MESSAGE_TYPE__ThreadJoggingResponse, requestContainer->token, true, &response, &thread_jogging_response__pack, &thread_jogging_response__get_packed_size); if (status!= OK) @@ -553,7 +545,7 @@ void ThreadJoggingRequestFunc(MessageContainer* requestContainer) } void ThreadAbortJoggingFunc(void) { -/* if (JobIsActive() == true) + if (JobIsActive() == true) { AbortJob(0); //set the job handler to handle heaters, ids and waste in the state machine @@ -566,7 +558,7 @@ void ThreadAbortJoggingFunc(void) my_free(TSegment); my_free(Tspool); } -*/ + } void ThreadAbortJoggingRequestFunc(MessageContainer* requestContainer) { @@ -781,7 +773,7 @@ void JobRequestFunc(MessageContainer* requestContainer) //#warning Process parameters in job request are not handled. push separately for now if (Ticket->processparameters) { - if (HandleProcessParameters(Ticket->processparameters)!= OK) + if (HandleProcessParameters(Ticket->processparameters,true)!= OK) { status = FAILED; error = ERROR_CODE__INVALID_PARAMETER; @@ -1197,7 +1189,7 @@ Void jobTask(UArg arg0, UArg arg1) case PrintingResultsFail: JobActive = false; setmachineActive(false); - SetMachineStatus(MACHINE_STATE__Error); + //SetMachineStatus(MACHINE_STATE__Error); resetIdleCounter(); CurrentJob = NULL; //if (CurrentRequest!= NULL) diff --git a/Software/PMR/Messages/MachineStatus/MachineStatus.proto b/Software/PMR/Messages/MachineStatus/MachineStatus.proto index dde725ee2..9b7d2e22b 100644 --- a/Software/PMR/Messages/MachineStatus/MachineStatus.proto +++ b/Software/PMR/Messages/MachineStatus/MachineStatus.proto @@ -10,4 +10,5 @@ message MachineStatus { MachineState State = 1; repeated IDSPackLevel IDSPacksLevels = 2; + double MachineTemperature = 3; } \ No newline at end of file -- cgit v1.3.1 From 797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 1 Dec 2019 14:34:42 +0200 Subject: update with Beta code --- .../Embedded/Common/SWUpdate/FileSystem.c | 65 +++++-- .../Embedded/Communication/CommunicationTask.c | 2 +- .../Embedded_SW/Embedded/Communication/Container.c | 7 +- .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 20 +- .../I2C_Communication/Head_Card/I2C_Head_Mux.c | 2 +- .../Head_Card/PT100/Head_PT100_ADC.c | 2 +- .../I2C_Communication/RFID_NFC/PN7150/PN7150.c | 2 + .../Embedded_SW/Embedded/Drivers/Motors/Motor.c | 2 + .../Embedded/Drivers/Motors/MotorActions.c | 5 +- .../Embedded/Drivers/USB_Communication/USBCDCD.c | 10 + .../Embedded_SW/Embedded/Drivers/Valves/Valve.c | 2 +- .../Embedded/Drivers/logi-tag/LT_RFID.c | 215 +++++++++++++++++++++ Software/Embedded_SW/Embedded/Main.c | 7 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 25 +-- .../Embedded_SW/Embedded/Modules/Control/control.c | 2 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 68 ++++--- .../Modules/Diagnostics/DiagnosticsHoming.c | 4 +- .../Embedded/Modules/General/GeneralHardware.c | 11 +- .../Embedded_SW/Embedded/Modules/General/buttons.h | 9 +- .../Embedded_SW/Embedded/Modules/General/process.c | 1 - .../Embedded/Modules/Heaters/Heaters_print.c | 2 +- .../Embedded/Modules/IDS/IDS_Cleaning.c | 10 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 93 +++++++-- .../Embedded/Modules/Thread/ThreadLoad.c | 19 +- .../Embedded/Modules/Thread/Thread_Winder.c | 12 +- .../Embedded/Software Release Notes.txt | 11 ++ .../Embedded/StateMachines/Printing/JobSTM.c | 1 + .../StartThreadLoadingUpdateRequest.proto | 9 + .../StartThreadLoadingUpdateResponse.proto | 11 ++ .../Messages/Diagnostics/ThreadLoadingState.proto | 25 +++ 30 files changed, 531 insertions(+), 123 deletions(-) create mode 100644 Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateResponse.proto create mode 100644 Software/PMR/Messages/Diagnostics/ThreadLoadingState.proto (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 7871c5e28..5650cbd1b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -94,32 +94,39 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); - Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); - if (Fresult == FR_OK) + if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { - FileLength = request->length; - FileReceivedLength = 0; - REPORT_MSG (FileLength,"file upload request"); - response.has_maxchunklength = true; - response.maxchunklength = MAX_CHUNK_LENGTH; - strcpy(FileHandleChar, "1234"); - response.uploadid = FileHandleChar; //supporting only single file at each time. - FileDone = false; + CommRxTaskHandle = Task_self(); + Task_setPri(CommRxTaskHandle, 3); + // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); + Report("FileUploadRequestFunc 2", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); + Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); + if (Fresult == FR_OK) + { + Report("FileUploadRequestFunc 3", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); + FileLength = request->length; + FileReceivedLength = 0; + REPORT_MSG (FileLength,"file upload request"); + response.has_maxchunklength = true; + response.maxchunklength = MAX_CHUNK_LENGTH; + strcpy(FileHandleChar, "1234"); + response.uploadid = FileHandleChar; //supporting only single file at each time. + FileDone = false; + } + else + { + my_free (UploadFileHandle); + UploadFileHandle = 0; + Semaphore_post(FFS_Sem); + } } else { - my_free (UploadFileHandle); - UploadFileHandle = 0; - Semaphore_post(FFS_Sem); + Fresult = FR_DENIED; + Report("Semaphore_pend failed", __FILE__, __LINE__, 4, RpWarning, (int)0, 0); } - } } - CommRxTaskHandle = Task_self(); - Task_setPri(CommRxTaskHandle, 4); - // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); - responseContainer = createContainer(MESSAGE_TYPE__FileUploadResponse, requestContainer->token, false, &response, &file_upload_response__pack, &file_upload_response__get_packed_size); if (Fresult!= FR_OK) @@ -533,6 +540,8 @@ uint32_t GetStorageInfoRequestFunc(MessageContainer* requestContainer) return OK; } +//char Datestr[100]; + uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) { //uint32_t status = OK; @@ -549,6 +558,15 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) char FullPath[MAX_NUM_OF_FILES][60]; int i,NumOfFiles = 0; FRESULT Fresult = FR_OK; + /* + time_t t; + struct tm *ltm; + char *curTime; + t = time(NULL); + ltm = localtime(&t); + curTime = asctime(ltm); + Report(curTime, __FILE__, ltm->tm_hour,ltm->tm_min , RpWarning, ltm->tm_sec, 0); + */ Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult |= f_opendir(&dir, g_cCwdBuf); @@ -600,7 +618,14 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Data[i].lastmodifieddate = fno[i]->fdate; Data[i].has_lastmodifiedtime = true; Data[i].lastmodifiedtime = fno[i]->ftime; - //Report(Data[i].name, __FILE__, __LINE__, Data[i].lastmodifieddate, RpWarning, (int)Data[i].lastmodifiedtime, 0); + /* + t = (fno[i]->fdate<<16)+fno[i]->ftime; + ltm = localtime(&t); + curTime = asctime(ltm); + usnprintf(&Datestr, 100, "File info %s %s",fno[i]->fname, curTime); + Report(Datestr, __FILE__, __LINE__, t, RpWarning, (int)Data[i].lastmodifiedtime, 0); + Task_sleep(50); + */ if (i==0) usnprintf(&FullPath[i], 50, "%s", request->path); diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index a970aab5a..43a185a3a 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -41,7 +41,7 @@ SerialBuffer inBuffer[11]; bool SerialBufferUsed[11] = {false,false,false,false,false,false,false,false,false,false,false}; uint32_t initArray(size_t initialSize) { - if (initialSize >= COMM_MAX_BUFFER_SIZE) return 0; + if (initialSize >= COMM_MAX_BUFFER_SIZE) return 0xFF; if (initialSize > SHORT_BUFFER_SIZE) { if (SerialBufferUsed[10] == true) diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index 11bdbe0c8..d7a49a5f4 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -134,11 +134,12 @@ void receive_callback(char* buffer, size_t length) MessageContainer* requestContainer = message_container__unpack(NULL, length, (uint8_t*)buffer); if (requestContainer == NULL) return; - if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) //user action resets the idle counter + if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter { - resetIdleCounter(); - REPORT_MSG(requestContainer->type,"Message received"); + ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); } + if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) + resetIdleCounter(); KeepAliveOneSecondCounter = 0; /*msgId[RxIndex] = requestContainer->type; Length[RxIndex] = length; diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index 001c083c2..f5ef82720 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -512,6 +512,18 @@ uint32_t DeActivateCoolerPump() //WHS - Pump the waste accumulated in cooler to F1_Moto_Driver_SW1 = F1_Mot_Dr_SW1.ushort; return OK; } +uint32_t MagnetControlId = 0xFF; +uint32_t MagnetCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + if (SafeRemoveControlCallback(MagnetControlId, MagnetCallBackFunction )==OK) + MagnetControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)MagnetControlId,RpWarning,(int)MagnetCallBackFunction,0); + Report("MagnetCallBackFunction",__FILE__,__LINE__,(int)MagnetControlId,RpWarning,(int)MagnetCallBackFunction,0); + MotorStop(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,Hard_Hiz ); + + return OK; +} uint32_t ActivateHeadMagnet() { @@ -521,7 +533,10 @@ uint32_t ActivateHeadMagnet() F2_CTRL = F2_CTRL_Reg.ushort; if (isMotorConfigured(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM)) { - MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM, DH_LID_CLOSE, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM], NULL,1000); + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_CLOSE ); + MagnetControlId = AddControlCallback(NULL, MagnetCallBackFunction, 2* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + + //MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM, DH_LID_CLOSE, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM], NULL,1000); } return OK; } @@ -531,7 +546,8 @@ uint32_t DeActivateHeadMagnet() Report("DeActivateHeadMagnet - open the lid magnet",__FILE__,__LINE__,(int)HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,RpWarning,(int)DH_LID_CLOSE,0); if (isMotorConfigured(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM)) { - MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM, DH_LID_OPEN, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM], NULL,1000); + MotorGoTo(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM,DH_LID_OPEN ); + //MotorGotoWithCallback(HARDWARE_MOTOR_TYPE__MOTO_RLOADARM, DH_LID_OPEN, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADARM], NULL,1000); } F2_CTRL_Reg.ushort |= SPARE_SSR13_CTRL; F2_CTRL = F2_CTRL_Reg.ushort; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.c index a7fa349f3..4d7259bd3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.c @@ -18,7 +18,7 @@ uint32_t Select_Main_Head_Mux_Channel() uint8_t Write_Buf[1]; - Block_Main_WHS_Mux_Channel(); + //Block_Main_WHS_Mux_Channel(); Write_Buf[0] = 0x01 << 4;//Channel 4 diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c index 5c250f1b7..d9464efc0 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c @@ -124,8 +124,8 @@ uint32_t I2C_Read_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t HeadADCPT100_Reset(void) { - #ifndef EVALUATION_BOARD uint32_t status = OK; + #ifndef EVALUATION_BOARD uint8_t i; uint8_t Write_Buf[1]; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/PN7150/PN7150.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/PN7150/PN7150.c index 8489b08a5..b33d7f0c1 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/PN7150/PN7150.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/PN7150/PN7150.c @@ -18,6 +18,7 @@ F1_GPO_REG2 Reset_NFC; void Reset_NFC_Device(PANEL_BUTTON_OR_CRAT_ID Cart_ID)//reset pin. Set the device in Hard Power Down { assert (Cart_ID<=CART_3); +#ifndef EVALUATION_BOARD switch(Cart_ID) { @@ -35,4 +36,5 @@ void Reset_NFC_Device(PANEL_BUTTON_OR_CRAT_ID Cart_ID)//reset pin. Set the devic } F1_GPO_02_bus = Reset_NFC.ushort; +#endif } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 4a5a48f04..d1a3ee958 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -90,6 +90,7 @@ uint32_t Motor_ReconfigAllMotors(void) { TimerMotors_t Motor_i; uint32_t status = PASSED; + ReportWithPackageFilter(GeneralFilter,"Motor_ReconfigAllMotors",__FILE__,__LINE__,NUM_OF_MOTORS,RpMessage,0,0); for (Motor_i = 0; Motor_i < NUM_OF_MOTORS ; Motor_i++) { if (isMotorConfigured(Motor_i)) @@ -349,6 +350,7 @@ uint32_t MotorStop(TimerMotors_t _motorId, STOP_TYPE_ENUM StopType) Stop_Command = StopType; Mot_Stop(); #else + //ReportWithPackageFilter(GeneralFilter,"MotorStop",__FILE__,__LINE__,_motorId,RpMessage,StopType,0); MotorDriverRequest[_motorId].Stop = StopType; FPGA_SetMotStop(_motorId); #endif diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 3a1d25310..3fe15b300 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -521,7 +521,7 @@ uint32_t MotorMoveToLimitSwitchCallBackFunction(uint32_t IfIndex, uint32_t Limit Task_sleep(200); ActivateHeadMagnet(); // close the lid magnet CloseMagnet=false; - LOG_ERROR(CloseMagnet,"ActivateHeadMagnet"); + ReportWithPackageFilter(GeneralFilter,"calling ActivateHeadMagnet",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpMessage,0,0); } } //call the module callback @@ -554,7 +554,7 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t { CloseMagnet = true; } - LOG_ERROR(CloseMagnet,"DeActivateHeadMagnet"); + ReportWithPackageFilter(GeneralFilter,"calling DeActivateHeadMagnet",__FILE__,__LINE__,HARDWARE_MOTOR_TYPE__MOTO_DH_LID,RpMessage,0,0); } if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_RDANCER) { @@ -711,6 +711,7 @@ uint32_t MotorMovetoDancerPosition (TimerMotors_t MotorId,bool direction, uint32 uint32_t MotorAbortMovetoLimitSwitch (TimerMotors_t MotorId) { + ReportWithPackageFilter(GeneralFilter,"MotorAbortMovetoLimitSwitch",__FILE__,__LINE__,MotorId,RpMessage,MotorControlId[MotorId],0); if (MotorControlId[MotorId] != 0xFF) { RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c index b7a6fb67e..e6812d607 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c @@ -617,7 +617,12 @@ uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValu return(0); } uint32_t buffId = 0xFF; +/*#define MAX_USB_LOG 3 +uint32_t ULength[MAX_USB_LOG+1] = {0}; +uint32_t UDataLength[MAX_USB_LOG] = {0}; +byte URxIndex = 0; +*/ void handleRx(void) { uint32_t ui32Read; @@ -639,6 +644,7 @@ if (expected_message_size == 0) } while(size_bar < 4); expected_message_size = *(int *)size; + // ULength[URxIndex] = expected_message_size; buffId = initArray( expected_message_size); if (buffId == 0xFF) expected_message_size = 0; @@ -653,11 +659,15 @@ if (expected_message_size == 0) { insertArray(buffId,ui8Char); current_message_size++; +// UDataLength[URxIndex] = current_message_size; } if (current_message_size == expected_message_size) { g_RxCount += current_message_size; +/* UDataLength[URxIndex] = current_message_size; + if (URxIndex++>= MAX_USB_LOG) + URxIndex = 0;*/ CommunicationTaskMessageReceived(buffId,current_message_size); expected_message_size = 0; current_message_size = 0; diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c index bc5cb5096..a604f9bc6 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c +++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c @@ -373,7 +373,7 @@ uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callb Valve3WayModuleCallback[_ValveId] = callback; busy = FPGA_GetDispenserValveBusyOCD(_ValveId,0); - Report("Set valve id, dir, busy",__FILE__,_ValveId,(int)direction,RpWarning,(int)busy,0); + //Report("Set valve id, dir, busy",__FILE__,_ValveId,(int)direction,RpWarning,(int)busy,0); Valve3WayControlId[_ValveId] = AddControlCallback("Valve3WayControlId", Valve3WayCallBackFunction, eOneSecond/*eHundredMillisecond*/, FPGA_GetDispenserValveBusyOCD,(IfTypeDisopenser*0x100+_ValveId), _ValveId, 0 ); if (Valve3WayControlId[_ValveId] == 0xFF) Report("Add control callback failed",__FILE__,__LINE__,(int)_ValveId,RpWarning,(int)Valve3WayControlId[_ValveId],0); diff --git a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c index 2b340c535..b7683688d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c +++ b/Software/Embedded_SW/Embedded/Drivers/logi-tag/LT_RFID.c @@ -944,3 +944,218 @@ int incrementCounterAndCompare( uint32_t readerID, NxpNci_RfIntf_t *tagInfo, int return 1; } +void RFID_Test() +{ + +uint8_t i, readerID = 1; +NxpNci_RfIntf_t tagInfo; +uint8_t addressBlock = 0xE3; // NTAG216 - User memory blocks: 0x04-0xE1 = 222 blocks = 888 bytes +uint8_t tagId[]= {0}; +uint8_t Serial[] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G'}; +uint8_t factoryID[] = { '1', '2', '3'}; +uint16_t fillingSystem = 55; +uint8_t workOrder[] = { 'W', 'O', '1', '9', '0', '0', '0', '0', '1', '8'}; +uint8_t colorName[] = { 'C', 'O', 'L', 'O', 'R', '-', 'N', 'A', 'M', 'E', '-', '1', '2', '3'}; +uint8_t catagory[] = { '0', '1'}; +uint32_t type = 1234; +uint32_t cartSize = 1522; +uint32_t inkVolume = 750; +uint8_t inkBatch[] = { 'W', 'O', '1', '9', '0', '0', '0', '1', '0', '8' }; +uint8_t inkMfgDate[] = { '1', '9', '/', '0', '7', '/', '1', '9' }; +uint8_t inkEolDate[] = { '1', '9', '/', '0', '7', '/', '2', '0' }; +uint8_t CartFillDate[] = { '1', '8', '/', '0', '8', '/', '1', '9' }; +uint8_t WasteFillDate[] = { 'S', 'T', 'U', 'V', 'W', 'X', 0, 0 }; +uint32_t Misc = 1234; +uint32_t pluginCounter = 15; +uint8_t inkFill = 1; +uint8_t inkUsed = 2; +uint8_t inkEmpty = 3; +uint8_t wasteEmpty = 4; +uint8_t wasteFilling = 5; +uint8_t wasteFull = 6; +uint8_t blocked = 7; +uint8_t fail = 8; +uint16_t wasteCounter = 14; +uint8_t MachineIdInl[] = { 'A', '1', 'B', '2', 'C', '3', 'D', '4', 'E', '5', 'F', '6', 'G', '7', 'H', '8' }; +uint8_t MachineIdWst[] = { 'H', '8', 'G', '7', 'F', '6', 'E', '5', 'D', '4', 'C', '3', 'B', '2', 'A', '1' }; +uint8_t reserved[] = { 'A', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 0 }; +uint32_t counter = 12; +uint8_t tagValid = 1; +uint8_t uid[7] = {0}; +uint8_t hashValue[16] = {0}; +uint8_t newPACK[] = {0x11, 0x22}; +uint8_t newPwd[] = {0xFF, 0xFF, 0xFF, 0xFF}; +uint8_t startingBlock = 0x04; +uint8_t pwdAddr = 0xE5; +uint8_t tagMemory[1024]; +uint16_t succeededWriteSize = 0; +uint16_t succeededReadSize = 0; +bool firstTime = true; + +uint32_t dummy = 0; +RFID_RETURN_CODE RFIDRetValue; +RFID_HardReset(readerID); +RFID_StartDiscovery(readerID); +InitFields(); +while(1) + { + if(RFID_WaitForDiscoveryNotification(readerID, &tagInfo) == SUCCESS){ + //if(firstTime){ + //firstTime = false; + //RFID_CardModeSend(readerID, &tagInfo, newPwd, pwdAddr, sizeof(newPwd), &succeededWriteSize); + //RFID_CardModeReceive(readerID, &tagInfo, tagMemory, addressBlock, sizeof(tagMemory), &succeededReadSize); + //if(memcmp(dataToWrite, tagMemory, sizeof(dataToWrite)) == 0) + // greenLedBlink(500); + //counter = GetCounter (readerID, &tagInfo); + //isTagValid = IsTagValid(readerID, &tagInfo); + //UID + RFIDRetValue = getUID( readerID, &tagInfo, uid ); + //password update + //if ( setPwdValue( readerID, &tagInfo, newPwd ) == true ) + // i = 0; + + ///if ( activatePwd( readerID, &tagInfo, startingBlock ) == true ) + /// i = 1; + //password authentication + if ( checkPwd( newPwd, newPACK ) == true ) + i = 0; + if ( setPACKValue( readerID, &tagInfo, newPACK ) == true ) + i = 1; + + //RFIDRetValue = getPwd( readerID, &tagInfo, pwd ); + //serial + RFIDRetValue = WriteValue( readerID, &tagInfo, Serial, 0, dummy ); + RFIDRetValue = ReadValue( readerID, &tagInfo, Serial, 0, &dummy ); + //factory id + RFIDRetValue = WriteValue( readerID, &tagInfo, factoryID, 1, dummy ); + RFIDRetValue = ReadValue( readerID, &tagInfo, factoryID, 1, &dummy ); + //filling system + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 2, fillingSystem ); + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 2, &fillingSystem ); + //work order + RFIDRetValue = WriteValue( readerID, &tagInfo, workOrder, 3, dummy ); + RFIDRetValue = ReadValue( readerID, &tagInfo, workOrder, 3, &dummy ); + //color name + RFIDRetValue = WriteValue( readerID, &tagInfo, colorName, 4, dummy ); + RFIDRetValue = ReadValue( readerID, &tagInfo, colorName, 4, &dummy ); + //category + RFIDRetValue = WriteValue( readerID, &tagInfo, catagory, 5, dummy ); + RFIDRetValue = ReadValue( readerID, &tagInfo, catagory, 5, &dummy ); + //type + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 6, type ); + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 6, &type ); + //cartSize + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 7, cartSize ); + cartSize = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 7, &cartSize ); + //inkVolume + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 8, inkVolume ); + inkVolume = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 8, &inkVolume ); + //inkBatch + RFIDRetValue = WriteValue( readerID, &tagInfo, inkBatch, 9, dummy ); + for ( i = 0; i < sizeof(inkBatch); i++ ) inkBatch[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, inkBatch, 9, &dummy ); + //inkMfgDate + RFIDRetValue = WriteValue( readerID, &tagInfo, inkMfgDate, 10, dummy ); + for ( i = 0; i < sizeof(inkMfgDate); i++ ) inkMfgDate[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, inkMfgDate, 10, &dummy ); + //inkEolDate + RFIDRetValue = WriteValue( readerID, &tagInfo, inkEolDate, 11, dummy ); + for ( i = 0; i < sizeof(inkEolDate); i++ ) inkEolDate[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, inkEolDate, 11, &dummy ); + //CartFillDate + RFIDRetValue = WriteValue( readerID, &tagInfo, CartFillDate, 12, dummy ); + for ( i = 0; i < sizeof(CartFillDate); i++ ) CartFillDate[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, CartFillDate, 12, &dummy ); + //WasteFillDate + RFIDRetValue = WriteValue( readerID, &tagInfo, WasteFillDate, 13, dummy ); + for ( i = 0; i < sizeof(WasteFillDate); i++ ) WasteFillDate[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, WasteFillDate, 13, &dummy ); + //Misc + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 14, Misc ); + Misc = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 14, &Misc ); + //pluginCounter + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 15, pluginCounter ); + pluginCounter = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 15, &pluginCounter ); + //inkFill + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 16, inkFill ); + inkFill = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 16, &inkFill ); + //inkUsed + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 17, inkUsed ); + inkUsed = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 17, &inkUsed ); + //inkEmpty + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 18, inkEmpty ); + inkEmpty = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 18, &inkEmpty ); + //wasteEmpty + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 19, wasteEmpty ); + inkVolume = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 19, &wasteEmpty ); + //wasteFilling + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 20, wasteFilling ); + inkVolume = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 20, &wasteFilling ); + //wasteFull + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 21, wasteFull ); + wasteFull = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 21, &wasteFull ); + //blocked + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 22, blocked ); + inkVolume = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 22, &blocked ); + //fail + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 23, fail ); + wasteFull = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 23, &fail ); + //wasteCounter + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 24, wasteCounter ); + inkVolume = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 24, &wasteCounter ); + //MachineIdInl + RFIDRetValue = WriteValue( readerID, &tagInfo, MachineIdInl, 25, dummy ); + for ( i = 0; i < sizeof(MachineIdInl); i++ ) MachineIdInl[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, MachineIdInl, 25, &dummy ); + //WasteFillDate + RFIDRetValue = WriteValue( readerID, &tagInfo, MachineIdWst, 26, dummy ); + for ( i = 0; i < sizeof(MachineIdWst); i++ ) MachineIdWst[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, MachineIdWst, 26, &dummy ); + //WasteFillDate + RFIDRetValue = WriteValue( readerID, &tagInfo, reserved, 27, dummy ); + for ( i = 0; i < sizeof(reserved); i++ ) reserved[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, reserved, 27, &dummy ); + //counter + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 28, counter ); + counter = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 28, &counter ); + //tagValid + RFIDRetValue = WriteValue( readerID, &tagInfo, tagMemory, 29, tagValid ); + tagValid = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, tagMemory, 29, &tagValid ); + + //hash + calcHash( uid, sizeof(uid), hashValue ); + RFIDRetValue = WriteValue( readerID, &tagInfo, hashValue, 30, dummy ); + for ( i = 0; i < sizeof(hashValue); i++ ) hashValue[i] = 0; + RFIDRetValue = ReadValue( readerID, &tagInfo, hashValue, 30, &dummy ); + //password + + //} + RFID_StopDiscovery(readerID); + RFID_StartDiscovery(readerID); + + ACTIVITY_RED_LED_ON; + ACTIVITY_GREEN_LED_ON; + //greenLedBlink(100); + } + delayms(100); + } + + //---------------------------------------------------------------------------- + +} + diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index d424c56cc..b118207a3 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -228,8 +228,10 @@ int main(void) PortFunctionInit(); - MCU_E2PromInit(); +#ifndef EVALUATION_BOARD + MCU_E2PromInit(); +#endif #ifdef EVALUATION_BOARD Init_EVB(); #endif @@ -318,7 +320,9 @@ int main(void) //Test_ADS120_Internal_Temperature_Sensor(0); +#ifndef EVALUATION_BOARD Main_EEPROM_Read_Main_Card_SN(); +#endif // Enable interrupts to the processor. // @@ -326,7 +330,6 @@ int main(void) IDLE_TASK_package_init(); - Start_InitSequence(); PowerIdleInit(); BIOS_start(); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 6d5dc00b2..11d08d45a 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -1129,26 +1129,27 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (FPGA_WD_Occurred == true) { Status = false; - break; } - if (isMotorConfigured((TimerMotors_t)AlarmItem[Alarm_i].DeviceId) == false) + else if (isMotorConfigured((TimerMotors_t)AlarmItem[Alarm_i].DeviceId) == false) { Status = false; - break; } - value = MotorGetStatus((TimerMotors_t)AlarmItem[Alarm_i].DeviceId); - if (AlarmItem[Alarm_i].AlarmDirection == true) + else { - if (value && AlarmItem[Alarm_i].AlarmValue) + value = MotorGetStatus((TimerMotors_t)AlarmItem[Alarm_i].DeviceId); + if (AlarmItem[Alarm_i].AlarmDirection == true) { - Status = true; + if (value && AlarmItem[Alarm_i].AlarmValue) + { + Status = true; + } } - } - else - { - if ((value && AlarmItem[Alarm_i].AlarmValue)==false) + else { - Status = true; + if ((value && AlarmItem[Alarm_i].AlarmValue)==false) + { + Status = true; + } } } } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 1f5e008d3..8dad3fa60 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -170,7 +170,7 @@ uint32_t ControlActivityLed( uint32_t Parameter1) if(FPGA_WD_Occurred == true) { ACTIVITY_GREEN_LED_ON; - HWConfigurationInit(); + //Motor_ReconfigAllMotors(); } else ACTIVITY_GREEN_LED_OFF; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index ccf5455d4..5c0af7589 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -515,7 +515,7 @@ void Diagnostic100msecCollection(void) return; //DiagnosticLoadSpeedSensor(getSensorSpeedData()); - if (DiagnosticMode == Diagnostic_Extended_Mode) + if (DiagnosticMode == Diagnostic_Extreme_Mode) DiagnosticTenMsecCollection(); //call the 10msec function every 100 msec to reduce transport if (DiagnosticMode >= Diagnostic_Extended_Mode) @@ -553,7 +553,13 @@ void Diagnostic100msecCollection(void) MidTankpressure[i][0] = 1.00-(IDS_Dispenser_Data[i].consumedinnanolitter/5800000); } */ - + if (DiagnosticMode == Diagnostic_Extreme_Mode) + { + for (i=0;itoken, true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size); - responseContainer.continuous = true; + responseContainer.continuous = false; 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/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 7e46d9342..46abd923f 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -18,13 +18,8 @@ #include "heaters/heaters_ex.h" -//#include "third_party/fatfs/src/ffconf.h" -//#include "third_party/fatfs/src/diskio.h" -//#include "drivers/Flash_Memory/Flash_Memory.h" -//#include "drivers/Flash_Memory/fatfs/ff.h" #include "drivers/Flash_ram/FlashProgram.h" -#include "third_party/fatfs/src/ffconf.h" #include "Common/SWUpdate/FileSystem.h" #include "PMR/common/MessageContainer.pb-c.h" @@ -54,7 +49,7 @@ #include "Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h" #include #include "Modules/General/buttons.h" - +#include "Modules/Waste/Waste.h" #include "Drivers/I2C_Communication/Main_Board_EEPROM/Main_EEPROM.h" @@ -153,6 +148,10 @@ uint32_t HWConfigurationInit(void) ADC_MUX_Init(); GeneralHwReady = true; + + //I2C_NFC_Test(); + //RFID_Test(); + return status; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h index f7dbbb25f..646861bc7 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h @@ -34,6 +34,7 @@ typedef enum sttDISABLE, sttENABLE, sttJOGGING, + sttLONG_JOGGING, sttRDY, sttPRELOAD, @@ -44,10 +45,10 @@ typedef enum typedef struct Button { - char bttn_name[10]; //option - int bttn_status; // 0=RELEASE 1=PRESS - PBstat Action; // enum : offPB,shortPB,longPB,countPB,replongPB - PBcolor color; // enum : off, blue, blink, bithing + char bttn_name[10]; //option + PB_Status bttn_status; // 0=RELEASE 1=PRESS + PBstat Action; // enum : offPB,shortPB,longPB,countPB,replongPB + PBcolor color; // enum : off, blue, blink, bithing PBmachineState state; // enum : sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING uint32_t count; }button; diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index d7de5797d..4305fac0e 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -20,7 +20,6 @@ #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "modules/ids/ids_ex.h" -#include "third_party/fatfs/src/ffconf.h" #include "Common/SWUpdate/FileSystem.h" #include "StateMachines/Initialization/PowerIdle.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 564df6862..b023d592b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -1182,7 +1182,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } if (readValue>(HeaterCmd[index].targettemperatue+500)) { - ReportWithPackageFilter(HeatersFilter, "DC OverHeating in progress",__FILE__,readValue,HeaterReady[index],RpError, HeaterAtTemp[index],0); + ReportWithPackageFilter(HeatersFilter, "DC OverHeating in progress",__FILE__,index,readValue,RpError, HeaterReady[index],0); } // check if the read value is within the proportional band diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index 2a1a8fa31..bdde05b43 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -17,7 +17,7 @@ #include "drivers/valves/valve.h" int SaveLeftRockerSpeed = 50, SaveRightRockerSpeed = 50; -#define CLEANING_DISPENSER_ID 6 + uint32_t IDS_Cleaning_Move_Rockers (int LeftRockerSpeed,int RightRockerSpeed) { uint32_t status = OK; @@ -43,8 +43,8 @@ uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callbac uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr callback) { uint32_t status = OK; - status = IDS_Dispenser_Start_Motor_and_Open_Valve(CLEANING_DISPENSER_ID, dispenserSpeed, callback); - Report("IDS_Cleaning_Spray_Cleaning_Solution", __FILE__, __LINE__, CLEANING_DISPENSER_ID, RpWarning, dispenserSpeed, 0); + status = IDS_Dispenser_Start_Motor_and_Open_Valve(CLEANER_DISPENSER, dispenserSpeed, callback); + Report("IDS_Cleaning_Spray_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, dispenserSpeed, 0); return status; @@ -52,8 +52,8 @@ uint32_t IDS_Cleaning_Spray_Cleaning_Solution (int dispenserSpeed,callback_fptr uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback) { uint32_t status = OK; - status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANING_DISPENSER_ID,callback); - Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANING_DISPENSER_ID, RpWarning, status, 0); + status = IDS_Dispenser_Close_Valve_And_Stop_Motor(CLEANER_DISPENSER,callback); + Report("IDS_Cleaning_Stop_Cleaning_Solution", __FILE__, __LINE__, CLEANER_DISPENSER, RpWarning, status, 0); return status; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index ca9a15008..55ae7d879 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -593,7 +593,10 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } NumOfActiveDispensers = 0; - IDS_StopHomeDispenser(CLEANER_DISPENSER); + if (lubricant_speed > 0.1) + IDS_StopHomeDispenser(LUBRICANT_DISPENSER); + if ((EnableIntersegment == true)&&(IntersegmentLength>0)) + IDS_StopHomeDispenser(CLEANER_DISPENSER); for (i = 0; i < MAX_DYE_DISPENSERS; i++) { if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers @@ -607,11 +610,37 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } else { - if ((HomingActive[i] == false)&&(PrimingActive == false)) + /**/if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) + { + if ((HomingActive[i] == false)&&(PrimingActive == false)) + { + Report("Homing Inactive dispenser",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + IDS_HomeDispenser (i, 1000 , NULL); + } + else + { + Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + } + }/**/ + /*if ((HomingActive[i] == false)&&(PrimingActive == false)) { Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - } + Report("Homing Inactive dispenser",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + IDS_HomeDispenser (i, 1000 , NULL); + } + else + { + Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + } + }*/ + //if ((HomingActive[i] == false)&&(PrimingActive == false)) + //{ + // Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); + // Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + //} + //ControlIdtoInactiveDispenserId[Dispenser_i] = AddControlCallback( IDS_Check_Pressure_Callback, eOneMinute,TemplateDataReadCBFunction ,0, 0, 0 ); + } } if (NumOfActiveDispensers) @@ -763,11 +792,13 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } else { - MotorStop(HW_Motor_Id, Hard_Hiz); - CurrentDispenserSpeed[Dispenser_i] = 0; - usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); - Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); - + if (DispenserUsedInJob[DispenserId] == true) + { + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[Dispenser_i] = 0; + usnprintf(IdsMessage, 80,"Presegment Prepare Dispenser %d stopped",DispenserId,(int) segmentfirst_speed); + Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); + } } } DispenserBuildTimeCounter = 0; @@ -855,6 +886,8 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); Report("End of Pre-segment Handling",__FILE__,__LINE__,InterSegmentStepsCount,RpWarning,(int)lInterSegmentLength,0); //PreSegmentReady(Module_IDS,ModuleDone); SafeRemoveControlCallback(DispenserPreSegmentControlId,IDSPreSegmentStateCallbackRunner); + if (CurrentDispenserSpeed[CLEANER_DISPENSER]>0) + IDS_Cleaning_Stop_Cleaning_Solution (NULL); setRapidPressureRead(false); } if (EnableCleaning == true) @@ -1145,12 +1178,15 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) } if ((EnableIntersegment == true)&&(IntersegmentLength>0.1)&&(SegmentId>0)) { - 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"); + if (DispenserUsedInJob[DispenserId] == true) + { + 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"); + } } IDS_Valve_PresegmentReady(DispenserId,0); //27/03/19 to be removed when the presegment handler will be added } @@ -1226,8 +1262,11 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) { DispenserSegmentReady[DispenserId] = true; //IDS_Dispenser_Close_Valve_And_Stop_Motor(DispenserId,NULL);*/ - MotorStop(HW_Motor_Id, Hard_Hiz); - CurrentDispenserSpeed[DispenserId] = 0; + if (DispenserUsedInJob[DispenserId] == true) + { + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + } //Report("inActive dispenser stopped", __FILE__, __LINE__, DispenserId, RpWarning, segmentfirst_speed, 0); } } @@ -1276,6 +1315,17 @@ uint32_t IDSBrushStopRestartCallback(uint32_t IfIndex, uint32_t readValue) } return OK; } +#define VALVE_DELAY 1 +#ifdef VALVE_DELAY + +uint32_t IDSValveControlId = 0xFF; +uint32_t IDSSegmentStateSetValve(uint32_t IfIndex, uint32_t BusyFlag) +{ + SafeRemoveControlCallback(IDSValveControlId,IDSSegmentStateSetValve); + Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); + Report("IDSSegmentState set valve after 1 second",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0); +} +#endif //******************************************************************************************************************** uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) { @@ -1283,8 +1333,11 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) JobDispenser **Dispensers; int n_dispensers; +#ifdef VALVE_DELAY + IDSValveControlId = AddControlCallback("VALVE_DELAY",IDSSegmentStateSetValve, eOneSecond,TemplateDataReadCBFunction,0,0,0); +#else Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Head); - +#endif IDS_Cleaning_Stop_Cleaning_Solution(NULL); SegmentNumOfBrushStops = Segment->n_brushstops; BrushStopTime = Segment->length/SegmentNumOfBrushStops; //brushstop in meters @@ -1412,7 +1465,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) { Report("IDS_Valve_EndValveReady start homing",__FILE__,deviceID,(int)AutoHoming_Config,RpWarning,(int)AutoHoming_JobEnd_PowerOn_off,0); - if (deviceID!=LUBRICANT_DISPENSER) + //if (deviceID!=LUBRICANT_DISPENSER) IDS_HomeDispenser (deviceID, 1000 , NULL); } return OK; @@ -1455,8 +1508,8 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) } else { - RemoveControlCallback(ControlIdtoInactiveDispenserId[Dispenser_i], IDS_Check_Pressure_Callback ); - ControlIdtoInactiveDispenserId[Dispenser_i] = 0xFF; +// RemoveControlCallback(ControlIdtoInactiveDispenserId[Dispenser_i], IDS_Check_Pressure_Callback ); +// ControlIdtoInactiveDispenserId[Dispenser_i] = 0xFF; IDS_Valve_EndValveReady(Dispenser_i,false); } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 856812c12..852c19a1a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -67,6 +67,7 @@ uint8_t CallbackCounter = 0; uint8_t TimeoutsCounter = 0; + uint32_t UnloadingStart = 0; uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; uint32_t LoadingControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; @@ -184,8 +185,6 @@ { Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); //storeLoadArmParameters(); - MotorMove(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,LoadArmInfo.LoadArmBackLash ); - SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; ThreadLoadStateMachine(LoadStages); @@ -215,6 +214,8 @@ //move to exact location? // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); CallbackCounter = 0; + 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; //storeLoadArmParameters(); @@ -614,7 +615,7 @@ LoadArmInfo.LoadArmRounds = 0; //uint32_t numberOfSteps = 0; //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 - SetOriginMotorSpeed(19); + SetOriginMotorSpeed(30); // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; @@ -670,14 +671,14 @@ CallbackCounter++; //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); - Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + UnloadingStart = msec_millisecondCounter; + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,UnloadingStart,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); LoadArmInfo.LoadArmBackLash = 5; - status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer - LoadArmInfo.LoadArmBackLash = 5; + //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = (int)dryerbufferlength; load.color = BLINK; return OK; @@ -840,7 +841,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } - if (index == POOLER_MOTOR) + /* if (index == POOLER_MOTOR) { if ((TranslatedReadValue)<(-1200)) { @@ -868,7 +869,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } - } + }*/ /* LoadCounter++; if ((LoadCounter % 5001) == 0) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 741fed7af..0d1656301 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -107,6 +107,8 @@ uint32_t InternalWindingConfigMessage(JobSpool* request) InternalWinderCfg.startoffsetpulses = request->startoffsetpulses; InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate; InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//request->rotationsperpassage; + if (request->rotationsperpassage > 6.1) + InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage; InternalWinderCfg.diameter = request->diameter; usnprintf(ScrewStr, 150, "WindingConfig start,offset,head,tail {, %d, %d, %d, %d, %d}",InternalWinderCfg.startoffsetpulses,(int)InternalWinderCfg.segmentoffsetpulses, (int)InternalWinderCfg.spoolbackingrate,(int)InternalWinderCfg.SpoolBottomBackingRate); @@ -279,7 +281,7 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; -double Rotations = 6.0; +double Rotations = 10.0; int flipflop = 0; uint32_t motspeed; float speedf; @@ -400,11 +402,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) }*/ //WinderReferenceSpeed = 1000; //ScrewNumberOfSteps = 1000; - screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; + //screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; // if (Rotations > 6.6)//7.0) // Rotations = 6.0; - RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; - tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + //RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; + //tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; //ROM_IntMasterDisable(); tempScrewSpeed = ScrewSpeed; @@ -468,7 +470,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/3); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; @@ -481,7 +482,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/20); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; } diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index 091d74d92..63b06e673 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -12,6 +12,17 @@ IDS: *dispenser data, *improve autofill on job start, *puller_tension from RML a Thread: *real dryer rampup. dancers from EEPROM only. *insure rockers motors voltage value; print: *prevent job on open covers (dryer, head) +Embedded SW Release note - Version 1.4.5.100 (alpha 1 +) +============================================================= +magnet handling improved +sw_ver in report log +mock whs alarms +read midtank every 1 hour (with valves handling) +lubricant homing at half speed +autohoming for lubricant +fix bugs: ifs, stubs, +dryer ramp fixed +out of idle on job start Embedded SW Release note - Version 1.4.5.96 (alpha 1 +) ============================================================= diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 42f5572cf..651cc636e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -1151,6 +1151,7 @@ Void jobTask(UArg arg0, UArg arg1) JobEndReason = JOB_OK; Report("JobRequestMsg",__FILE__,__LINE__, JobActive,RpMessage,JobResumed,0); JobActive = true; + PowerIdleOutOfIdleState(); SetMachineStatus(MACHINE_STATE__PreparingJob); JobResumed = false; setmachineActive(true); diff --git a/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateRequest.proto b/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateRequest.proto new file mode 100644 index 000000000..76da2c424 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message StartThreadLoadingUpdateRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateResponse.proto b/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateResponse.proto new file mode 100644 index 000000000..f0cf33ced --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/StartThreadLoadingUpdateResponse.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +import "ThreadLoadingState.proto"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message StartThreadLoadingUpdateResponse +{ + ThreadLoadingState ThreadLoadingState = 1; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/ThreadLoadingState.proto b/Software/PMR/Messages/Diagnostics/ThreadLoadingState.proto new file mode 100644 index 000000000..19105702e --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/ThreadLoadingState.proto @@ -0,0 +1,25 @@ + +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +enum ThreadLoadingState +{ + ThreadLoadInit = 0; + ThreadLoadReduceHeat = 1; //Heaters Off; Dryer Blower Off; Blower Low; + ThreadLoadSetLoadArmToStartPosition = 2;//Use Notation How Many Rotations In The Dryer; Or Check Against Stopper. Move Slowly + ThreadLoadOpenCovers = 3; //Open Dyeing Head Cover And Dryer Lid + ThreadLoadLiftDancers = 4; + ThreadLoadLiftRockers = 5; //Machine Is Ready. Send Message; Start Timer To Close Lids; Wait For Operator Response + ThreadLoadInitialTension = 6;//Check Spool Presencerun Winder Until Break Sensor Is Identifieing Movement For A Second + ThreadLoadCloseRockers = 7; + ThreadLoadCloseDancers = 8; //Send Dancer Motors To Preset Location; Check That The Dancers Are On The Thread + ThreadLoadCloseLids = 9; + ThreadLoadJogFeederToMiddlePoint = 10;//Jog The Feeder Motor Until The Feeder Dancer Is At Middle Position + ThreadLoadDryerLoading = 11; //Start Feeder Pid Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 + //Keep Notation How Many Rotations In The Dryer + ThreadLoadResumeHeating = 12; + ThreadLoadJogThread = 13; //Jog Thread Shortly To Make Sure Spool Is Running. Report End Of Loading + ThreadLoadEnd = 14; +} -- cgit v1.3.1 From 1171059d96c39662cef5c7414cd387048c2372d9 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 12 Dec 2019 15:44:30 +0200 Subject: improvements and debugging --- .../Embedded/Common/SWUpdate/FileSystem.c | 2 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded_SW/Embedded/Communication/Container.c | 4 +- .../Embedded/Drivers/Heater/TemperatureSensor.c | 5 +- .../Embedded/Drivers/USB_Communication/USBCDCD.c | 5 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 158 ++------------------- .../Embedded/Modules/Control/MillisecTask.c | 2 + .../Embedded/Modules/Diagnostics/Diagnostics.c | 142 +++++++++--------- .../Embedded/Modules/Diagnostics/Diagnostics.h | 2 + .../Embedded/Modules/General/GeneralHardware.c | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 6 +- .../Embedded/Software Release Notes.txt | 36 ++++- 12 files changed, 139 insertions(+), 227 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 5650cbd1b..b23b4361b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -176,6 +176,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) else { FileReceivedLength += WrittenBytes; + ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,WrittenBytes,FileReceivedLength, RpMessage,msec_millisecondCounter, 0); + //REPORT_MSG (FileReceivedLength,"file upload chunk"); if (FileReceivedLength == FileLength) { 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 92ef02008..fd28180d7 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,8,0}; +TangoVersion_t _gTangoVersion = {1,4,6,0}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index 5ca7a4293..8cc4d883f 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -134,10 +134,10 @@ void receive_callback(char* buffer, size_t length) MessageContainer* requestContainer = message_container__unpack(NULL, length, (uint8_t*)buffer); if (requestContainer == NULL) return; - if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter + /*if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter { ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); - } + }*/ if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) resetIdleCounter(); KeepAliveOneSecondCounter = 0; diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c index 1fab20d7e..cda7f6db7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c @@ -184,9 +184,10 @@ int TemperatureListString(char* str) len = usnprintf(str, 150, "Prepare H1: %d H2: %d H3: %d H4: %d H5: %d H6: %d D1: %d D2: %d D3: %d M: %d",TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP1].Temperature_C_mult_by_100/100, TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP2].Temperature_C_mult_by_100/100,TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP3].Temperature_C_mult_by_100/100, TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP4].Temperature_C_mult_by_100/100,TempSensorResponse[TEMP_SENSE_ANALOG_DYEINGH_TEMP5].Temperature_C_mult_by_100/100, - TempSensorResponse[TEMP_SENSE_ANALOG_MIXCHIP_TEMP].Temperature_C_mult_by_100/100,TempSensorResponse[TEMP_SENSE_ANALOG_DRYER_TEMP1].Temperature_C_mult_by_100/100, + TempSensorResponse[HEAD6_PT100].Temperature_C_mult_by_100/100,TempSensorResponse[TEMP_SENSE_ANALOG_DRYER_TEMP1].Temperature_C_mult_by_100/100, TempSensorResponse[TEMP_SENSE_ANALOG_DRYER_TEMP2].Temperature_C_mult_by_100/100,TempSensorResponse[TEMP_SENSE_ANALOG_DRYER_TEMP3].Temperature_C_mult_by_100/100 - ,TempSensorResponse[TEMP_SENSE_AN_ENCLOSURETEMP3].Temperature_C_mult_by_100/100); + ,TempSensorResponse[MIXER6_PT100].Temperature_C_mult_by_100/100); + //Prepare H1: 78 H2: 111 H3: 137 H4: 135 H5: 144 H6: 75 D1: 120 D2: 167 D3: 158 M: 129 return len; } #endif diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c index e6812d607..22a734781 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c @@ -82,7 +82,7 @@ static unsigned char UsbRxBuffer[COMM_MAX_BUFFER_SIZE]; static unsigned char transmitBuffer[COMM_MAX_BUFFER_SIZE]; -int expected_message_size; +int expected_message_size,keep_expected_message_size; int current_message_size; static volatile uint32_t g_RxCount; //static GateMutex_Handle gateTxSerial; @@ -647,7 +647,10 @@ if (expected_message_size == 0) // ULength[URxIndex] = expected_message_size; buffId = initArray( expected_message_size); if (buffId == 0xFF) + { + keep_expected_message_size = expected_message_size; expected_message_size = 0; + } } do diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index b62b33cc5..2e33bc248 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -91,7 +91,7 @@ typedef struct AlarmHandlingMessage{ // uint32_t Data; }AlarmHandlingMessageStruc; -#define MAX_SYSTEM_ALARMS 300+1 +#define MAX_SYSTEM_ALARMS 400+1 /*typedef enum { TemperatureAlarm, @@ -586,7 +586,7 @@ JobEndReasonEnum getEndReason(uint32_t AlarmId) } else { - usnprintf(AlarmReasonStr, 100, "Alarm %d caused a job stop",AlarmId); + usnprintf(AlarmReasonStr, 100, "Alarm %d type %d caused a job stop",AlarmId,AlarmItem[AlarmId].EventType); return JOB_OTHER_ALARM; } default: @@ -988,6 +988,9 @@ uint32_t AlarmHandlingStop(void) } return OK; } +uint32_t Save_Alarm_i; +void *Save_Alarm_ptr; +EventType Save_Alarm_Type; uint32_t AlarmHandlingLoop(uint32_t tick) { @@ -1105,10 +1108,10 @@ uint32_t AlarmHandlingLoop(uint32_t tick) { if (AlarmItem[Alarm_i].AlarmDirection == true) { - if ((doubleValue >= (AlarmItem[Alarm_i].AlarmValue*CurrentAlarmHighLimit)) || (doubleValue <= (AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))) + if ((doubleValue >= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmHighLimit)) || (doubleValue <= (float)(AlarmItem[Alarm_i].AlarmValue*CurrentAlarmLowLimit))) { Status = true; - //ReportWithPackageFilter(AlarmFilter,"OverCurrent Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,AlarmItem[Alarm_i].EventType, RpMessage, (int)doubleValue, 0); + ReportWithPackageFilter(AlarmFilter,"OverCurrent Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,AlarmItem[Alarm_i].EventType, RpMessage, (int)doubleValue, 0); } } else @@ -1116,7 +1119,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) if (doubleValue <= 0.1) { Status = true; - //ReportWithPackageFilter(AlarmFilter,"llop break Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,AlarmItem[Alarm_i].EventType, RpMessage, (int)doubleValue, 0); + ReportWithPackageFilter(AlarmFilter,"loop break Alarm ON ", __FILE__,AlarmItem[Alarm_i].DeviceId,AlarmItem[Alarm_i].EventType, RpMessage, (int)doubleValue, 0); } } @@ -1189,7 +1192,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) case ALARM_SOURCE_TYPE__TachoAlarm: // add by shai Status = false; - if (CheckTamperAlarms) + if (CheckCurrentAlarms) { // ReportWithPackageFilter(AlarmFilter,"------------FANS_RPM[Alarm_i]----------------", __FILE__,__LINE__,Alarm_i, RpMessage, value, 0); @@ -1365,16 +1368,19 @@ uint32_t AlarmHandlingLoop(uint32_t tick) } else // alarm off { + ReportWithPackageFilter(AlarmFilter,"Alarm OFF ", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, RpMessage, 0, Alarm_i); if (AlarmState[Alarm_i].EventPtr) { //ROM_IntMasterDisable(); + Save_Alarm_i = Alarm_i; + Save_Alarm_ptr = AlarmState[Alarm_i].EventPtr; + Save_Alarm_Type = AlarmItem[Alarm_i].EventType; my_free(AlarmState[Alarm_i].EventPtr); AlarmState[Alarm_i].EventPtr = NULL; //ROM_IntMasterEnable(); } AlarmState[Alarm_i].Status = false; AlarmHandlingConsequentActions(Alarm_i, DEBUG_LOG_CATEGORY__Info); - ReportWithPackageFilter(AlarmFilter,"Alarm OFF ", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, RpMessage, 0, Alarm_i); } } } @@ -1579,143 +1585,7 @@ uint32_t StopEventsNotificationRequestFunc(MessageContainer* requestContainer) my_free(responseContainer.data.data); SendChars(container_buffer, container_size); -return OK; - - -/* function : - * ------------- - * DrawerFansStatus // uint32_t getDrawerFansStatus(void) 5 fans OK or NotOK - * SystemFansStatus // uint32_t getSystemFansStatus(void) 2 fans OK or NotOK - * Fans_Speed_RPM[MAX_FANS] // - * - * Read_Dryer_Fan_Tacho // uint32_t Read_Dryer_Fan_Tacho() - * Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent) //uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent); - * - * excell alarm ver9 from Nadav - * ---------------------------- - * 2009 MACHINE_FANS_RPM_TOO_LOW Warning - * 2010 MACHINE_FANS_STOPPED Critical - * 2011 ELECTRICAL_CABINET_FANS_RPM_TOO_LOW Warning - * 2012 ELECTRICAL_CABINET_FANS_STOPPED Critical - * 4015 DRYER_FAN_RPM_TOO_LOW Warning - * 4016 DRYER_FAN_STOPPED Critical - * - * - * - * - - - - - #define MACHINE_FANS_MIN_RPM 1000 - #define MACHINE_FANS_STOP 0 - #define ELECTRICAL_CABINET_FANS_MIN_RPM 1000 - #define ELECTRICAL_CABINET_FANS_STOP 0 - #define DRYER_FAN_MIN_RPM 1000 - #define DRYER_FAN_STOP 0 - - typedef enum - { - MACHINE_FANS, - ELECTRICAL_CABINET_FANS, -// ELECTRICAL_CABINET_FAN_BIG, -// ELECTRICAL_CABINET_FAN_SMALL1, -// ELECTRICAL_CABINET_FAN_SMALL2, -// ELECTRICAL_CABINET_FAN_SMALL3, -// ELECTRICAL_CABINET_FAN_SMALL4, - DRYER_FAN, - NUM_OF_FANS, - } Fans_t; - - - ----- 2009 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - MACHINE_FANS , // uint16_t DeviceId; - MACHINE_FANS , // uint8_t ModuleDeviceId; - MACHINE_FANS_MIN_RPM , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Warning , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__MACHINE_FANS_RPM_TOO_LOW // EventType EventType; - }, - - ----- 2010 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - MACHINE_FANS , // uint16_t DeviceId; - MACHINE_FANS , // uint8_t ModuleDeviceId; - MACHINE_FANS_STOP , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Critical , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__MACHINE_FANS_STOPPED // EventType EventType; - }, - - ----- 2011 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - ELECTRICAL_CABINET_FANS , // uint16_t DeviceId; - ELECTRICAL_CABINET_FANS , // uint8_t ModuleDeviceId; - ELECTRICAL_CABINET_FANS_MIN_RPM , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Warning , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__ELECTRICAL_CABINET_FANS_RPM_TOO_LOW // EventType EventType; - }, - - ----- 2012 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - ELECTRICAL_CABINET_FANS , // uint16_t DeviceId; - ELECTRICAL_CABINET_FANS , // uint8_t ModuleDeviceId; - ELECTRICAL_CABINET_FANS_STOP , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Critical , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__ELECTRICAL_CABINET_FANS_STOPPED // EventType EventType; - }, - - - ----- 2015 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - DRYER_FAN , // uint16_t DeviceId; - DRYER_FAN , // uint8_t ModuleDeviceId; - DRYER_FAN_MIN_RPM , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Warning , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__DRYER_FAN_RPM_TOO_LOW // EventType EventType; - }, - - ----- 2016 : ------- - {eOneSecond, // uint16_t Frequency; - ALARM_SOURCE_TYPE__TachoAlarm, // AlarmSourceType AlarmSource; - DRYER_FAN , // uint16_t DeviceId; - DRYER_FAN , // uint8_t ModuleDeviceId; - DRYER_FAN_STOP , // uint16_t AlarmValue; - FALSE , // bool AlarmDirection; - DEBUG_LOG_CATEGORY__Critical , // DebugLogCategory Severity; - 0xFF , // uint16_t Predecessor; - 5 , // uint8_t DebounceValue; - EVENT_TYPE__DRYER_FAN_STOPPED // EventType EventType; - }, - - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm,MACHINE_FANS , MACHINE_FANS , MACHINE_FANS_MIN_RPM , FALSE , DEBUG_LOG_CATEGORY__Warning , 0xFF, 5, EVENT_TYPE__MACHINE_FANS_RPM_TOO_LOW }, - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm,MACHINE_FANS , MACHINE_FANS , MACHINE_FANS_STOP , FALSE , DEBUG_LOG_CATEGORY__Critical, 0xFF, 5, EVENT_TYPE__MACHINE_FANS_STOPPED }, - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm, ELECTRICAL_CABINET_FANS, ELECTRICAL_CABINET_FANS, ELECTRICAL_CABINET_FANS_MIN_RPM, FALSE , DEBUG_LOG_CATEGORY__Warning , 0xFF, 5, EVENT_TYPE__ELECTRICAL_CABINET_FANS_RPM_TOO_LOW }, - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm, ELECTRICAL_CABINET_FANS, ELECTRICAL_CABINET_FANS, ELECTRICAL_CABINET_FANS_STOP , FALSE , DEBUG_LOG_CATEGORY__Critical, 0xFF, 5, EVENT_TYPE__ELECTRICAL_CABINET_FANS_STOPPED }, - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm, DRYER_FAN , DRYER_FAN , DRYER_FAN_MIN_RPM , FALSE , DEBUG_LOG_CATEGORY__Warning , 0xFF, 5, EVENT_TYPE__DRYER_FAN_RPM_TOO_LOW }, - {eOneSecond, ALARM_SOURCE_TYPE__TachoAlarm, DRYER_FAN , DRYER_FAN , DRYER_FAN_STOP , FALSE , DEBUG_LOG_CATEGORY__Critical, 0xFF, 5, EVENT_TYPE__DRYER_FAN_STOPPED }, - - -* */ + return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 8897dfdbb..76b7aa7a1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -567,6 +567,8 @@ float MillisecGetPressures (int SensorId) void setRapidPressureRead(bool value) { RapidPressureRead = value; + if (GetDiagnosticMode() == Diagnostic_Extreme_Mode) + RapidPressureRead = true; } uint16_t PumpCounter = 0; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 6e8b50c02..43a7b779f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -70,7 +70,7 @@ DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT; #define DIAGNOSTICS_LIMIT 3 #define DIAGNOSTICS_DANCER_LIMIT 30 int DiagnosticsIndex = 0; -int DiagnosticCollectionLimit = 2; //number of data samples to collect before sending to the host +int DiagnosticCollectionLimit = 3; //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 @@ -221,6 +221,11 @@ void SetDiagnosticMode(Diagnostic_Mode Mode) DiagnosticMode = Mode; REPORT_MSG(Mode,"Diagnostic Mode set"); } +Diagnostic_Mode GetDiagnosticMode(void) +{ + return DiagnosticMode; +} + void SetDiagnosticCollectionLimit(int limit) { @@ -228,11 +233,12 @@ void SetDiagnosticCollectionLimit(int limit) DiagnosticCollectionLimit = limit; DiagnosticLimit =eHundredMillisecond; //frequency of data collection - if (DiagnosticMode <= Diagnostic_Normal_Mode) + /*if (DiagnosticMode <= Diagnostic_Normal_Mode) { DiagnosticCollectionLimit = 1; //overrule - send at least once every second DiagnosticLimit =eOneSecond; //frequency of data collection - } + }*/ + REPORT_MSG(DiagnosticCollectionLimit,"Diagnostic limit set"); } uint8_t HeaterCounterIndex[HEATER_TYPE_MAX_HEATERS]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; @@ -496,6 +502,21 @@ void DiagnosticOneMinuteCollection(void) void DiagnosticOneSecCollection(void) { int i; +#ifdef Use_Head_Card + DiagnosticLoadTemperature(HEATER_TYPE__MixerHeater, MillisecGetTemperatures( HEAD_PT100_MIXER_0X8E_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone1, MillisecGetTemperatures(HEAD_PT100_ZONE_1_0X80_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone2, MillisecGetTemperatures(HEAD_PT100_ZONE_2_0X80_1)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone3, MillisecGetTemperatures(HEAD_PT100_ZONE_3_0X82_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone4, MillisecGetTemperatures(HEAD_PT100_ZONE_4_0X82_1)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone5, MillisecGetTemperatures(HEAD_PT100_ZONE_5_0X84_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone6, MillisecGetTemperatures(HEAD_PT100_ZONE_6_0X84_1)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone7, MillisecGetTemperatures(HEAD_PT100_ZONE_7_0X86_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone8, MillisecGetTemperatures(HEAD_PT100_ZONE_8_0X86_1)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone9, MillisecGetTemperatures(HEAD_PT100_ZONE_9_0X88_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone10, MillisecGetTemperatures(HEAD_PT100_ZONE_10_0X88_1)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone11, MillisecGetTemperatures(HEAD_PT100_ZONE_11_0X8A_0)); + DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone12, MillisecGetTemperatures(HEAD_PT100_ZONE_12_0X8A_1)); +#else DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__MixerHeater, MillisecGetTemperatures( MIXER_PT100)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP1)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP2)); @@ -503,7 +524,7 @@ void DiagnosticOneSecCollection(void) DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP4)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP5)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, MillisecGetTemperatures(HEAD6_PT100)); - +#endif DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP2)); DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP3)); @@ -512,9 +533,9 @@ void DiagnosticOneSecCollection(void) dispensermotorfrequency[i][DiagnosticsIndex] = IdsGetMotorSpeed(i); //dispensermotorfrequency[i][DiagnosticsIndex] = IDS_Dispenser_Data[i].consumedinnanolitter; - dispenserspressure[i][DiagnosticsIndex] = GetDispenserPressure(i); //Read_MidTank_Pressure_Sensor - - MidTankpressure[i][0] = Get_MidTank_Pressure_Sensor(i); + if (DiagnosticMode < Diagnostic_Extended_Mode) + dispenserspressure[i][DiagnosticsIndex] = GetDispenserPressure(i); //Read_MidTank_Pressure_Sensor + MidTankpressure[i][0] = Get_MidTank_Pressure_Sensor(i); } } void Diagnostic100msecCollection(void) @@ -537,31 +558,11 @@ void Diagnostic100msecCollection(void) DiagnosticLoadMotor(WINDER_MOTOR, ThreadGetMotorSpeed (WINDER_MOTOR)); DiagnosticLoadMotor(SCREW_MOTOR, ThreadGetMotorSpeed (SCREW_MOTOR)); } + for (i=0;ibreaksensorlimit = 10; EmbeddedParameters->has_diagnosticcollectionlimit = true; - EmbeddedParameters->diagnosticcollectionlimit = 1; + EmbeddedParameters->diagnosticcollectionlimit = 3; EmbeddedParameters->has_overheatcountlimit = true; EmbeddedParameters->overheatcountlimit = 3; EmbeddedParameters->has_underheatcountlimit = true; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 51498dc04..b879a1404 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -216,6 +216,8 @@ uint32_t InternalId2PT100Id[MAX_INTERNAL_ALARMS] = {TEMP_SENSE_AN_ENCLOSURETEMP1 int32_t InternalOverHeatCounter [MAX_INTERNAL_ALARMS] = {0,0,0}; bool InternalAlarmActive[MAX_INTERNAL_ALARMS] = {false,false,false}; uint32_t ControlIdtoInternalId[MAX_INTERNAL_ALARMS] = {0xFF,0xFF,0xFF}; +EventType InternalTempEventType[MAX_INTERNAL_ALARMS] = {EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE,EVENT_TYPE__ELECTRICAL_CABINET_OVERTEMPERATURE,EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE_2}; + uint32_t HeatersTestInternalAlarmsCBFunction(uint32_t IfIndex, uint32_t readValue) { int index=HEATER_TYPE_MAX_HEATERS; @@ -250,7 +252,7 @@ uint32_t HeatersTestInternalAlarmsCBFunction(uint32_t IfIndex, uint32_t readValu InternalAlarmActive[index] = true; ReportWithPackageFilter(HeatersFilter,"Internal Over the max temperature, turned off",__FILE__,index,readValue,RpWarning, 0,0); - AlarmHandlingSetAlarm(EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE, true); + AlarmHandlingSetAlarm(InternalTempEventType[index], true); } } } @@ -264,7 +266,7 @@ uint32_t HeatersTestInternalAlarmsCBFunction(uint32_t IfIndex, uint32_t readValu InternalAlarmActive[index] = true; ReportWithPackageFilter(HeatersFilter,"Internal Over the max temperature, turned off",__FILE__,index,readValue,RpWarning, 0,0); - AlarmHandlingSetAlarm(EVENT_TYPE__MACHINE_INTERNAL_OVERTEMPERATURE, false); + AlarmHandlingSetAlarm(InternalTempEventType[index], false); } } diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index 8e4424747..6a00adf48 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,17 +1,39 @@ Embedded SW Release note - Version 1.4.6.0 ============================================================= +Common: +logs: better control (filter messages and priorities) + +Drivers: I2C reading task for better handling of slow I2C interactions (head etc) +observe and handle FPGA watchdog reset (report, reinitialize motors) + +Modules: textual names for control calls to help debuggng add midtank and dispenser ink content to diagnostics -*observe and handle FPGA watchdog reset (reinitialize motors) +alarm handling: + 7midtamk overflow, + *fix current alarms, + *consequent actions and job verification, + *critical alarms, + *use alarms file (remote update) +IDS: + *dispenser data, + *improve autofill on job start, + *puller_tension from RML as cleaner speed, + *handle inactive dispenser pressure, + *dispensers PID preparation, + *bring dispensers to first segment pressures before job +Thread: + *real dryer rampup. + *dancers from EEPROM only. + *insure rockers motors voltage value; -alarm handling: midtamk overflow, fix current alarms, consequent actions and job verification, critical alrms. -diagnostics: improved -*heaters: band alarm fixed -IDS: *dispenser data, *improve autofill on job start, *puller_tension from RML as cleaner speed -Thread: *real dryer rampup. dancers from EEPROM only. *insure rockers motors voltage value; -print: *prevent job on open covers (dryer, head) +State machines: +print: *prevent job on open covers (dryer, head) (suspended until new head) +preparation for new head: +I2C scheduling (control, task) +larger number of heaters (heaters module, control, diagnostics, alarms. Embedded SW Release note - Version 1.4.5.104 (alpha 1 ++) ============================================================= -- cgit v1.3.1 From 1b92f30f6dfa27392ffd8460ebeb17c17550db7b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 18 Dec 2019 09:00:24 +0200 Subject: version 1.4.6.1 PMR: thread load and power down reporting. fix USB driver large files bug. ids pressure relief. some looking into the thread load sequence --- Software/Embedded_SW/Embedded/.cproject | 4 +- .../Embedded/Common/SWUpdate/FileSystem.c | 25 ++- .../Embedded/Common/SWUpdate/FileSystem.h | 2 + .../Embedded/Communication/CommunicationTask.c | 39 +++-- .../Embedded/Communication/CommunicationTask.h | 2 +- .../Embedded_SW/Embedded/Communication/Container.c | 14 ++ .../Communication/PMR/Common/MessageType.pb-c.c | 28 ++- .../Communication/PMR/Common/MessageType.pb-c.h | 10 +- .../StartThreadLoadingUpdateRequest.pb-c.c | 72 -------- .../StartThreadLoadingUpdateRequest.pb-c.h | 70 -------- .../StartThreadLoadingUpdateResponse.pb-c.c | 92 ---------- .../StartThreadLoadingUpdateResponse.pb-c.h | 73 -------- .../PMR/Diagnostics/ThreadLoadingState.pb-c.c | 63 ------- .../PMR/Diagnostics/ThreadLoadingState.pb-c.h | 56 ------ .../FirmwareUpgrade/VersionFileDescriptor.pb-c.c | 19 +- .../FirmwareUpgrade/VersionFileDescriptor.pb-c.h | 4 +- .../PMR/Power/AbortPowerDownRequest.pb-c.c | 72 ++++++++ .../PMR/Power/AbortPowerDownRequest.pb-c.h | 70 ++++++++ .../PMR/Power/AbortPowerDownResponse.pb-c.c | 72 ++++++++ .../PMR/Power/AbortPowerDownResponse.pb-c.h | 70 ++++++++ .../Communication/PMR/Power/PowerDownState.pb-c.c | 65 +++++++ .../Communication/PMR/Power/PowerDownState.pb-c.h | 57 ++++++ .../PMR/Power/StartPowerDownRequest.pb-c.c | 72 ++++++++ .../PMR/Power/StartPowerDownRequest.pb-c.h | 70 ++++++++ .../PMR/Power/StartPowerDownResponse.pb-c.c | 118 +++++++++++++ .../PMR/Power/StartPowerDownResponse.pb-c.h | 76 ++++++++ .../ContinueThreadLoadingRequest.pb-c.c | 92 ++++++++++ .../ContinueThreadLoadingRequest.pb-c.h | 72 ++++++++ .../ContinueThreadLoadingResponse.pb-c.c | 105 +++++++++++ .../ContinueThreadLoadingResponse.pb-c.h | 74 ++++++++ .../ThreadLoading/StartThreadLoadingRequest.pb-c.c | 72 ++++++++ .../ThreadLoading/StartThreadLoadingRequest.pb-c.h | 70 ++++++++ .../StartThreadLoadingResponse.pb-c.c | 105 +++++++++++ .../StartThreadLoadingResponse.pb-c.h | 74 ++++++++ .../PMR/ThreadLoading/ThreadLoadingState.pb-c.c | 47 +++++ .../PMR/ThreadLoading/ThreadLoadingState.pb-c.h | 48 +++++ .../Embedded/Drivers/Motors/MotorActions.c | 1 + .../Embedded/Drivers/USB_Communication/USBCDCD.c | 96 ++++++---- .../Embedded/Drivers/flash_ram/MCU_E2Prom.c | 21 +++ .../Embedded/Drivers/flash_ram/MCU_E2Prom.h | 5 + .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 1 - .../Embedded/Modules/Control/MillisecTask.c | 1 - .../Embedded_SW/Embedded/Modules/Control/control.c | 2 + .../Embedded/Modules/Diagnostics/Diagnostics.c | 23 ++- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 5 +- .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 1 + .../Embedded/Modules/Thread/ThreadLoad.c | 195 ++++++++++++++++++++- .../Embedded/Modules/Thread/Thread_ex.h | 3 + .../Embedded/Modules/Thread/Thread_print.c | 34 ++-- .../StateMachines/Initialization/InitSequence.c | 6 +- .../Initialization/PowerOffSequence.c | 147 +++++++++++++++- .../Initialization/PowerOffSequence.h | 4 + 52 files changed, 2068 insertions(+), 551 deletions(-) delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/StartThreadLoadingUpdateRequest.pb-c.c delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/StartThreadLoadingUpdateRequest.pb-c.h delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/StartThreadLoadingUpdateResponse.pb-c.c delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/StartThreadLoadingUpdateResponse.pb-c.h delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/ThreadLoadingState.pb-c.c delete mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/ThreadLoadingState.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/AbortPowerDownRequest.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/AbortPowerDownRequest.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/AbortPowerDownResponse.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/AbortPowerDownResponse.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/PowerDownState.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/PowerDownState.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/StartPowerDownRequest.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/StartPowerDownRequest.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/StartPowerDownResponse.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/Power/StartPowerDownResponse.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingRequest.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingRequest.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/StartThreadLoadingRequest.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/StartThreadLoadingRequest.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/StartThreadLoadingResponse.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/StartThreadLoadingResponse.pb-c.h create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ThreadLoadingState.pb-c.c create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ThreadLoadingState.pb-c.h (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate') diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject index b1d8a3283..7463c7147 100644 --- a/Software/Embedded_SW/Embedded/.cproject +++ b/Software/Embedded_SW/Embedded/.cproject @@ -170,7 +170,7 @@ - + @@ -288,7 +288,7 @@ - +