From 3587e8be8ce583e902733f7e02aea08bd89947e6 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Thu, 14 Oct 2021 18:25:33 +0200 Subject: [PATCH] Prevent creation of multiple antiburn tasks #134 --- src/hasp/hasp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index d2c7e274..f4aff22c 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -182,12 +182,12 @@ void hasp_set_antiburn(int32_t repeat_count, uint32_t period) if(!layer) return; if(repeat_count != 0) { - antiburn_task = lv_task_create(hasp_antiburn_cb, period, LV_TASK_PRIO_LOWEST, NULL); + if(!antiburn_task) antiburn_task = lv_task_create(hasp_antiburn_cb, period, LV_TASK_PRIO_LOWEST, NULL); if(antiburn_task) { - // hasp_set_wakeup_touch(true); lv_obj_set_event_cb(layer, first_touch_event_handler); lv_obj_set_click(layer, true); lv_task_set_repeat_count(antiburn_task, repeat_count); + lv_task_set_period(antiburn_task, period); dispatch_state_antiburn(HASP_EVENT_ON); } else { LOG_INFO(TAG_HASP, F("Antiburn %s"), D_INFO_FAILED);