static BATTERY_DATA_T *bat_t;
static uint32_t len = 0;
+static uint32_t bat_check_time = 1;
+static uint32_t last_bat_check_time = 1;
+
+static void battery_check_timer_change(uint8_t percent)
+{
+ if(g_battery_timer && osTimerIsRunning(g_battery_timer))
+ {
+ if(percent >= 60)
+ bat_check_time = 4;
+ else if(percent >= 30 && percent < 60)
+ bat_check_time = 2;
+ else if(percent < 30)
+ bat_check_time = 1;
+
+ if(last_bat_check_time != bat_check_time)
+ last_bat_check_time = bat_check_time;
+ else
+ return;
+
+ printf("battery_check_timer_change percent:%d,bat_check_timer_ms:%ds\n",percent,bat_check_time);
+ int ret = osTimerStop(g_battery_timer);
+ // printf("osTimerStop ret : %d\n",ret);
+ ret = osTimerStart(g_battery_timer, bat_check_time * 1000);
+ // printf("osTimerStart ret : %d\n",ret);
+
+ }
+}
+
void battery_file_check(BATTERY_DATA_T newStruct, const char *filename)
{
FILE *fp;
batteryservice_get_voltage_by_channel(¤t_battery_info->battery_voltage,ADC_CHANNEL_BAT_VOLTAGE);
uapi_tcxo_delay_ms(20);
- if(bat_temp_cnt >= 8) //5分钟左右检测一次电池温度
- {
- bat_temp_cnt = 0;
- batteryservice_get_voltage_by_channel(¤t_battery_info->battery_ntc_temp,ADC_CHANNEL_BAT_TEMP);
- // printf("current_battery_info->battery_ntc_temp : %.3f \n",current_battery_info->battery_ntc_temp);
- uapi_tcxo_delay_ms(20);
- }
- else
- {
- bat_temp_cnt ++;
- }
+ // if(bat_temp_cnt >= 8) //5分钟左右检测一次电池温度
+ // {
+ // bat_temp_cnt = 0;
+ // batteryservice_get_voltage_by_channel(¤t_battery_info->battery_ntc_temp,ADC_CHANNEL_BAT_TEMP);
+ // // printf("current_battery_info->battery_ntc_temp : %.3f \n",current_battery_info->battery_ntc_temp);
+ // uapi_tcxo_delay_ms(20);
+ // }
+ // else
+ // {
+ // bat_temp_cnt ++;
+ // }
// batteryservice_get_voltage_by_channel(¤t_battery_info->pcb_ntc_temp,ADC_CHANNEL_PCB_TEMP);
// uapi_tcxo_delay_ms(20);
}
float bat_temp;
//获取电量
uint8_t percent = batteryservice_get_voltage(&voltage);
+
+ // battery_check_timer_change(percent);
+
//获取电池温度
batteryservice_get_battery_temp(&bat_temp);