Browse Source

[ulog] Optimize unnecessary refresh

tyx 2 years ago
parent
commit
4f342456b3
1 changed files with 1 additions and 2 deletions
  1. 1 2
      components/utilities/ulog/backend/file_be.c

+ 1 - 2
components/utilities/ulog/backend/file_be.c

@@ -79,11 +79,10 @@ static void ulog_file_backend_flush_with_buf(struct ulog_backend *backend)
     struct ulog_file_be *be = (struct ulog_file_be *) backend;
     rt_size_t file_size = 0, write_size = 0;
 
-    if (be->enable == RT_FALSE)
+    if (be->enable == RT_FALSE || be->buf_ptr_now == be->file_buf)
     {
         return;
     }
-
     if (be->cur_log_file_fd < 0)
     {
         /* check log file directory  */