Wendal Chen 5 лет назад
Родитель
Сommit
f6f5e4a216
2 измененных файлов с 7 добавлено и 1 удалено
  1. 5 1
      luat/include/luat_base.h
  2. 2 0
      luat/modules/luat_lib_sensor.c

+ 5 - 1
luat/include/luat_base.h

@@ -7,7 +7,7 @@
 #ifndef LUAT_BASE
 #define LUAT_BASE
 /**LuatOS版本号*/
-#define LUAT_VERSION "V0003"
+#define LUAT_VERSION "V0004"
 // 调试开关, 预留
 #define LUAT_DEBUG 0
 
@@ -102,6 +102,10 @@ void luat_os_standy(int timeout);
 /** 厂商/模块名字, 例如Air302, Air640W*/
 const char* luat_os_bsp(void);
 
+void luat_os_entry_cri(void);
+
+void luat_os_exit_cri(void);
+
 /** 停止启动,当前仅rt-thread实现有这个设置*/
 void stopboot(void);
 

+ 2 - 0
luat/modules/luat_lib_sensor.c

@@ -234,7 +234,9 @@ end
 static int l_sensor_ds18b20(lua_State *L) {
     int32_t val = 0;
     int check_crc = lua_gettop(L) > 1 ? lua_toboolean(L, 2) : 1;
+    luat_os_entry_cri();
     int32_t ret = ds18b20_get_temperature(luaL_checkinteger(L, 1), &val, check_crc);
+    luat_os_exit_cri();
     // -55°C ~ 125°C
     if (ret || !(val <= 1250 && val >= -550)) {
         LLOGI("ds18b20 read fail");