Some bugs fixed in the button reading code

pull/5/head
Pawel Jalocha 2019-04-29 20:32:05 +01:00
rodzic 61dadc2408
commit 6f0683661c
1 zmienionych plików z 9 dodań i 11 usunięć

Wyświetl plik

@ -930,30 +930,28 @@ static void Button_keptPressed(uint8_t Ticks)
// { Format_String(CONS_UART_Write, "Sleep in 2 sec\n"); // { Format_String(CONS_UART_Write, "Sleep in 2 sec\n");
// vTaskDelay(2000); // vTaskDelay(2000);
// Sleep(); } // Sleep(); }
if(Button_ReleaseTime) if(Button_ReleaseTime)
{ Format_String(CONS_UART_Write, "Button pressed:"); { Format_String(CONS_UART_Write, "Button pressed: released for ");
Format_UnsDec(CONS_UART_Write, Button_PressTime); Format_UnsDec(CONS_UART_Write, Button_ReleaseTime, 4, 3);
Format_String(CONS_UART_Write, "\n"); Format_String(CONS_UART_Write, "sec\n");
}
Button_ReleaseTime=0; Button_ReleaseTime=0;
} }
}
static void Button_keptReleased(uint8_t Ticks) static void Button_keptReleased(uint8_t Ticks)
{ Button_ReleaseTime+=Ticks; { Button_ReleaseTime+=Ticks;
if(Button_PressTime)
{ Format_String(CONS_UART_Write, "Button released:");
Format_UnsDec(CONS_UART_Write, Button_PressTime);
Format_String(CONS_UART_Write, "\n");
if(Button_PressTime)
{ Format_String(CONS_UART_Write, "Button released: pressed for ");
Format_UnsDec(CONS_UART_Write, Button_PressTime, 4, 3);
Format_String(CONS_UART_Write, "sec\n");
// if(Button_SleepRequest) // if(Button_SleepRequest)
// { Format_String(CONS_UART_Write, "Sleep in 2 sec\n"); // { Format_String(CONS_UART_Write, "Sleep in 2 sec\n");
// vTaskDelay(2000); // vTaskDelay(2000);
// Sleep(); } // Sleep(); }
}
Button_PressTime=0; Button_PressTime=0;
} }
}
void Button_TimerCheck(uint8_t Ticks) void Button_TimerCheck(uint8_t Ticks)
{ {