1.接入充电 或者放回充电仓时 关闭蓝牙广播, 2.广播数据添加电量0-100% 分10级

This commit is contained in:
helloyifa 2025-04-11 14:45:27 +08:00
parent 4810e153e1
commit 83da5e2a92

View File

@ -357,6 +357,7 @@ static uint8_t reversal(uint8_t data)
ff_temp_data[4] = (ntc >> 8) & 0xFF; ff_temp_data[4] = (ntc >> 8) & 0xFF;
ff_temp_data[5] = (ntc) & 0xFF; ff_temp_data[5] = (ntc) & 0xFF;
//batt //batt
battery = get_cur_battery_level() *10;
ff_temp_data[6] = battery & 0xFF; ff_temp_data[6] = battery & 0xFF;
trans_client_adv_data_set_ff(ff_temp_data,sizeof(ff_temp_data)); trans_client_adv_data_set_ff(ff_temp_data,sizeof(ff_temp_data));
gpio_direction_output(IO_PORTB_05, 0); gpio_direction_output(IO_PORTB_05, 0);
@ -428,6 +429,8 @@ void temperature_charge_state(int state){
temperature_work_led(0); temperature_work_led(0);
delay_ms_by_timer0(150); delay_ms_by_timer0(150);
} }
//接入充电关闭蓝牙广播
ble_op_adv_enable(0);
//spple_power_event_to_user(POWER_EVENT_POWER_SOFTOFF); //spple_power_event_to_user(POWER_EVENT_POWER_SOFTOFF);
//printf("!!!!!!!!!!!!!! CHARGING POWER OFF!!!!!!!!!!!!!!!!\n"); //printf("!!!!!!!!!!!!!! CHARGING POWER OFF!!!!!!!!!!!!!!!!\n");
//printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING 2\n"); //printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING 2\n");
@ -445,6 +448,9 @@ void temperature_charge_state(int state){
//temperature_charge_led(0); //temperature_charge_led(0);
temperature_work_led(1); temperature_work_led(1);
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000); sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
//拔出充电打开蓝牙广播
ble_op_adv_enable(1);
break; break;
//低电 //低电
case BLE_TEMPERATURE_CHARGE_STATE_LOWPOWER: case BLE_TEMPERATURE_CHARGE_STATE_LOWPOWER: