From 3cbfa58f4a68e778b84124ae2f6d3d4d0d32e64c Mon Sep 17 00:00:00 2001 From: Shai Frieder Date: Sun, 22 Sep 2019 14:10:25 +0300 Subject: fix press 4 times Load Thred --- .../Embedded_SW/Embedded/Modules/General/buttons.c | 20 ++++++++++++++------ .../Embedded_SW/Embedded/Modules/Waste/Waste_init.c | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index 2e6d7e3b5..e691cad69 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -149,7 +149,7 @@ uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) //uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 ); //Power_Reset()// Resets the MCU -#define BUTTOMS_SAMPLE_TIME 50 +#define BUTTONS_SAMPLE_TIME (eTenMillisecond*50) uint32_t Buttons_Init(void) { @@ -160,7 +160,7 @@ uint32_t Buttons_Init(void) power.state = sttON; //sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING power.count = 0; - AddControlCallback( ButtonPowerCBFunction, BUTTOMS_SAMPLE_TIME, ButtonPowerCallBackFunction, 0,0,0 ); // eFiftyMillisecond + AddControlCallback( ButtonPowerCBFunction, BUTTONS_SAMPLE_TIME, ButtonPowerCallBackFunction, 0,0,0 ); // eFiftyMillisecond strcpy(jog.bttn_name, "jog"); jog.bttn_status = release; // 0=release 1=press @@ -169,7 +169,7 @@ uint32_t Buttons_Init(void) jog.state = sttENABLE; // sttDISABLE, sttENABLE, sttJOGGING jog.count = 0; - AddControlCallback( ButtonJogCBFunction, BUTTOMS_SAMPLE_TIME, ButtonJogCallBackFunction, 0,0,0 ); // + AddControlCallback( ButtonJogCBFunction, BUTTONS_SAMPLE_TIME, ButtonJogCallBackFunction, 0,0,0 ); // strcpy(load.bttn_name, "load"); load.bttn_status = release; // 0=release 1=press @@ -178,7 +178,7 @@ uint32_t Buttons_Init(void) load.state = sttRDY; // load.count = 0; - AddControlCallback( ButtonLoadCBFunction, BUTTOMS_SAMPLE_TIME, ButtonLoadCallBackFunction, 0,0,0 ); // + AddControlCallback( ButtonLoadCBFunction, BUTTONS_SAMPLE_TIME, ButtonLoadCallBackFunction, 0,0,0 ); // return OK; } @@ -206,9 +206,16 @@ uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue) { uint8_t parameter = 2; + if ((load.bttn_status == press) && ( ReadValue == release )) + { + load.count=0; + REPORT_MSG(load.count," ------------ thread loading buttons is released ----------------- "); + + } + if ((load.bttn_status == release) && (ReadValue == press)) { - REPORT_MSG(parameter," ------------ Start thread loading empty function ----------------- "); + REPORT_MSG(load.count," ------------ thread loading buttons is pressed ----------------- "); //load.bttn_status = press; LoadStatMachine(&load); load.count=1; @@ -217,8 +224,9 @@ uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue) { if (load.count == LOADLONGPRESS) // todo { - //load.count = 0; + REPORT_MSG(load.count," ------------ thread loading buttons is pressed: LOADLONGPRESS ----------------- "); LoadLongPress( &load ); + load.count = 0; } else load.count++; } diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index 7796f09cf..f22ce46ac 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -1231,7 +1231,7 @@ bool InitCartStatus() } else { - REPORT_MSG(parameter," ------------ INIT : WHS_waste1 cart is NOT presence_sensor !!! ----------------- "); + REPORT_MSG(parameter," ------------ INIT : WHS_waste2 cart is NOT presence_sensor !!! ----------------- "); WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = CarteidgeNotPrecense; Pannel_Leds( CART_3, MODE_OFF); cart3.color = colorOFF; -- cgit v1.3.1