中科蓝汛--AB5335系列 蓝牙信号超出距离的处理

本文主要介绍中科蓝汛AB5335系列蓝牙设备在信号超出范围时的处理方法,包括消息处理机制、设备如何执行void func_bt_disp_status(void)进行重新连接、在usr_tmr5ms_isr定时器中的灯闪控制、超出距离时的提示音播放以及在bt_emit_notice函数中防止持续蜂鸣的优化措施。
摘要由CSDN通过智能技术生成

1.超出距离的消息处理
会执行到下面这个函数的消息处理

void bt_emit_notice(uint evt, u32 param)
case BT_NOTICE_LOSTCONNECT:
        connect_lost_flag = 1;
        piano_res_play(T_WARNING_NEXT_TRACK, 3);    //“滴”一声
        break;

2.超出距离重新连接
会执行void func_bt_disp_status(void)

 switch (f_bt.disp_status) {
       ......
         case BT_STA_CONNECTED:
            connect_lost_flag = 0;
            led_bt_connected();
            break;
        ......

3.在定时器处理蓝牙超出距离的灯闪
usr_tmr5ms_isr

 if ((cnt_5ms % 20) == 0){

        if( connt_lost_flag){
            count_bt_lost++;
            count_bt_lost_led++;
            if(count_bt_lost ==100){//10S timer process
            msg_enqueue(EVT_BT_LOSTCONNECT);
            count_bt_lost= 0;
            }
        }

        if(count_bt_lost_led == 5){
            led_on();
            rled_off();
        }else if(count_bt_lost_led == 10){
            led_off();
            rled_off();
            count_bt_lost_led=0;
        }

    }

4.超出距离提示音

提示音最好放到消息处理中播放

  msg_bt.c
  
  case EVT_BT_LOSTCONNECT:
        piano_res_play(T_WARNING_NEXT_TRACK, 3);    //“滴”一声
        break;

5.超出距离后重新连接

void bt_emit_notice(uint evt, u32 param)函数需要做一下处理,否则会一直嘀嘀响

 case BT_NOTICE_CONNECTED://连接上清除标志位
        connt_lost_flag = 0;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值