修复充电时 继续发广播
This commit is contained in:
parent
03e51dbef6
commit
602f73308c
@ -25,6 +25,8 @@ static u16 temer_temperature_detect = 0;
|
|||||||
//struct app_dev_info_t dev_info;
|
//struct app_dev_info_t dev_info;
|
||||||
//struct app_dev_config_t dev_config;
|
//struct app_dev_config_t dev_config;
|
||||||
app_dev_config_t dev_config;
|
app_dev_config_t dev_config;
|
||||||
|
|
||||||
|
static int charge_state = 0;
|
||||||
void temperature_blink_led()
|
void temperature_blink_led()
|
||||||
{
|
{
|
||||||
if (led_state)
|
if (led_state)
|
||||||
@ -305,6 +307,10 @@ static uint8_t reversal(uint8_t data)
|
|||||||
char err_code[4][20] = {"NOT Connected", "No DONE signal", "DAT Recv Err", "CRC Err"};
|
char err_code[4][20] = {"NOT Connected", "No DONE signal", "DAT Recv Err", "CRC Err"};
|
||||||
void nst1002_read_temperatura(void)
|
void nst1002_read_temperatura(void)
|
||||||
{
|
{
|
||||||
|
if(charge_state){
|
||||||
|
printf("charging...\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int err, ei;
|
int err, ei;
|
||||||
float dtmp;
|
float dtmp;
|
||||||
int16_t cal;
|
int16_t cal;
|
||||||
@ -418,6 +424,7 @@ void temperature_charge_state(int state){
|
|||||||
{
|
{
|
||||||
//接入充电
|
//接入充电
|
||||||
case BLE_TEMPERATURE_CHARGE_STATE_CHARGING :
|
case BLE_TEMPERATURE_CHARGE_STATE_CHARGING :
|
||||||
|
charge_state = 1;
|
||||||
printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING\n");
|
printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING\n");
|
||||||
//关闭低电提示LED
|
//关闭低电提示LED
|
||||||
temperature_charge_lowpower(0);
|
temperature_charge_lowpower(0);
|
||||||
@ -431,6 +438,7 @@ void temperature_charge_state(int state){
|
|||||||
}
|
}
|
||||||
//接入充电关闭蓝牙广播
|
//接入充电关闭蓝牙广播
|
||||||
ble_op_adv_enable(0);
|
ble_op_adv_enable(0);
|
||||||
|
ble_module_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");
|
||||||
@ -443,6 +451,7 @@ void temperature_charge_state(int state){
|
|||||||
break;
|
break;
|
||||||
//拔出充电
|
//拔出充电
|
||||||
case BLE_TEMPERATURE_CHARGE_STATE_IDLE :
|
case BLE_TEMPERATURE_CHARGE_STATE_IDLE :
|
||||||
|
charge_state = 0;
|
||||||
printf("BLE_TEMPERATURE_CHARGE_STATE_IDLE\n");
|
printf("BLE_TEMPERATURE_CHARGE_STATE_IDLE\n");
|
||||||
temer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
temer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||||
//temperature_charge_led(0);
|
//temperature_charge_led(0);
|
||||||
@ -450,7 +459,9 @@ void temperature_charge_state(int state){
|
|||||||
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||||
|
|
||||||
//拔出充电打开蓝牙广播
|
//拔出充电打开蓝牙广播
|
||||||
|
ble_module_enable(1);
|
||||||
ble_op_adv_enable(1);
|
ble_op_adv_enable(1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//低电
|
//低电
|
||||||
case BLE_TEMPERATURE_CHARGE_STATE_LOWPOWER:
|
case BLE_TEMPERATURE_CHARGE_STATE_LOWPOWER:
|
||||||
|
@ -43,6 +43,7 @@ void ldo5v_keep_deal(void)
|
|||||||
#if TCFG_HANDSHAKE_ENABLE
|
#if TCFG_HANDSHAKE_ENABLE
|
||||||
handshake_app_start(2, handshake_complete);
|
handshake_app_start(2, handshake_complete);
|
||||||
#endif
|
#endif
|
||||||
|
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_CHARGING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void charge_full_deal(void)
|
void charge_full_deal(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user