summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2014-06-30 18:21:33 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-30 17:43:31 +0000
commitd4d1b5045cfb602a7c57cbf29b2543e26106a1fd (patch)
treedbe119c247c46cef2b78842a053555ad227cd945
parent6e074c68e2cfb35683733ab561801c647723ac57 (diff)
parent9cc4ea329fd63ecd8a5764b1762c1574904842f6 (diff)
downloadcore-d4d1b5045cfb602a7c57cbf29b2543e26106a1fd.tar.gz
core-d4d1b5045cfb602a7c57cbf29b2543e26106a1fd.tar.bz2
core-d4d1b5045cfb602a7c57cbf29b2543e26106a1fd.zip
Merge "Charger: Avoid animation while not charging DO NOT MERGE"
-rw-r--r--charger/charger.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/charger/charger.c b/charger/charger.c
index 15add87d0..47b1c0754 100644
--- a/charger/charger.c
+++ b/charger/charger.c
@@ -751,24 +751,33 @@ static void update_screen_state(struct charger *charger, int64_t now)
/* schedule next screen transition */
charger->next_screen_transition = now + disp_time;
- /* advance frame cntr to the next valid frame
+ /* advance frame cntr to the next valid frame only if we are charging
* if necessary, advance cycle cntr, and reset frame cntr
*/
- batt_anim->cur_frame++;
-
- /* if the frame is used for level-only, that is only show it when it's
- * the current level, skip it during the animation.
- */
- while (batt_anim->cur_frame < batt_anim->num_frames &&
- batt_anim->frames[batt_anim->cur_frame].level_only)
+ if (charger->num_supplies_online != 0) {
batt_anim->cur_frame++;
- if (batt_anim->cur_frame >= batt_anim->num_frames) {
- batt_anim->cur_cycle++;
- batt_anim->cur_frame = 0;
+
+ /* if the frame is used for level-only, that is only show it when it's
+ * the current level, skip it during the animation.
+ */
+ while (batt_anim->cur_frame < batt_anim->num_frames &&
+ batt_anim->frames[batt_anim->cur_frame].level_only)
+ batt_anim->cur_frame++;
+ if (batt_anim->cur_frame >= batt_anim->num_frames) {
+ batt_anim->cur_cycle++;
+ batt_anim->cur_frame = 0;
/* don't reset the cycle counter, since we use that as a signal
* in a test above to check if animation is over
*/
+ }
+ } else {
+ /* Stop animating if we're not charging.
+ * If we stop it immediately instead of going through this loop, then
+ * the animation would stop somewhere in the middle.
+ */
+ batt_anim->cur_frame = 0;
+ batt_anim->cur_cycle++;
}
}