mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
samus: change tap for battery to not show dimmed last segment
Change tap for battery lightbar sequence to not show the last segment dimmed as a percentage of your battery. BUG=chrome-os-partner:37335 BRANCH=samus TEST=use battfake console command to test out every increment of 10% and use "lightbar seq tap" to show tap. Change-Id: I4f38d26a8cfbecfa6efc86fcc8751ca8cb34879b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256191 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
91524aca91
commit
4e58d5c46a
@@ -873,6 +873,7 @@ static uint32_t sequence_KONAMI(void)
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIGHTBAR_TAP_DIM_LAST_SEGMENT
|
||||
/* Returns 0.0 to 1.0 for val in [min, min + ofs] */
|
||||
static int range(int val, int min, int ofs)
|
||||
{
|
||||
@@ -882,6 +883,7 @@ static int range(int val, int min, int ofs)
|
||||
return FP_SCALE;
|
||||
return (val - min) * FP_SCALE / ofs;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Handy constant */
|
||||
#define CUT (100 / NUM_LEDS)
|
||||
@@ -892,12 +894,15 @@ static uint32_t sequence_TAP_inner(int dir)
|
||||
timestamp_t start, now;
|
||||
uint32_t elapsed_time = 0;
|
||||
int i, l, ci, max_led;
|
||||
int f_min, f_delta, f_osc, f_power, f_mult;
|
||||
int f_osc, f_mult;
|
||||
int gi, gr, gate[NUM_LEDS] = {0, 0, 0, 0};
|
||||
uint8_t w = 0;
|
||||
#ifdef CONFIG_LIGHTBAR_TAP_DIM_LAST_SEGMENT
|
||||
int f_min, f_delta, f_power;
|
||||
|
||||
f_min = st.p.tap_seg_min_on * FP_SCALE / 100;
|
||||
f_delta = (st.p.tap_seg_max_on - st.p.tap_seg_min_on) * FP_SCALE / 100;
|
||||
#endif
|
||||
f_osc = st.p.tap_seg_osc * FP_SCALE / 100;
|
||||
|
||||
start = get_time();
|
||||
@@ -924,6 +929,7 @@ static uint32_t sequence_TAP_inner(int dir)
|
||||
|
||||
for (i = 0; i < NUM_LEDS; i++) {
|
||||
|
||||
#ifdef CONFIG_LIGHTBAR_TAP_DIM_LAST_SEGMENT
|
||||
if (max_led > i) {
|
||||
f_mult = FP_SCALE;
|
||||
} else if (max_led < i) {
|
||||
@@ -944,6 +950,12 @@ static uint32_t sequence_TAP_inner(int dir)
|
||||
}
|
||||
f_mult = f_min + f_power * f_delta / FP_SCALE;
|
||||
}
|
||||
#else
|
||||
if (max_led >= i)
|
||||
f_mult = FP_SCALE;
|
||||
else if (max_led < i)
|
||||
f_mult = 0;
|
||||
#endif
|
||||
|
||||
f_mult = f_mult * gate[i] / FP_SCALE;
|
||||
|
||||
|
||||
@@ -881,6 +881,12 @@
|
||||
*/
|
||||
#undef CONFIG_LIGHTBAR_POWER_RAILS
|
||||
|
||||
/*
|
||||
* For tap sequence, show the last segment in dim to give a better idea of
|
||||
* battery percentage.
|
||||
*/
|
||||
#undef CONFIG_LIGHTBAR_TAP_DIM_LAST_SEGMENT
|
||||
|
||||
/*
|
||||
* Low power idle options. These are disabled by default and all boards that
|
||||
* want to use low power idle must define it. When using the LFIOSC, the low
|
||||
|
||||
Reference in New Issue
Block a user