From f305f11de417449f8e645810c0ce7ffd86e7ee79 Mon Sep 17 00:00:00 2001 From: kyz Date: Tue, 18 Jul 2023 18:17:00 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=AD=A3=E6=9C=AA=E6=8E=A5tof=E6=8E=A2?= =?utf8?q?=E5=A4=B4=E6=97=B6=E7=9A=84led=E6=98=BE=E7=A4=BA=E5=BC=82?= =?utf8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/inc/mg_version.h | 2 +- app/src/device_ctrl.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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 ); } -- 2.34.1