ソースを参照

log: Check for ISR context and use proper API to get Tick Count

Shubham Kulkarni 6 年 前
コミット
110620a80c
1 ファイル変更2 行追加1 行削除
  1. 2 1
      components/log/log.c

+ 2 - 1
components/log/log.c

@@ -339,7 +339,8 @@ 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