From 43fe89721c94b8a8b13d7598d2c25bfd1479a73b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 4 Feb 2019 11:06:34 +0200 Subject: bug correction in control - killed app --- Software/Embedded_SW/Embedded/Modules/Control/control.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 8349e7f91..0cda9b5a6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -208,8 +208,8 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF uint32_t device_i; uint32_t deviceId = 0xFF; - if (CtrlFrequency == eOneMillisecond) - { + //if (CtrlFrequency == eOneMillisecond) + //{ for(device_i = 0;device_i < MAX_TANGO_CONTROL_DEVICES;device_i++) { if (ControlArray[device_i].ControlActive == false) @@ -218,8 +218,8 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF break; } } - if ((deviceId!=0xFF )&&(deviceId> MaxHighDevices)) - MaxHighDevices = deviceId; + /* if ((deviceId!=0xFF )&&(deviceId> MaxHighDevices)) + // MaxHighDevices = deviceId; } else { @@ -231,7 +231,7 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF break; } } - } + }*/ if (deviceId == 0xFF) { @@ -348,7 +348,8 @@ uint32_t ControlLoop(uint32_t tick) Tick998 = (tick%eOneSecond == 996) ?true:false; */ //ROM_IntMasterDisable(); - for (ControlDevice_i = 0; ControlDevice_i < MaxHighDevices;ControlDevice_i++) + //for (ControlDevice_i = 0; ControlDevice_i < MaxHighDevices;ControlDevice_i++) + for (ControlDevice_i = 0; ControlDevice_i < MAX_TANGO_CONTROL_DEVICES;ControlDevice_i++) { if (ControlArray[ControlDevice_i].ControlActive) { -- cgit v1.3.1 From 6f82ed27ded46d18302ce46e0869435cd461e3b3 Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Mon, 4 Feb 2019 13:29:47 +0200 Subject: Add temporary function to test the breathing leds --- .../http_127.0.0.1.localstorage | 4 +- Software/Embedded_SW/.jxbrowser-data/Login Data | Bin 18432 -> 18432 bytes Software/Embedded_SW/Embedded/.cproject | 2 +- Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c | 55 +++++++++++++++++++++ .../Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h | 4 ++ .../Embedded/Modules/Control/MillisecTask.c | 2 + 6 files changed, 64 insertions(+), 3 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage b/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage index fec0901b2..c7f8a57ab 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage +++ b/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage @@ -1,4 +1,4 @@ -#Wed Jan 23 14:51:29 IST 2019 +#Mon Feb 04 13:00:42 IST 2019 viewsData-storage={"ti.sysbios.knl.Task.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"mode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"stackSize","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackBase","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"curCoreId","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"affinity","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.knl.Task"\:{"defaultViewName"\:"CallStacks"},"ti.sysbios.family.arm.m3.Hwi.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"halHwiHandle","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"type","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"intNum","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"group","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"subPriority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg","checked"\:true,"hasFormat"\:true,"format"\:"Hex"}],"hasFormats"\:true},"ti.sysbios.family.arm.m3.Hwi"\:{"defaultViewName"\:"Exception"},"ti.sysbios.knl.Task.Detailed"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"mode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"stackPeak","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackSize","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackBase","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"curCoreId","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"affinity","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"blockedOn","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.family.arm.m3.Hwi.Detailed"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"halHwiHandle","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"type","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"intNum","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"group","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"subPriority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"irp","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"status","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"coreId","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"}],"hasFormats"\:true},"ti.sysbios.heaps.HeapMem.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"buf","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"minBlockAlign","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"sectionName","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.knl.Event"\:{"defaultViewName"\:"Basic"},"ti.sysbios.knl.Event.Raw"\:{},"ti.catalog.arm.cortexm4.tiva.ce.Boot.Module"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"configureClock","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"sysClockDivEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"sysClockDiv","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pwmClockDivEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pwmClockDiv","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"xtal","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"oscSrc","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pllBypass","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pllOutEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"ioscDisable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"moscDisable","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:false},"ti.sysbios.knl.Swi.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"state","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"initTrigger","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"curTrigger","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"}],"hasFormats"\:true},"xdc.runtime.System.XDCROOT"\:{"columnStates"\:[{"name"\:"entry","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:false},"xdc.runtime.System"\:{"defaultViewName"\:"Raw"},"xdc.runtime.System.Raw"\:{},"ti.sysbios.family.arm.m3.Hwi.Raw"\:{},"xdc.runtime.Startup.Module"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"rtsStartupDone","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"startupBegun","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"resetFxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"firstFxns","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"lastFxns","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.knl.Semaphore.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"event","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"eventId","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"mode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"count","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"pendedTasks","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.family.arm.lm4.Timer.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"halTimerHandle","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"id","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"device","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"startMode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"runMode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"period","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"periodType","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"intNum","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"tickFxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"extFreq","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"hwiHandle","checked"\:true,"hasFormat"\:true,"format"\:"Hex"}],"hasFormats"\:true},"xdc.runtime.SysMin.Module"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"outBuf","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"outBufIndex","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"wrapped","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true}} rovSettings-storage={"exeMrus"\:["C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","C\:/Tango/Software/Embedded_SW/Embedded/debug_w_pmr/Embedded.out"]} -rovInit-storage={"progressInfo"\:{"min"\:0,"max"\:7,"step"\:1,"notifyCount"\:6,"average"\:6,"numLoads"\:20},"autoConnectChecked"\:false,"exe"\:"C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","commLink"\:"Debugger","autoConnect"\:false,"noExe"\:false,"showIntro"\:true} +rovInit-storage={"progressInfo"\:{"min"\:0,"max"\:7,"step"\:1,"notifyCount"\:6,"average"\:6,"numLoads"\:21},"autoConnectChecked"\:false,"exe"\:"C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","commLink"\:"Debugger","autoConnect"\:false,"noExe"\:false,"showIntro"\:true} diff --git a/Software/Embedded_SW/.jxbrowser-data/Login Data b/Software/Embedded_SW/.jxbrowser-data/Login Data index d73270d9f..7684f598d 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/Login Data and b/Software/Embedded_SW/.jxbrowser-data/Login Data differ diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject index 20edaeefb..38422568f 100644 --- a/Software/Embedded_SW/Embedded/.cproject +++ b/Software/Embedded_SW/Embedded/.cproject @@ -169,7 +169,7 @@ - + diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c index 13c31fb49..09cd03a26 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c @@ -296,3 +296,58 @@ void Control_Dryer_Fan_PWM(uint8_t PWN_Command_Precent)// 0 - 100% // low + high = 0xFF in order use the same freq (and change the freq only by Add 0x112). // there is option to change only the high (low + freq constasnt) this will chnga the freq } + +void Control_LED1_PWM() //if (Ten_msTick) +{ + // change to cycle to 100 in order to work with %, with constant FREQ + + F3_Prescaler1_reg5 = 0x03; + + //uint8_t Freq = 0x3;//divider Clock = 25M/divider + + static uint8_t PWN_Command_Precent = 0;// 0 - 100% + static uint8_t direction = UP; + +/* if(PWN_Command_Precent > 100) + PWN_Command_Precent = 100;*/ + + // GPO_BLOWER_PWM_FREQ = Freq; + + + F3_Prescaler1_reg9 = PWN_Command_Precent + 1; + F3_Prescaler1_reg10 = 101 - PWN_Command_Precent; + + if(direction == UP) + { + if (PWN_Command_Precent == 100) + { + direction = DOWN; //"0" + //PWN_Command_Precent--; + //delayms(20); + } + else + { + PWN_Command_Precent++; + } + } + else + if(direction == DOWN) + { + if (PWN_Command_Precent == 0) + { + direction = UP;//"1" + //PWN_Command_Precent++; + //delayms(20); + } + else + { + PWN_Command_Precent--; + } + + } + //delayms(10); + + // low + high = 0xFF in order use the same freq (and change the freq only by Add 0x112). + // there is option to change only the high (low + freq constasnt) this will chnga the freq +} + diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h index 7c052fcde..bfd21eb92 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h @@ -699,6 +699,10 @@ //Test #define F3_Test (*((volatile short *)(FPGA3_BASE | 0x3F0))) //Readback not - gives the inverse of the written to value +//LEDS +#define F3_Prescaler1_reg9 (*((volatile short *)(FPGA3_BASE | 0x390))) //Parameter for prescaler divisions +#define F3_Prescaler1_reg10 (*((volatile short *)(FPGA3_BASE | 0x392))) //Parameter for prescaler divisions + //1 Version1_Direct typedef union { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index eb4d0a49a..10286853e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -420,6 +420,7 @@ uint32_t MillisecLoop(uint32_t tick) Dancer_Data[FEEDER_DANCER] = Read_Dancer_Position(FEEDER_DANCER); Dancer_Data[POOLER_DANCER] = Read_Dancer_Position(POOLER_DANCER); Dancer_Data[WINDER_DANCER] = Read_Dancer_Position(WINDER_DANCER); + return OK; } uint32_t MillisecLowLoop(uint32_t tick) @@ -445,6 +446,7 @@ uint32_t MillisecLowLoop(uint32_t tick) //Speed_Data = Calculate_Speed_Sensor_Velocity(); //MillisecReadFromTempSensor(Sensor_Read, NULL); //if (Sensor_Read++ >= MAX_TEMPERATURE_SENSOR_ID) Sensor_Read = 0; + //Control_LED1_PWM(); } if (Hundred_msTick) { -- cgit v1.3.1 From 5a3c7560c32ad3346fa2648466e9791c8bebf2aa Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Thu, 7 Feb 2019 17:59:02 +0200 Subject: update the logic of Machine Leds (using PWM) and few changes in the buttons logic --- Software/Embedded_SW/.jxbrowser-data/Cache/data_0 | Bin 45056 -> 45056 bytes Software/Embedded_SW/.jxbrowser-data/Cache/data_1 | Bin 270336 -> 270336 bytes Software/Embedded_SW/.jxbrowser-data/Cache/data_2 | Bin 1056768 -> 1056768 bytes Software/Embedded_SW/.jxbrowser-data/Cache/data_3 | Bin 4202496 -> 4202496 bytes .../Embedded_SW/.jxbrowser-data/GPUCache/data_1 | Bin 270336 -> 270336 bytes Software/Embedded_SW/Embedded/DataDef.h | 21 ++++- Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c | 86 +++++++++---------- Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.h | 7 +- .../Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h | 18 ++++ .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 94 +++++++++++++++++++-- .../Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h | 5 +- .../Embedded/Drivers/FPGA/FPGA_Rename.h | 13 --- Software/Embedded_SW/Embedded/Main.c | 15 ++-- .../Embedded/Modules/Control/MillisecTask.c | 5 +- .../Embedded_SW/Embedded/Modules/Control/control.c | 25 ++++++ .../Embedded_SW/Embedded/Modules/General/buttons.c | 71 ++++++---------- .../Embedded_SW/Embedded/Modules/General/buttons.h | 45 ++++++++++ 17 files changed, 279 insertions(+), 126 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 index 43bc4dd30..adc88c379 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 and b/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 differ diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 index 98e1cbae6..d90950213 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 and b/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 differ diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 index 616f7914e..2fc7e1796 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 and b/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 differ diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 index af4db3b45..afcad155c 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 and b/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 differ diff --git a/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 b/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 index 33c2cc543..9690a743d 100644 Binary files a/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 and b/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 differ diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 4c7698c1b..5397d2f6c 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -198,12 +198,26 @@ enum #define BIT31 0x80000000 //0x01 << 31 +#define MAX_PWM_Command 100 + +typedef enum +{ + //Don't change the value - keep it according to the bits in F3_GPO_02_bus + CART_1 = 1, + CART_2 = 2, + CART_3 = 3, + //------------- + POWER_ON_OFF, + THREAD_JOGGING , + THREAD_LOAD , +}PANEL_BUTTONS_LEDS_ID; + typedef enum { MODE_OFF = 0, MODE_ON = 1, }OPERATION_MODE; - +/* typedef enum { //according to the bits of the leds in F3_GPO_01_bus @@ -211,7 +225,8 @@ typedef enum THREAD_LOADING = 2, JOGGING = 3, }BUTTON; - +*/ +/* typedef enum { //According to the bits of the leds in F3_GPO_02_bus @@ -219,7 +234,7 @@ typedef enum CART2 = 2, CART3 = 3, }CARTREGE; - +*/ //--------------------- #define MaxFlashWords 128 //1K #define MaxFlashBytes MaxFlashWords*4 //4K Byte diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c index a6bd8b1d5..fdcf33587 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c @@ -199,7 +199,7 @@ uint32_t Read_Fans_Tacho() #ifndef EVALUATION_BOARD // The big Fan in the drawer - Drawer_Fan_Speed_RPM = Calculate_Tacho_Fan_Speed(25000000, 0X02, F1_Prescaler1_reg5, F1_Tacho_reg0); + Drawer_Fan_Speed_RPM = Calculate_Tacho_Fan_Speed(29166666, 0X02, F1_Prescaler1_reg5, F1_Tacho_reg0); if( Drawer_Fan_Speed_RPM < 1000 ) // need to work around 3000 RPM Status|= 0x01;// not working / Low Speed @@ -246,31 +246,31 @@ uint32_t Read_Fans_Tacho() } //------------------------- WHS ---------------------- -uint32_t WHS_Read_Blower_Tach() -{ - //TODO: check if we need to change the Prescaler - //F2_Prescaler1_reg10 - prescaled clocks for counter of signal Blower Tacho. 8 bits - - - /* - RPM=60* (Sys_clk/PreScalar)/ F2_Tacho_reg0 - - Where : - - Sys_clk =25*10^6 (25Mhz) - PresScalar(default) =250 - - Mati - */ - uint32_t RPM; - uint32_t Temp = 6000000; // 60* (Sys_clk/PreScalar) - RPM = Temp / GPI_BLOWER_TACH; - - return RPM; -} +//uint32_t WHS_Read_Blower_Tach() +//{ +// //TODO: check if we need to change the Prescaler +// //F2_Prescaler1_reg10 - prescaled clocks for counter of signal Blower Tacho. 8 bits +// +// +// /* +// RPM=60* (Sys_clk/PreScalar)/ F2_Tacho_reg0 +// +// Where : +// +// Sys_clk =25*10^6 (25Mhz) +// PresScalar(default) =250 +// +// Mati +// */ +// uint32_t RPM; +// uint32_t Temp = 6000000; // 60* (Sys_clk/PreScalar) +// RPM = Temp / GPI_BLOWER_TACH; +// +// return RPM; +//} //------------------------- Dryer Blower ---------------------- - +/* uint32_t Dryer_Read_Blower_Tach() { uint32_t RPM; @@ -278,8 +278,19 @@ uint32_t Dryer_Read_Blower_Tach() RPM = WHS_Read_Blower_Tach(); // Temporary using WHS Tacho return RPM; } +*/ + +uint32_t Read_Dryer_Fan_Tacho() +{ + + uint32_t Drayer_Fan_Speed_RPM = 0; + + Drayer_Fan_Speed_RPM = Calculate_Tacho_Fan_Speed(25000000, 12, F1_Prescaler1_reg5, F1_Tacho_reg8); + return Drayer_Fan_Speed_RPM; +} + void Control_Dryer_Fan_PWM(uint8_t PWM_Command_Precent)// 0 - 100% { // change to cycle to 100 in order to work with %, with constant FREQ @@ -297,33 +308,19 @@ void Control_Dryer_Fan_PWM(uint8_t PWM_Command_Precent)// 0 - 100% // there is option to change only the high (low + freq constasnt) this will chnga the freq } -void Control_LED1_PWM() //if (Ten_msTick) +void Machine_Idle_Breathing_Led() //if (Ten_msTick) { - // change to cycle to 100 in order to work with %, with constant FREQ - - F3_Prescaler1_reg5 = 0x03; - - //uint8_t Freq = 0x3;//divider Clock = 25M/divider - static uint8_t PWM_Command_Precent = 0;// 0 - 100% static uint8_t direction = UP; -/* if(PWM_Command_Precent > 100) - PWM_Command_Precent = 100;*/ - - // GPO_BLOWER_PWM_FREQ = Freq; - - F3_low_var_LED1 = PWM_Command_Precent + 1; - F3_high_var_LED1 = 101 - PWM_Command_Precent; + F3_high_var_LED1 = MAX_PWM_Command + 1 - PWM_Command_Precent; if(direction == UP) { - if (PWM_Command_Precent == 100) + if (PWM_Command_Precent == MAX_PWM_Command) { direction = DOWN; //"0" - //PWM_Command_Precent--; - //delayms(20); } else { @@ -336,18 +333,11 @@ void Control_LED1_PWM() //if (Ten_msTick) if (PWM_Command_Precent == 0) { direction = UP;//"1" - //PWM_Command_Precent++; - //delayms(20); } else { PWM_Command_Precent--; } - } - //delayms(10); - - // low + high = 0xFF in order use the same freq (and change the freq only by Add 0x112). - // there is option to change only the high (low + freq constasnt) this will chnga the freq } diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.h index 195dbd562..93e0046b6 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.h @@ -8,10 +8,13 @@ void FPGA_Init(); //void FPGA_Read_limit_Switches(void); uint32_t Read_Fans_Tacho(); -uint32_t WHS_Read_Blower_Tach(); +//uint32_t WHS_Read_Blower_Tach(); -uint32_t Dryer_Read_Blower_Tach(); +//uint32_t Dryer_Read_Blower_Tach(); void Control_Dryer_Fan_PWM(uint8_t PWM_Command_Precent); +void Machine_Idle_Breathing_Led(); + +uint32_t Read_Dryer_Fan_Tacho(); diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h index 7b29ec150..942846679 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h @@ -724,6 +724,24 @@ //Test #define F3_Test (*((volatile short *)(FPGA3_BASE | 0x3F0))) //Readback not - gives the inverse of the written to value + +// ----------------------- BLOWER ----------------------- +#define GPI_BLOWER_TACH F2_Tacho_reg0 + +//WHS GPO_BLOWER_PWM - See the stub "GPO_BLOWER_PWM.cs" +#define GPO_BLOWER_PWM_FREQ F2_Prescaler1_reg11 +#define GPO_BLOWER_PWM_LOW F2_Prescaler1_reg6 +#define GPO_BLOWER_PWM_HIGH F2_Prescaler1_reg7 + +// ----------------------- LEDS ----------------------- +#define F3_LOw_Cart_Led1 F3_low_var_SPARE1_2 +#define F3_High_Cart_Led1 F3_high_var_SPARE1_2 +#define F3_LOw_Cart_Led2 F3_low_var_SPARE2_1 +#define F3_High_Cart_Led2 F3_high_var_SPARE2_1 +#define F3_LOw_Cart_Led3 F3_low_var_SPARE2_2 +#define F3_High_Cart_Led3 F3_high_var_SPARE2_2 + + //1 Version1_Direct typedef union { 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 37be39e27..49b1ce649 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 @@ -20,6 +20,8 @@ FPGA_GPI FPGA_Gpi; bool FPGA_Gpi_Buf[MAX_GPI] = {0}; +extern bool Machine_Idle_Mode; + void Read_FPGA_GPI_Rgisters() { uint32_t i; @@ -646,7 +648,7 @@ void Pumps_Control(PUMPS_ENUM Pump_Id, bool Direction) //1 - OPEN, 0 - CLOSE ?? F1_gpo_01 = F1_GPO_Reg.ushort; } - +/* uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode) { uint8_t Status = OK; @@ -666,7 +668,7 @@ uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode) return Status; } - +*/ uint8_t Buzzer(OPERATION_MODE Buzzer_Mode) { uint8_t Status = OK; @@ -697,7 +699,7 @@ bool Read_PWR_Button()//TODO move to GPIO folder return IsPowerPressed; } - +/* uint8_t Cartridges_LEDS(CARTREGE Cartridge, OPERATION_MODE LED_Mode) // CART1_LAMP, CART2_LAMP,CART3_LAMP { uint8_t Status = OK; @@ -717,18 +719,96 @@ uint8_t Cartridges_LEDS(CARTREGE Cartridge, OPERATION_MODE LED_Mode) // CART1_LA return Status; } +*/ +uint8_t Pannel_Leds(PANEL_BUTTONS_LEDS_ID Pannel_Led_Id, OPERATION_MODE LED_Mode) +{ + uint8_t Status = OK; + + short Low_Reg; + short High_Reg; + + switch(LED_Mode) + { + case MODE_ON: + Low_Reg = 1; + High_Reg = MAX_PWM_Command +1; + break; + case MODE_OFF: + Low_Reg = MAX_PWM_Command +1; + High_Reg = 1; + break; + default: + Status = ERROR; + break; + } + + if(Status == OK) + { + switch(Pannel_Led_Id) + { + case POWER_ON_OFF: + F3_low_var_LED1 = Low_Reg; + F3_high_var_LED1 = High_Reg; + Machine_Idle_Mode = false; + break; + case THREAD_JOGGING: + F3_low_var_LED2 = Low_Reg; + F3_high_var_LED2 = High_Reg; + break; + case THREAD_LOAD: + F3_low_var_LED3 = Low_Reg; + F3_high_var_LED3 = High_Reg; + break; + case CART_1: + F3_LOw_Cart_Led1 = Low_Reg; + F3_High_Cart_Led1 = High_Reg; + break; + case CART_2: + F3_LOw_Cart_Led2 = Low_Reg; + F3_High_Cart_Led2 = High_Reg; + break; + case CART_3: + F3_LOw_Cart_Led3 = Low_Reg; + F3_High_Cart_Led3 = High_Reg; + break; + default: + Status = ERROR; + break; + } + } + return Status; +} + +uint8_t Init_Machine_Leds() +{ + uint8_t Status = OK; + + F3_Prescaler1_reg5 = 0x03; // PWM LED Prescaler default in FPGA just to verify + + Status |= Pannel_Leds(POWER_ON_OFF,MODE_ON); + + Status |= Pannel_Leds(THREAD_JOGGING,MODE_OFF); + Status |= Pannel_Leds(THREAD_LOAD,MODE_OFF); + + Status |= Pannel_Leds(CART_1,MODE_OFF); + Status |= Pannel_Leds(CART_2,MODE_OFF); + Status |= Pannel_Leds(CART_3,MODE_OFF); + + return Status; +} + -bool Read_Cartridge_Button(CARTREGE Cartridge)//TODO Update the polarity!!! +bool Read_Cartridge_Button(PANEL_BUTTONS_LEDS_ID Cartridge)//TODO Update the polarity!!! { bool IsCartPressed = false; - if((Cartridge == CART1) && (F3_CARTx_PRES_02_Direct & BIT7)) + if((Cartridge == CART_1) && (F3_CARTx_PRES_02_Direct & BIT7)) IsCartPressed = true; else - if((Cartridge == CART2) && (F3_CARTx_PRES_02_Direct & BIT6)) + if((Cartridge == CART_2) && (F3_CARTx_PRES_02_Direct & BIT6)) IsCartPressed = true; else - if((Cartridge == CART3) && (F3_CARTx_PRES_02_Direct & BIT5)) + if((Cartridge == CART_3) && (F3_CARTx_PRES_02_Direct & BIT5)) IsCartPressed = true; return IsCartPressed; 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 42a0f07d6..1def86036 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 @@ -187,7 +187,7 @@ uint32_t ActivateDilutorPump(); uint32_t DeActivateDilutorPump(); void Power_Off(); void Power_Reset(); -uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode); +//uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode); uint8_t Buzzer(OPERATION_MODE Buzzer_Mode); bool Read_PWR_Button();//TODO move to GPIO folder @@ -234,6 +234,7 @@ uint32_t Control_Dryer_Fan(bool StartStop, uint8_t PWM_Command_Precent); bool Check_Disp_Sfaty_Stop_Indication(uint8_t Dispenser_ID); bool Emergency_Push_Button_Report(); bool Dryer_Door_Switch(); - +uint8_t Pannel_Leds(PANEL_BUTTONS_LEDS_ID Pannel_Led_Id, OPERATION_MODE LED_Mode); +uint8_t Init_Machine_Leds(); #endif /* DRIVERS_FPGA_FPGA_GPIO_FPGA_GPIO_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Rename.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Rename.h index 90e30a8f2..8a7ce08c1 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Rename.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Rename.h @@ -45,20 +45,7 @@ //#define CART3_RST aaaaaaaa #define GPO_DH_MAGNET GPO_TFEED_BREAK_1 -// ----------------------- BLOWER ----------------------- -#define GPI_BLOWER_TACH F2_Tacho_reg0 -//WHS GPO_BLOWER_PWM - See the stub "GPO_BLOWER_PWM.cs" -#define GPO_BLOWER_PWM_FREQ F2_Prescaler1_reg11 -#define GPO_BLOWER_PWM_LOW F2_Prescaler1_reg6 -#define GPO_BLOWER_PWM_HIGH F2_Prescaler1_reg7 - -#define F3_LOw_Cart_Led1 F3_low_var_SPARE1_2; -#define F3_High_Cart_Led1 F3_high_var_SPARE1_2; -#define F3_LOw_Cart_Led2 F3_low_var_SPARE2_1; -#define F3_High_Cart_Led2 F3_high_var_SPARE2_1; -#define F3_LOw_Cart_Led3 F3_low_var_SPARE2_2; -#define F3_High_Cart_Led3 F3_high_var_SPARE2_2; diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index b13bab1d5..64505193d 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -83,6 +83,8 @@ static volatile uint32_t g_ui32SysTickCount = 0; // Flags used to pass commands from interrupt context to the main loop. static volatile uint32_t g_ui32Flags; +bool Machine_Idle_Mode = false; + //MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*)); uint32_t MainDummyFunction(uint32_t IfIndex, uint32_t ReadValue) { @@ -205,14 +207,13 @@ int main(void) //GetFiles(); - to start jtag //GetVmeByte(); - ////////////////////////////////// - #warning - //Turn off LED1 //TODO temporary to stop the breathing leds - need the change the FPGA 3 - F3_Prescaler1_reg5 = 0x03; - F3_low_var_LED1 = 101; - F3_high_var_LED1 = 1; + // + //test_avi(); //example for shai + + #ifndef EVALUATION_BOARD + Init_Machine_Leds(); + #endif - //////////////////////////// // Enable interrupts to the processor. // diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 10286853e..4f78d2134 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -83,6 +83,8 @@ bool watchdogCriticalAlarm = false; uint32_t msec_millisecondCounter = 0; +extern bool Machine_Idle_Mode; + MillisecMotorDataStruc ScrewSetMaxSpeedPending = {0}; MillisecMotorDataStruc ScrewMovePending = {0}; MillisecMotorDataStruc MotorData[NUM_OF_MOTORS] = {0}; @@ -446,7 +448,8 @@ uint32_t MillisecLowLoop(uint32_t tick) //Speed_Data = Calculate_Speed_Sensor_Velocity(); //MillisecReadFromTempSensor(Sensor_Read, NULL); //if (Sensor_Read++ >= MAX_TEMPERATURE_SENSOR_ID) Sensor_Read = 0; - //Control_LED1_PWM(); + if(Machine_Idle_Mode == true) + Machine_Idle_Breathing_Led(); } if (Hundred_msTick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 0cda9b5a6..100fefbd8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -51,6 +51,7 @@ #include #include "drivers/adc_sampling/adc.h" +#include "Modules/General/buttons.h" #include "control.h" #include "MillisecTask.h" @@ -157,10 +158,20 @@ void ControlStop(void) uint32_t ControlActivityLed( uint32_t Parameter1) { static bool flag = false; + static uint8_t counter; + const uint8_t Blink_Freq = 15;//odd number + if (flag==true) { COMM_RED_LED_ON; ACTIVITY_RED_LED_OFF; // Heaters indication - all the Heaters OFF + if(power.color == fastBILNK) + Pannel_Leds(POWER_ON_OFF,MODE_OFF); + + if((power.color == BLINK) && (counter % Blink_Freq == 0) ) + { + Pannel_Leds(POWER_ON_OFF,MODE_OFF); + } flag = false; } else @@ -168,8 +179,22 @@ uint32_t ControlActivityLed( uint32_t Parameter1) COMM_RED_LED_OFF; if (HeaterActive > 0)// Blink the led on heating ACTIVITY_RED_LED_ON;// Heaters indication - at least one of the Heaters is ON + + if(power.color == fastBILNK) + Pannel_Leds(POWER_ON_OFF,MODE_ON); + + if((power.color == BLINK) && (counter % Blink_Freq == 0) ) + { + Pannel_Leds(POWER_ON_OFF,MODE_ON); + } + flag = true; } + + if (counter < 0xFF) + counter++; + else + counter = Blink_Freq + 1; return OK; } uint32_t ControlEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue) diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index 68199d19f..f80727dfc 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -10,8 +10,9 @@ #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"//#include "FPGA_GPIO.h" // use for FPGA IO #include "DataDef.h" // use for FPGA IO #include "Modules/Control/control.h" // use for FPGA IO - +#include "Modules/General/buttons.h" #include "StateMachines/Printing/PrintingSTM.h" +#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include #include @@ -26,15 +27,8 @@ int ch_to_power_down(); int ch_to_power_up(); int thredJog(); -typedef enum -{ - colorOFF = 0, - BLUE, - BLINK, - fastBILNK, - BREATHING -} PBcolor; +/* typedef enum { OFFPB = 0, @@ -43,7 +37,7 @@ typedef enum LONGPB , REPLONGPB //repeat long PB }PBstat; - +*/ typedef enum { MSEC = 0, @@ -53,47 +47,26 @@ typedef enum MORE5000 }timems; -typedef enum -{ - sttOFF = 0, - sttON, - sttDISABLE, - sttENABLE, - sttIDLE, - sttJOGGING, - sttRDY, - sttPRELOAD, - sttLOADING, - sttLOADSUCSESS, - sttLOADFAIL -} PBmachinState; + //enum PBstat OnOffPBstate = OFFPB; //enum PBstat ret //enum PBstat threadPB = OFFPB; -struct button -{ - char bttn_name[10]; //option - int bttn_status; // 0=release 1=press - /* enum */ PBstat Action; //offPB,shortPB,longPB,countPB,replongPB - /* enum */ PBcolor color; //off, blue, blink, bithing - /* enum */ PBmachinState state; //sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING - uint32_t count; -}; - -struct button power , jog, load; + + +button power , jog, load; uint32_t ButtonsCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); uint32_t ButtonsCBFunction(uint32_t IfIndex, uint32_t ReadValue); -uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn); -uint32_t StateMachine(struct button *pBtn); +uint32_t ShortLongOffPB(uint8_t OnOffPB, button *pBtn); +uint32_t StateMachine( button *pBtn); uint32_t ButtonJogCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue); uint8_t thraedJogging(uint8_t off); -uint32_t setJoggingEnableCondition(struct button *pBtn); -uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn); +uint32_t setJoggingEnableCondition( button *pBtn); +uint32_t joggingMachine(uint8_t OnOffPB, button *pBtn); uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); @@ -251,7 +224,7 @@ int StopTimer() //ShortLongOffPB( OnOffPB, &ret) -uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn) +uint32_t ShortLongOffPB(uint8_t OnOffPB, button *pBtn) { uint8_t parameter = 0 ; // why we need it!!!! @@ -333,7 +306,7 @@ uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn) -uint32_t StateMachine(struct button *pBtn) //short press(=0)/long press(=1) +uint32_t StateMachine( button *pBtn) //short press(=0)/long press(=1) { uint8_t parameter = 1; @@ -373,10 +346,12 @@ uint32_t StateMachine(struct button *pBtn) //short press(=0)/long press(=1) { case LONGPB: //Power off from idle pBtn->state = sttOFF; // todo + Pannel_Leds(POWER_ON_OFF,MODE_OFF); //AVI+ - TODO option MODE_ON to stop Breathing and the led will turn off in power down REPORT_MSG(parameter,"Power state is OFF "); break; case SHORTPB: //Wake up from idle pBtn->state = sttON;// to do ? + Pannel_Leds(POWER_ON_OFF,MODE_ON); //AVI+ REPORT_MSG(parameter,"Power state is ON "); break; default: @@ -406,7 +381,7 @@ return 0; -uint32_t setJoggingEnableCondition(struct button *pBtn) +uint32_t setJoggingEnableCondition( button *pBtn) { if (0 // 1. @@ -443,12 +418,13 @@ return 0; */ -uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn) +uint32_t joggingMachine(uint8_t OnOffPB, button *pBtn) { if (sttDISABLE == pBtn->state) { // jogging is disable pBtn->color = colorOFF; + Pannel_Leds(THREAD_JOGGING,MODE_OFF);//AVI+ } else { @@ -456,6 +432,7 @@ uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn) { ThreadAbortJoggingFunc(); // to do!!!! pBtn->color = BLUE; + Pannel_Leds(THREAD_JOGGING,MODE_ON);//AVI+ } else { @@ -534,5 +511,13 @@ ShortLongOffPB( threadPB, ret,struct button *pBtn); } */ +void test_avi() +{ + + power.color = BLINK; + //power.color = fastBILNK + //Machine_Idle_Mode = true; + +} diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h index 897fb6031..e7a611e9b 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h @@ -1,6 +1,51 @@ #ifndef BUTTONS_H #define BUTTONS_H +typedef enum +{ + colorOFF = 0, + BLUE, + BLINK, + fastBILNK, + BREATHING +} PBcolor; + +typedef enum +{ + OFFPB = 0, + COUNTPB , + SHORTPB , + LONGPB , + REPLONGPB //repeat long PB +}PBstat; + +typedef enum +{ + sttOFF = 0, + sttON, + sttDISABLE, + sttENABLE, + sttIDLE, + sttJOGGING, + sttRDY, + sttPRELOAD, + sttLOADING, + sttLOADSUCSESS, + sttLOADFAIL +} PBmachinState; + +typedef struct +{ + char bttn_name[10]; //option + int bttn_status; // 0=release 1=press + /* enum */ PBstat Action; //offPB,shortPB,longPB,countPB,replongPB + /* enum */ PBcolor color; //off, blue, blink, bithing + /* enum */ PBmachinState state; //sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING + uint32_t count; +}button; + +extern button power , jog, load; + uint32_t Buttons_Init(void); uint32_t Button_load_Init(void); uint32_t Button_JOG_Init(void); -- cgit v1.3.1