Skip to content

Commit

Permalink
fix:18b20临界保护时间太久,会导致cat1死机
Browse files Browse the repository at this point in the history
  • Loading branch information
allewalker committed May 16, 2024
1 parent 66ce2cd commit 92a7422
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions luat/modules/luat_lib_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,15 @@ static int l_sensor_ds18b20(lua_State *L)
int32_t val = 0;
int check_crc = lua_gettop(L) > 1 ? lua_toboolean(L, 2) : 1;
int pin = luaL_checkinteger(L, 1);
#ifdef LUAT_USE_MOBILE
#else
luat_os_entry_cri();
#endif
int32_t ret = ds18b20_get_temperature(pin, &val, check_crc);
#ifdef LUAT_USE_MOBILE
#else
luat_os_exit_cri();
#endif
// -55°C ~ 125°C
if (ret || !(val <= 1250 && val >= -550))
{
Expand Down

0 comments on commit 92a7422

Please sign in to comment.