Commit 37eca712 authored by Bc. Petr Elexa's avatar Bc. Petr Elexa

panel: improve WDG feed

parent e96f7777
...@@ -324,10 +324,10 @@ static void terminal_task(void *pvParameters) ...@@ -324,10 +324,10 @@ static void terminal_task(void *pvParameters)
bool send_door_status = true; bool send_door_status = true;
WDT_Feed(); // Feed HW watchdog
while (true) while (true)
{ {
WDT_Feed(); // Feed HW watchdog
TickType_t begin_time = xTaskGetTickCount(); TickType_t begin_time = xTaskGetTickCount();
// Get pending user request // Get pending user request
...@@ -352,8 +352,6 @@ static void terminal_task(void *pvParameters) ...@@ -352,8 +352,6 @@ static void terminal_task(void *pvParameters)
// Calculate actual processing time. // Calculate actual processing time.
TickType_t proces_time = xTaskGetTickCount() - begin_time; TickType_t proces_time = xTaskGetTickCount() - begin_time;
WDT_Feed(); // Feed HW watchdog
// Protect against brute-force attack by limiting processing frequency. // Protect against brute-force attack by limiting processing frequency.
// Also controls frequency of door status update. // Also controls frequency of door status update.
if (proces_time < pdMS_TO_TICKS(USER_REQUEST_MIN_PERIOD_MS)) if (proces_time < pdMS_TO_TICKS(USER_REQUEST_MIN_PERIOD_MS))
...@@ -361,6 +359,8 @@ static void terminal_task(void *pvParameters) ...@@ -361,6 +359,8 @@ static void terminal_task(void *pvParameters)
vTaskDelay(pdMS_TO_TICKS(USER_REQUEST_MIN_PERIOD_MS) - proces_time); vTaskDelay(pdMS_TO_TICKS(USER_REQUEST_MIN_PERIOD_MS) - proces_time);
} }
WDT_Feed(); // Feed HW watchdog
if (send_door_status) if (send_door_status)
{ {
// Check if door open/close state changed // Check if door open/close state changed
......
...@@ -154,7 +154,7 @@ void set_reader_addr(const uint16_t acs_addr); ...@@ -154,7 +154,7 @@ void set_reader_addr(const uint16_t acs_addr);
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#define HW_WATCHDOG_TIMEOUT 1 // in seconds #define HW_WATCHDOG_TIMEOUT 2 // in seconds
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// IO // IO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment