From: kyz Date: Tue, 18 Jul 2023 10:17:00 +0000 (+0800) Subject: 修正未接tof探头时的led显示异常 X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=f305f11de417449f8e645810c0ce7ffd86e7ee79;p=yn%2Falarmmonitor.git 修正未接tof探头时的led显示异常 --- diff --git a/app/inc/mg_version.h b/app/inc/mg_version.h index 8c6d049..efa5c6a 100644 --- a/app/inc/mg_version.h +++ b/app/inc/mg_version.h @@ -1,7 +1,7 @@ #ifndef __MG_VERSION_H__ #define __MG_VERSION_H__ -#define SW_VERSION "0.0.6" +#define SW_VERSION "0.0.7" #endif //__MG_VERION_H__ diff --git a/app/src/device_ctrl.c b/app/src/device_ctrl.c index 4d7964f..9ed4909 100644 --- a/app/src/device_ctrl.c +++ b/app/src/device_ctrl.c @@ -170,16 +170,23 @@ void * btn_light_ctrl_task( void* para ) if( !row_disabled && tof_sync ){ //联排功能,平台设置人感状态 light_mode_set( dev, LIGHT_MODE_TOF_ACTIVE ); + }else if( !dev->tof ){ + //TOF传感器故障,LED按无人显示 + light_mode_set( dev, LIGHT_MODE_TOF_DEACTIVE ); } if( dev->tof && device_uptime_sec() - tof_check_time > cfg_mg_tof_interval_read( dev ) ){ - + //printf( "%d - %d > %d\n", device_uptime_sec(), tof_check_time, cfg_mg_tof_interval_read(dev) ); tof_check_time = device_uptime_sec(); memset( &info, 0, sizeof( info ) ); //检查周期到达,读取tof状态 if( mg_tof_read( dev->tof, &info )==0 ){ - MG_LOGD( "read tof info, enable:%d, status:%d, dist:%d", info.enable, info.status, info.distance ); + static tof_info_t dbg_info; + if( dbg_info.enable != info.enable || dbg_info.status != info.status || abs( dbg_info.distance-info.distance)>5 ){ + memcpy( &dbg_info, &info, sizeof( dbg_info ) ); + MG_LOGD( "read tof info, enable:%d, status:%d, dist:%d", info.enable, info.status, info.distance ); + } }else{ MG_LOGW( "read tof info fail, g_tof:%p", dev->tof ); }