diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-07-28 12:31:49 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-07-28 12:31:49 +0300 |
| commit | a3f1ec8389cde87fff45dced9380f85d1b2424c6 (patch) | |
| tree | 06e551c58a42fb4c9657febdd490105348d57acf /Software/Embedded_SW | |
| parent | 6bb733f95cbcabc67115674f5cc91ec67196eeed (diff) | |
| download | Tango-a3f1ec8389cde87fff45dced9380f85d1b2424c6.tar.gz Tango-a3f1ec8389cde87fff45dced9380f85d1b2424c6.zip | |
for version 1.4.2.7 : syc file system with semaphore (needs testing!). add secondary pump and activation on init and after 8 hours.now config parameters, improved thread load
Diffstat (limited to 'Software/Embedded_SW')
24 files changed, 211 insertions, 104 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index f4c52f000..5cbc92285 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -644,7 +644,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) } return Fresult; } -FRESULT FileWrite(void * buffer, uint16_t size,char *path) +FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout) { FRESULT Fresult = FR_OK; FIL *FileHandle = 0; //the system supports a single active file @@ -657,7 +657,11 @@ FRESULT FileWrite(void * buffer, uint16_t size,char *path) Fresult = FR_DENIED; else { - Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); + if (Semaphore_pend(FFS_Sem, timeout) == false) + { + LOG_ERROR (false,"file system busy error"); + return FR_TIMEOUT; + } Fresult = f_open(FileHandle,path,FA_WRITE | FA_OPEN_ALWAYS); if (Fresult == FR_OK) diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h index 605b4a475..0f6fd9d5d 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.h @@ -22,7 +22,7 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer); uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer); uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer); -FRESULT FileWrite(void * buffer, uint16_t size,char *path); +FRESULT FileWrite(void * buffer, uint16_t size,char *path, uint32_t timeout); FRESULT FileRead(char *path, uint32_t *Size, void **Buffer); FRESULT FileOpen(char *path, uint32_t *Size, FIL *FileHandle); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 5b0944ab9..2ef74c7b6 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,2,6}; +TangoVersion_t _gTangoVersion = {1,4,2,7}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c index ec93b525c..3dfdfc2bb 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.c @@ -7,7 +7,7 @@ #endif #include "InterfaceIOs.pb-c.h" -static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = +static const ProtobufCEnumValue interface_ios__enum_values_by_number[40] = { { "ANALOG_MIXCHIP_TEMP", "INTERFACE_IOS__ANALOG_MIXCHIP_TEMP", 0 }, { "GPO_MIXCHIP_SSR4_CTRL", "INTERFACE_IOS__GPO_MIXCHIP_SSR4_CTRL", 19 }, @@ -40,6 +40,7 @@ static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = { "Midtank7Cartridge", "INTERFACE_IOS__Midtank7Cartridge", 179 }, { "Midtank8Cartridge", "INTERFACE_IOS__Midtank8Cartridge", 180 }, { "GPO_LED4", "INTERFACE_IOS__GPO_LED4", 274 }, + { "GPO_TFEED_BREAK_1", "INTERFACE_IOS__GPO_TFEED_BREAK_1", 296 }, { "GPO_SPARE1_1", "INTERFACE_IOS__GPO_SPARE1_1", 318 }, { "GPO_SPARE1_2", "INTERFACE_IOS__GPO_SPARE1_2", 319 }, { "GPI_WCONTAINER_FULL", "INTERFACE_IOS__GPI_WCONTAINER_FULL", 341 }, @@ -50,15 +51,15 @@ static const ProtobufCEnumValue interface_ios__enum_values_by_number[39] = { "VALVE_WASTE_TANK", "INTERFACE_IOS__VALVE_WASTE_TANK", 346 }, }; static const ProtobufCIntRange interface_ios__value_ranges[] = { -{0, 0},{19, 1},{43, 6},{54, 9},{64, 11},{163, 12},{274, 30},{318, 31},{341, 33},{0, 39} +{0, 0},{19, 1},{43, 6},{54, 9},{64, 11},{163, 12},{274, 30},{296, 31},{318, 32},{341, 34},{0, 40} }; -static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = +static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[40] = { { "ANALOG_MIXCHIP_TEMP", 0 }, - { "GPI_WCONTAINER_FULL", 33 }, - { "GPI_WCONTAINER_WARN", 34 }, - { "GPO_BLOWER_PWM", 35 }, - { "GPO_CHILLER_SSR9_CTRL", 36 }, + { "GPI_WCONTAINER_FULL", 34 }, + { "GPI_WCONTAINER_WARN", 35 }, + { "GPO_BLOWER_PWM", 36 }, + { "GPO_CHILLER_SSR9_CTRL", 37 }, { "GPO_DILUTORPUMP_SSR10_CTRL", 12 }, { "GPO_DRYER_SSR1_CTRL", 6 }, { "GPO_DRYER_SSR2_CTRL", 7 }, @@ -70,12 +71,13 @@ static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = { "GPO_EXTWINDER_SSR11_CTRL", 11 }, { "GPO_LED4", 30 }, { "GPO_MIXCHIP_SSR4_CTRL", 1 }, - { "GPO_SPARE1_1", 31 }, - { "GPO_SPARE1_2", 32 }, + { "GPO_SPARE1_1", 32 }, + { "GPO_SPARE1_2", 33 }, { "GPO_SPARE_SSR12_CTRL", 9 }, { "GPO_SPARE_SSR13_CTRL", 10 }, + { "GPO_TFEED_BREAK_1", 31 }, { "GPO_WASTECH_PUMP2", 13 }, - { "GPO_WHS_WTANKPUMP2", 37 }, + { "GPO_WHS_WTANKPUMP2", 38 }, { "Midtank1Air", 14 }, { "Midtank1Cartridge", 22 }, { "Midtank2Air", 15 }, @@ -92,7 +94,7 @@ static const ProtobufCEnumValueIndex interface_ios__enum_values_by_name[39] = { "Midtank7Cartridge", 28 }, { "Midtank8Air", 21 }, { "Midtank8Cartridge", 29 }, - { "VALVE_WASTE_TANK", 38 }, + { "VALVE_WASTE_TANK", 39 }, }; const ProtobufCEnumDescriptor interface_ios__descriptor = { @@ -101,11 +103,11 @@ const ProtobufCEnumDescriptor interface_ios__descriptor = "InterfaceIOs", "InterfaceIOs", "", - 39, + 40, interface_ios__enum_values_by_number, - 39, + 40, interface_ios__enum_values_by_name, - 9, + 10, interface_ios__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h index 341997ea0..1baf3dbc6 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/InterfaceIOs.pb-c.h @@ -51,6 +51,7 @@ typedef enum _InterfaceIOs { INTERFACE_IOS__Midtank7Cartridge = 179, INTERFACE_IOS__Midtank8Cartridge = 180, INTERFACE_IOS__GPO_LED4 = 274, + INTERFACE_IOS__GPO_TFEED_BREAK_1 = 296, INTERFACE_IOS__GPO_SPARE1_1 = 318, INTERFACE_IOS__GPO_SPARE1_2 = 319, INTERFACE_IOS__GPI_WCONTAINER_FULL = 341, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c index bfda97424..fb4967ab5 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.c @@ -358,7 +358,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "GateCfg1", 26, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_gatecfg1), offsetof(HardwareMotor, gatecfg1), NULL, @@ -370,7 +370,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "GateCfg2", 27, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_gatecfg2), offsetof(HardwareMotor, gatecfg2), NULL, @@ -379,10 +379,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalHold", + "TValHold", 28, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalhold), offsetof(HardwareMotor, tvalhold), NULL, @@ -391,10 +391,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalRun", + "TValRun", 29, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalrun), offsetof(HardwareMotor, tvalrun), NULL, @@ -403,10 +403,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalAcc", + "TValAcc", 30, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvalacc), offsetof(HardwareMotor, tvalacc), NULL, @@ -415,10 +415,10 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "TvalDec", + "TValDec", 31, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tvaldec), offsetof(HardwareMotor, tvaldec), NULL, @@ -430,7 +430,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TFast", 32, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tfast), offsetof(HardwareMotor, tfast), NULL, @@ -442,7 +442,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TOnMin", 33, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_tonmin), offsetof(HardwareMotor, tonmin), NULL, @@ -454,7 +454,7 @@ static const ProtobufCFieldDescriptor hardware_motor__field_descriptors[34] = "TOffMin", 34, PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_TYPE_INT32, offsetof(HardwareMotor, has_toffmin), offsetof(HardwareMotor, toffmin), NULL, @@ -493,11 +493,11 @@ static const unsigned hardware_motor__field_indices_by_name[] = { 31, /* field[31] = TFast */ 33, /* field[33] = TOffMin */ 32, /* field[32] = TOnMin */ + 29, /* field[29] = TValAcc */ + 30, /* field[30] = TValDec */ + 27, /* field[27] = TValHold */ + 28, /* field[28] = TValRun */ 18, /* field[18] = ThermalCompensationFactor */ - 29, /* field[29] = TvalAcc */ - 30, /* field[30] = TvalDec */ - 27, /* field[27] = TvalHold */ - 28, /* field[28] = TvalRun */ }; static const ProtobufCIntRange hardware_motor__number_ranges[1 + 1] = { diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h index 789e1e139..2dfc0b200 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Hardware/HardwareMotor.pb-c.h @@ -78,23 +78,23 @@ struct _HardwareMotor protobuf_c_boolean has_fsspd; int32_t fsspd; protobuf_c_boolean has_gatecfg1; - uint32_t gatecfg1; + int32_t gatecfg1; protobuf_c_boolean has_gatecfg2; - uint32_t gatecfg2; + int32_t gatecfg2; protobuf_c_boolean has_tvalhold; - uint32_t tvalhold; + int32_t tvalhold; protobuf_c_boolean has_tvalrun; - uint32_t tvalrun; + int32_t tvalrun; protobuf_c_boolean has_tvalacc; - uint32_t tvalacc; + int32_t tvalacc; protobuf_c_boolean has_tvaldec; - uint32_t tvaldec; + int32_t tvaldec; protobuf_c_boolean has_tfast; - uint32_t tfast; + int32_t tfast; protobuf_c_boolean has_tonmin; - uint32_t tonmin; + int32_t tonmin; protobuf_c_boolean has_toffmin; - uint32_t toffmin; + int32_t toffmin; }; #define HARDWARE_MOTOR__INIT \ { PROTOBUF_C_MESSAGE_INIT (&hardware_motor__descriptor) \ diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index a8bdaf95c..dd700563b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -730,7 +730,23 @@ void Pumps_Control(PUMPS_ENUM Pump_Id, bool Direction) //1 - OPEN, 0 - CLOSE ?? F1_gpo_01 = F1_GPO_Reg.ushort; } +uint32_t SecondaryPumpControlId; +uint32_t SecondaryPumpCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) +{ + Pumps_Control(WASTECH_PUMP2, CLOSE); + if (SafeRemoveControlCallback(SecondaryPumpControlId, SecondaryPumpCallBackFunction )==OK) + SecondaryPumpControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)SecondaryPumpControlId,RpWarning,(int)SecondaryPumpCallBackFunction,0); + +} + +void PumpActivation(uint32_t seconds) +{ + Pumps_Control(WASTECH_PUMP2, OPEN); + SecondaryPumpControlId = AddControlCallback( SecondaryPumpCallBackFunction, seconds*1000/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); +} /* uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode) { diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h index 9767837f1..420a82b47 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h @@ -237,6 +237,7 @@ typedef enum void Pumps_Control(PUMPS_ENUM Pump_Id, bool Direction); +void PumpActivation(uint32_t seconds); uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent); bool Check_Disp_Safety_Stop_Indication(uint8_t Dispenser_ID); bool Emergency_Push_Button_Report(); diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c index 07625d314..e130f4831 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -1167,7 +1167,8 @@ void FPGA_SetMotKvalRun(TimerMotors_t _motorId) Fpga_Spi[_motorId].TX_MOSI = temp; Fpga_Spi[_motorId].AMT_OF_Words = 4; - FPGA_SPI_Transnit(_motorId); + MillisecWriteToMotor(_motorId, temp, 4, NULL); + //FPGA_SPI_Transnit(_motorId); } void FPGA_SetMotKvalAcc(TimerMotors_t _motorId) @@ -1192,7 +1193,8 @@ void FPGA_SetMotKvalAcc(TimerMotors_t _motorId) Fpga_Spi[_motorId].TX_MOSI = temp; Fpga_Spi[_motorId].AMT_OF_Words = 4; - FPGA_SPI_Transnit(_motorId); + MillisecWriteToMotor(_motorId, temp, 4, NULL); +// FPGA_SPI_Transnit(_motorId); } void FPGA_SetMotKvalDec(TimerMotors_t _motorId) diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c index c58be6664..94f341b7d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/Control_File_System.c @@ -91,6 +91,7 @@ static FATFS g_sFatFs; //tFResultString; //static int response ; +extern Semaphore_Handle FFS_Sem; char FlashReadstring [35]; char FlashReadstring1 [35]; @@ -128,6 +129,8 @@ FRESULT Init_Flash_File_System(bool Need_mkfs) if(Need_mkfs == true) iFResult = f_mkfs( 0, 0, 512 ); //Create File System on the Drive + Semaphore_post(FFS_Sem); + return iFResult; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 83e041591..e2b0ed701 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -201,7 +201,7 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) / if (CallbackCalls%20 == 0) { // REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction"); - Report("Move_To_Stopper_Callback",__FILE__,__LINE__,MotorPosition,RpMessage,StoredMotorPosition[MotorId],0); + //Report("Move_To_Stopper_Callback",__FILE__,__LINE__,MotorPosition,RpMessage,StoredMotorPosition[MotorId],0); //CallbackCalls = 0; } @@ -285,7 +285,7 @@ uint32_t MotorMoveToDrierPositionCallBackFunction(uint32_t IfIndex, uint32_t Rea //CallbackCalls = 0; } - if (DrierZeroPosition == ReadValue) //thread running identified + //if (DrierZeroPosition == ReadValue) //thread running identified { //stop this control loop SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index 8dc53256b..9aa9b2470 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -1,5 +1,6 @@ var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); +var Seconds = xdc.useModule('ti.sysbios.hal.Seconds'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e3955793d..063d7c823 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -492,6 +492,8 @@ void setRapidPressureRead(bool value) { RapidPressureRead = value; } + +uint16_t PumpCounter = 0; uint32_t MillisecLowLoop(uint32_t tick) { uint8_t Motor_i,Disp_i,Heater_i,temp; @@ -501,13 +503,14 @@ uint32_t MillisecLowLoop(uint32_t tick) //call all modules Millisec functions //test dancers and speed encoders //check all callback units (state machine waiting for completion of a change) - bool Ten_msTick, Hundred_msTick , m90msecTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick; + bool Ten_msTick, Hundred_msTick , m90msecTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick,OneHourTick; Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; m90msecTick = (tick%eHundredMillisecond == 90) ?true:false; O900Millisecond_Tick = (tick%eOneSecond == 900) ?true:false; Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; OneMinute_Tick = (tick%eOneMinute == 0) ?true:false; + OneHourTick = (tick%eOneHour == 0) ?true:false; //gather Motor data from FPGA //ROM_IntMasterDisable(); @@ -611,6 +614,16 @@ uint32_t MillisecLowLoop(uint32_t tick) MotorGetStatusFromFPGA(Motor_i); }*/ } + if (OneHourTick) + { +#define PUMP_LIMIT 8 + PumpCounter++; + if (PumpCounter>=PUMP_LIMIT) + { + PumpActivation(900); + PumpCounter = 0; + } + } //ROM_IntMasterEnable(); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index f8a57362a..4597efa93 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -268,6 +268,9 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) else Lubricant_2Way_Valve(STOP);//use START or STOP, 0 - 100%(); break; + case INTERFACE_IOS__GPO_TFEED_BREAK_1: + Pumps_Control(WASTECH_PUMP2, request->value); + break; default: responseContainer.has_error = true; responseContainer.error = ERROR_CODE__GENERAL_ERROR; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index a22bfc815..98e760b32 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -115,7 +115,7 @@ DoubleArray DiagnosticsDispenserPressure[MAX_SYSTEM_DISPENSERS]; HeaterState **heatersstates; HeaterState HeaterInfo[HEATER_TYPE__MixerHeater+1]; DigitalInterfaceState **digitalinterfacestates; -DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+9]; +DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+10]; /*double dispenser1motorfrequency[DIAGNOSTICS_LIMIT+1]; double dispenser2motorfrequency[DIAGNOSTICS_LIMIT+1]; double dispenser3motorfrequency[DIAGNOSTICS_LIMIT+1]; @@ -390,7 +390,7 @@ void Diagnostic100msecCollection(void) dispenserspressure[i][DiagnosticsIndex] = GetDispenserPressure(i); //Read_MidTank_Pressure_Sensor MidTankpressure[i][0] = Get_MidTank_Pressure_Sensor(i); //MidTankpressure[i][0] = IDS_Dispenser_Data[i].totalconsumedinnanolitter; - MidTankpressure[i][0] = IDS_Dispenser_Data[i].consumedinnanolitter; + MidTankpressure[i][0] = 1.00-(IDS_Dispenser_Data[i].consumedinnanolitter/5800000); } #ifndef REDUCED_DIAGNOSTICS for (i=0;i<NUM_OF_CURRENT_HEATERS;i++) diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 52f4a3447..7e6ce928a 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -459,7 +459,7 @@ uint32_t HWConfigurationFunc(MessageContainer* requestContainer) ReadAppAndProgram(GENHWCFG_MAP_IN_FLASH, 4,&DataLen); ReadAppAndProgram(GENHWCFG_MAP_IN_FLASH+4, DataLen, requestContainer->data.data); - FileWrite(requestContainer->data.data, requestContainer->data.len,HwConfigPath); + FileWrite(requestContainer->data.data, requestContainer->data.len,HwConfigPath,BIOS_WAIT_FOREVER); UploadHardwareConfigurationRequest* UploadRequest = upload_hardware_configuration_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index 1c719d778..52f717626 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -538,14 +538,14 @@ uint32_t LoadStatMachine( button *pBtn) { case sttRDY : REPORT_MSG(parameter," ------------ load.state = sttRDY ----------------- "); - switch (pBtn->Action) +/* switch (pBtn->Action) { case (SHORTPB): case (LONGPB): case (REPLONGPB): pBtn->state = sttPRELOAD; - pBtn->color = BLINK; - if (ThreadLoadStateMachine( THREAD_LOAD_INIT)) + pBtn->color = BLINK;*/ + if (ThreadLoadButton( THREAD_LOAD_INIT)) { pBtn->state = sttPRELOAD ; // to do pBtn->color = BLUE; @@ -553,41 +553,54 @@ uint32_t LoadStatMachine( button *pBtn) } else { - pBtn->state = sttDISABLE ; + // pBtn->state = sttDISABLE ; Pannel_Leds(THREAD_LOAD, MODE_OFF);//AVI+ } - break; + /*break; default : break; - } + }*/ break; case sttPRELOAD: REPORT_MSG(parameter," ------------ load.state = sttPRELOAD ----------------- "); - switch (pBtn->Action) + /*switch (pBtn->Action) { case (SHORTPB): case (LONGPB): case (REPLONGPB): pBtn->color = BLUE; - Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ - if (ThreadLoadStateMachine( THREAD_LOAD_INITIAL_TENSION)) + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+*/ + if (ThreadLoadButton( THREAD_LOAD_INITIAL_TENSION)) { - pBtn->state = sttLOADSUCSESS ; // to do + pBtn->state = sttRDY ; // to do pBtn->color = BLUE; Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ } else { - pBtn->state = sttLOADFAIL ; + //pBtn->state = sttLOADFAIL ; pBtn->color = fastBILNK ; // to do } - break; + /*break; default : break; - } + }*/ break; case sttLOADING: REPORT_MSG(parameter," ------------ load.state = sttLOADING ----------------- "); + pBtn->color = fastBILNK; + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ + if (ThreadLoadButton( THREAD_LOAD_END)) + { + pBtn->state = sttRDY ; // to do + pBtn->color = BLUE; + Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ + } + else + { + //pBtn->state = sttLOADFAIL ; + pBtn->color = fastBILNK ; // to do + } break; // case sttLOADSUCSESS ????? // break; @@ -596,7 +609,8 @@ uint32_t LoadStatMachine( button *pBtn) default: //sttDISABLE REPORT_MSG(parameter," ------------ load.state = default ----------------- "); - pBtn->color = colorOFF; + pBtn->state = sttRDY ; // to do + pBtn->color = BREATHING; Pannel_Leds(THREAD_LOAD, MODE_OFF);//AVI+ break; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index b968381c6..2c8788bdc 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -191,7 +191,7 @@ void ProcessRequestFunc(MessageContainer* requestContainer) ProcessParameters* ProcessParams = request->processparameters; if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters { - FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath); + FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath,BIOS_WAIT_FOREVER); Bytes = sizeof(ProcessParameters); EraseFlashSection(PROCESS_PARAMETERS_MAP_IN_FLASH,Bytes+4); ReadAppAndProgram(PROCESS_PARAMETERS_MAP_IN_FLASH, 4,&Bytes); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 6d7f0df96..88032f756 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -298,7 +298,7 @@ uint32_t IDS_Dispenser_Store_Data (void) ReadAppAndProgram(DISPENSERS_MAP_IN_FLASH, 4,&response_size); ReadAppAndProgram(DISPENSERS_MAP_IN_FLASH+4, response_size, IDS_Dispenser_Data); - Status = FileWrite(IDS_Dispenser_Data,response_size,DispenserStorePath); + Status = FileWrite(IDS_Dispenser_Data,response_size,DispenserStorePath,BIOS_NO_WAIT); DispenserDataUpdated = false; REPORT_MSG(msec_millisecondCounter - timing, "Updating dispensers file - time"); return Status; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 837221274..366f4b163 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -45,18 +45,24 @@ 5 THREAD_LOAD_LIFT_DANCERS, 6 THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE 7 THREAD_LOAD_INITIAL_TENSION, //CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND - 8 THREAD_LOAD_CLOSE_ROCKERS, 9 THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD 10 THREAD_LOAD_CLOSE_LIDS, - 11 THREAD_LOAD_RESUME_HEATING, - 12 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION - 13 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 + 12 THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + 8 THREAD_LOAD_CLOSE_ROCKERS, + 11 THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT, //JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + 13 THREAD_LOAD_RESUME_HEATING, 14 THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING 15 THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM;*/ THREAD_LOAD_STAGES_ENUM LoadStages = THREAD_LOAD_INIT; ProcessParameters ProcessParametersClear,ProcessParametersRecover; + + int32_t keepmicrostep; + int32_t keepkvalrun; + uint8_t CallbackCounter = 0; + uint8_t TimeoutsCounter = 0; + uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; uint32_t ControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; @@ -163,7 +169,7 @@ } else*/ { - Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); //storeLoadArmParameters(); SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; @@ -173,6 +179,7 @@ } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { + if(PullerControlId != 0xFF) { MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); @@ -192,7 +199,8 @@ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz); // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); - Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + CallbackCounter = 0; + Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); NumberOfDrierLoaderCycles=0; //storeLoadArmParameters(); LoadStages++; @@ -224,13 +232,11 @@ //Use Notation How Many Rotations In The Drier, Or Check Against Stopper. Move Slowly return OK; } - uint8_t CallbackCounter = 0; - uint8_t TimeoutsCounter = 0; uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue) { - Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); - REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id"); + Report("Thread_Load_HomingCallback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); +// REPORT_MSG(MotorId, "Thread_Load_HomingCallback Motor Id"); if (CallbackCounter) { CallbackCounter--; @@ -249,12 +255,12 @@ else { LoadStages++; - if (LoadStages == THREAD_LOAD_LIFT_ROCKERS) + if (LoadStages == THREAD_LOAD_CLOSE_ROCKERS) { - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].microstep); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepmicrostep); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepmicrostep); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, keepkvalrun); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, keepkvalrun); } if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this stage we should wait for user call { @@ -303,16 +309,18 @@ uint32_t Thread_Load_Lift_Rockers(void) //Machine Is Ready. Send Message, Start Timer To Close Lids, Wait For Operator Response { + keepmicrostep = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].microstep; + keepkvalrun = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].kvalrun; REPORT_MSG(LoadStages, "Thread Load State Machine step"); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 1); - MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 1); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 35); - MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 35); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 2); + MotorSetMicroStep(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 2); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 70); + MotorSetKvalRun(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 70); Task_sleep(10); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 50, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,25000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 400, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000); return OK; } @@ -334,9 +342,9 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,12000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RLOADING], Thread_Load_HomingCallback,20000); CallbackCounter++; - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,12000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize, 300, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LLOADING], Thread_Load_HomingCallback,20000); return OK; } @@ -388,7 +396,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); CallbackCounter++; - MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 200, FEEDER_DANCER ,true, Thread_Load_HomingCallback,10000); + MotorMovetoDancerPosition (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 100, FEEDER_DANCER ,true, Thread_Load_HomingCallback,2000); return OK; } @@ -459,6 +467,7 @@ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4); ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+FEEDER_MOTOR),FEEDER_DANCER,FEEDER_MOTOR); + Report("AddControlCallback feeder",__FILE__,__LINE__,ControlId,RpMessage,IfTypeThread*0x100+FEEDER_MOTOR,0); CallbackCounter++; MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); @@ -466,7 +475,7 @@ //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = 0xFF; - FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); + FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); return OK; } uint32_t Thread_Load_Jog_ThreadStop(uint32_t index, uint32_t ReadValue) @@ -490,6 +499,24 @@ uint32_t Thread_Load_End(void) { REPORT_MSG(LoadStages,"Loading Ended"); + if(ControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz); + RemoveControlCallback(ControlId, ThreadLoadControlCBFunction ); + ControlId = 0xFF; + } + if(PullerControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz); + RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction ); + PullerControlId = 0xFF; + } + if(WinderControlId != 0xFF) + { + MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz); + RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction ); + WinderControlId = 0xFF; + } return OK; } uint32_t Thread_Load_Dryer_UnLoading(void) @@ -523,6 +550,7 @@ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize); PullerControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),POOLER_DANCER,POOLER_MOTOR); + Report("AddControlCallback Puller",__FILE__,__LINE__,PullerControlId,RpMessage,IfTypeThread*0x100+POOLER_MOTOR,0); //////////////////////// MotorControlConfig[WINDER_MOTOR].m_params.MAX = 1; MotorControlConfig[WINDER_MOTOR].m_params.MIN = MotorsControl[WINDER_MOTOR].outputproportionalpowerlimit*-1; @@ -544,6 +572,7 @@ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_WINDER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].directionthreadwize); WinderControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),WINDER_DANCER,WINDER_MOTOR); + Report("AddControlCallback Winder",__FILE__,__LINE__,WinderControlId,RpMessage,IfTypeThread*0x100+WINDER_MOTOR,0); //////////////////////// MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].directionthreadwize); @@ -553,13 +582,15 @@ //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + LoadArmInfo.LoadArmBackLash = 10; + status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = 0xFF; - FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath); + FileWrite(&LoadArmInfo, sizeof(LoadArmInfo),LoadArmPath,BIOS_WAIT_FOREVER); return OK; } @@ -613,10 +644,6 @@ //LoadStages++; Thread_Load_Close_Lids(); break; - case THREAD_LOAD_RESUME_HEATING: - //LoadStages++; - Thread_Load_Resume_Heating(); - break; case THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT://JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION //LoadStages++; Thread_Load_Jog_Feeder_To_Middle_Point(); @@ -626,6 +653,10 @@ //LoadStages++; Thread_Load_Dryer_Loading(); break; + case THREAD_LOAD_RESUME_HEATING: + //LoadStages++; + Thread_Load_Resume_Heating(); + break; case THREAD_LOAD_JOG_THREAD: //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING //LoadStages++; Thread_Load_Jog_Thread(); @@ -640,7 +671,18 @@ } return OK; } - +uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue) +{ + Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0); + if (LoadStages > ReadValue) + { + ThreadLoadStateMachine(LoadStages+1); + } + else + { + ThreadLoadStateMachine(ReadValue); + } +} uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { //read value is the dancer angle diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 167616afe..1544af59e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -58,17 +58,17 @@ typedef enum THREAD_LOAD_LIFT_DANCERS, THREAD_LOAD_LIFT_ROCKERS, //MACHINE IS READY. SEND MESSAGE, START TIMER TO CLOSE LIDS, WAIT FOR OPERATOR RESPONSE THREAD_LOAD_INITIAL_TENSION,//CHECK SPOOL PRESENCERUN WINDER UNTIL BREAK SENSOR IS IDENTIFIEING MOVEMENT FOR A SECOND - THREAD_LOAD_CLOSE_ROCKERS, THREAD_LOAD_CLOSE_DANCERS, //SEND DANCER MOTORS TO PRESET LOCATION, CHECK THAT THE DANCERS ARE ON THE THREAD THREAD_LOAD_CLOSE_LIDS, - THREAD_LOAD_RESUME_HEATING, - THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION THREAD_LOAD_DRYER_LOADING, //START FEEDER PID, ROTATE LOADING ARM COUNTER THREAD DIRECTION X CIRCLES ACCORDING TO RML. FEEDER SPEED IS 40 //KEEP NOTATION HOW MANY ROTATIONS IN THE DRYER + THREAD_LOAD_CLOSE_ROCKERS, + THREAD_LOAD_JOG_FEEDER_TO_MIDDLE_POINT,//JOG THE FEEDER MOTOR UNTIL THE FEEDER DANCER IS AT MIDDLE POSITION + THREAD_LOAD_RESUME_HEATING, THREAD_LOAD_JOG_THREAD, //JOG THREAD SHORTLY TO MAKE SURE SPOOL IS RUNNING. REPORT END OF LOADING THREAD_LOAD_END }THREAD_LOAD_STAGES_ENUM; -uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM ReadValue); +uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue); bool ThreadLoadingActive(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 500ba9a39..38c0f86f1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -174,7 +174,7 @@ uint32_t StoreDancerConfigMessage() { response_size = hardware_configuration__pack(&DancerConfig, response_buffer); } - Fresult = FileWrite(response_buffer,response_size,DancerConfigPath); + Fresult = FileWrite(response_buffer,response_size,DancerConfigPath,BIOS_WAIT_FOREVER); EraseFlashSection(DANCERS_MAP_IN_FLASH,1024); for (Dancer_i = 0; Dancer_i < MAX_SYSTEM_DANCERS; Dancer_i++) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index bdf8bd15d..3b972cc23 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -81,7 +81,10 @@ uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) else { if (MachineState == MACHINE_STATE_HW_CONFIG) + { + Report("HWConfigurationInit failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceCallBackFunction,0); MachineState = MACHINE_STATE_NO_CFG_FILE; + } } return OK; } @@ -284,6 +287,8 @@ uint32_t InitSequenceStartHeating(void) } else MachineState = MACHINE_STATE_MACHINE_READY_TO_DYE; + //activate second pump for 10 minutes + PumpActivation(600); return OK; } uint32_t InitSequenceMachineReadyToDye(void) |
