From 2966f8cb8c51679c41e91adb9df802a3617d13dc Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Thu, 20 Feb 2020 15:55:22 +0530 Subject: [PATCH] log: Check for ISR context and use proper API to get Tick Count --- components/log/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/log/log.c b/components/log/log.c index c59469cc0..b256e936b 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -341,7 +341,9 @@ uint32_t IRAM_ATTR esp_log_timestamp() if (base == 0 && xPortGetCoreID() == 0) { base = esp_log_early_timestamp(); } - return base + xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + TickType_t tick_count = xPortInIsrContext() ? xTaskGetTickCountFromISR() : xTaskGetTickCount(); + return base + tick_count * (1000 / configTICK_RATE_HZ); + } #else