Browse Source

change: luat_main测试模式把os.date加到循环内, 检测time函数的正确性

Wendal Chen 4 năm trước cách đây
mục cha
commit
367ce489bc
3 tập tin đã thay đổi với 10 bổ sung5 xóa
  1. 1 0
      components/sfud/luat_sfud_lfs2.c
  2. 1 0
      luat/modules/luat_main.c
  3. 8 5
      luat/vfs/luat_fs_fatfs.c

+ 1 - 0
components/sfud/luat_sfud_lfs2.c

@@ -1,6 +1,7 @@
 
 #include "luat_base.h"
 #include "luat_fs.h"
+#include "luat_malloc.h"
 
 #define LUAT_LOG_TAG "luat.sfud"
 #include "luat_log.h"

+ 1 - 0
luat/modules/luat_main.c

@@ -59,6 +59,7 @@ int luat_main_demo() { // 这是验证LuatVM最基础的消息/定时器/Task机
                           "    led(1)\n"
                           "    sys.wait(500)\n"
                           "    led(0)\n"
+                          "    log.info(\"main\", os.date())\n"
                           "  end\n"
                           "end)\n"
                           "sys.run()\n");

+ 8 - 5
luat/vfs/luat_fs_fatfs.c

@@ -168,17 +168,20 @@ int luat_vfs_fatfs_rmdir(void* userdata, char const* _DirName) {
     LLOGE("not support yet : rmdir");
     return -1;
 }
+
 int luat_vfs_fatfs_info(void* userdata, const char* path, luat_fs_info_t *conf) {
-    DWORD fre_clust, fre_sect, tot_sect;
+    // DWORD fre_clust = 0;
+    // DWORD fre_sect = 0
+    // DWORD tot_sect = 0;
     FATFS *fs = (FATFS*)userdata;
 
-    tot_sect = (fs->n_fatent - 2) * fs->csize;
-    fre_sect = fre_clust * fs->csize;
+    // tot_sect = (fs->n_fatent - 2) * fs->csize;
+    // fre_sect = (fs->free_clst) * fs->csize;
 
     memcpy(conf->filesystem, "fatfs", strlen("fatfs")+1);
     conf->type = 0;
-    conf->total_block = tot_sect;
-    conf->block_used = tot_sect - fre_sect;
+    conf->total_block = (fs->n_fatent - 2);
+    conf->block_used = fs->free_clst;
     conf->block_size = fs->csize;
     return 0;
 }