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 );
}