int32_t ret;
common_notify_mail_t mail;
uint32_t msgsize = (uint32_t)sizeof(common_notify_mail_t);
- //开始timer
- battery_timer_start_check_released(CHARGE_CHECK_TIMER_CYCLE_MS);
-
+
while (1) {
ret = osal_msg_queue_read_copy(g_app_queue, (void *)&mail, &msgsize,
OSAL_MSGQ_WAIT_FOREVER);
if (mail.comm.app == BATTERY_CMD_CHECK_VOLTAGE) {
-
g_check_count++;
+ // PRINT("BATTERY_CMD_CHECK_VOLTAGE g_check_count %d\r\n",g_check_count);
if(last_battery_charge_enable_status == true){
if (g_check_count*CHARGE_CHECK_TIMER_CYCLE_MS >= ENABLE_CHARGE_TIMEOUT_MS)
{
+ // PRINT("BATTERY_CMD_CHECK_VOLTAGE disable_charge \r\n");
+
g_check_count = 0 ;
//超时交换状态
disable_charge();
last_battery_charge_enable_status = false;
}
-
-
}else if (last_battery_charge_enable_status == false) {
if (g_check_count*CHARGE_CHECK_TIMER_CYCLE_MS >= DISABLE_CHARGE_CHECK_MS)
{
+ // PRINT("BATTERY_CMD_CHECK_VOLTAGE battery_check_and_enable_charge \r\n");
+
g_check_count = 0 ;
//超时交换状态
battery_check_and_enable_charge();
- last_battery_charge_enable_status = false;
+ last_battery_charge_enable_status = true;
}
}
// osal_kthread_set_priority(task_handle, 10);
g_battery_timer = osTimerNew((osTimerFunc_t)battery_check_timer_callback, osTimerPeriodic, NULL, NULL);
+ //开始timer
+ battery_timer_start_check_released(CHARGE_CHECK_TIMER_CYCLE_MS);
+
return ERRCODE_SUCC;
}