comparison src/cs/drivers/drv_app/fchg/bsim_start.c @ 254:4533ef63fdb0

FCHG BSIM: init_percent logic implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 May 2021 23:01:28 +0000
parents
children aec644728174
comparison
equal deleted inserted replaced
253:769cf6273fe4 254:4533ef63fdb0
1 /*
2 * This module implements a boot-time function for BSIM mode:
3 * figuring out the initial battery percentage to be reported.
4 */
5
6 #include "fchg/fchg_env.h"
7 #include "fchg/fchg_func_i.h"
8 #include "rv/rv_general.h"
9 #include "rvf/rvf_api.h"
10 #include "rvm/rvm_use_id_list.h"
11
12 void bsim_init_percent(void)
13 {
14 UINT16 i;
15
16 for (i = 0; i < pwr_ctrl->nb_percent_thresh; i++) {
17 if (pwr_ctrl->batt.percent_thresh[i].remain_capa ==
18 pwr_ctrl->bsim.init_percent) {
19 pwr_ctrl->curr_disch_thresh = i;
20 return;
21 }
22 }
23 rvf_send_trace("BSIM boot: invalid init_percent setting", 39,
24 pwr_ctrl->bsim.init_percent, RV_TRACE_LEVEL_ERROR,
25 FCHG_USE_ID);
26 pwr_ctrl->curr_disch_thresh = 0;
27 }