From 70331b25ffe11ee5c74d1caa78a393a3049bc2bc Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Thu, 7 Nov 2019 14:32:28 +0800 Subject: [PATCH] fix(freertos): fix extended system ticks error when it increases by a large value --- components/freertos/port/esp8266/port.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/components/freertos/port/esp8266/port.c b/components/freertos/port/esp8266/port.c index 140161e6..2658e892 100644 --- a/components/freertos/port/esp8266/port.c +++ b/components/freertos/port/esp8266/port.c @@ -130,15 +130,9 @@ void TASK_SW_ATTR SoftIsrHdl(void* arg) } } -void esp_increase_tick_cnt(const TickType_t ticks) +void IRAM_ATTR esp_increase_tick_cnt(const TickType_t ticks) { - esp_irqflag_t flag; - - flag = soc_save_local_irq(); - g_esp_os_ticks += ticks; - - soc_restore_local_irq(flag); } void IRAM_ATTR xPortSysTickHandle(void *p) @@ -163,15 +157,13 @@ void IRAM_ATTR xPortSysTickHandle(void *p) soc_set_ccompare(_xt_tick_divisor); ticks = us / 1000 / portTICK_PERIOD_MS; - if (!ticks) { - ticks = 1; - } - g_esp_os_ticks += ticks; if (ticks > 1) { vTaskStepTick(ticks - 1); } + g_esp_os_ticks++; + if (xTaskIncrementTick() != pdFALSE) { vTaskSwitchContext(); }