Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't show battery meter until a proper power reading has been done


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4042 a1c6a512-1295-4272-9138-f99709370657

+23 -10
+3 -1
apps/status.c
··· 175 175 } 176 176 177 177 #ifdef HAVE_LCD_BITMAP 178 - if (battery_state) 178 + if (battery_state && (info.battlevel > -1)) 179 179 statusbar_icon_battery(info.battlevel, plug_state); 180 + 180 181 statusbar_icon_volume(info.volume); 181 182 statusbar_icon_play_state(current_mode + Icon_Play); 182 183 switch (info.repeat) { ··· 202 203 203 204 204 205 #if defined(HAVE_LCD_CHARCELLS) 206 + if (info.battlevel > -1) 205 207 lcd_icon(ICON_BATTERY, battery_state); 206 208 lcd_icon(ICON_BATTERY_1, info.battlevel > 25); 207 209 lcd_icon(ICON_BATTERY_2, info.battlevel > 50);
+7 -3
apps/wps-display.c
··· 478 478 return buf; 479 479 480 480 case 't': /* estimated battery time */ 481 - snprintf(buf, buf_size, "%dh %dm", 482 - battery_time() / 60, 483 - battery_time() % 60); 481 + { 482 + int t = battery_time(); 483 + if (t >= 0) 484 + snprintf(buf, buf_size, "%dh %dm", t / 60, t % 60); 485 + else 486 + strncpy(buf, "?h ?m", buf_size); 484 487 return buf; 488 + } 485 489 } 486 490 break; 487 491
+13 -6
firmware/powermgmt.c
··· 184 184 int c = 0; 185 185 int i; 186 186 187 - /* calculate average over last 3 minutes (skip empty samples) */ 187 + /* calculate maximum over last 3 minutes (skip empty samples) */ 188 188 for (i = 0; i < 3; i++) 189 - if (power_history[POWER_HISTORY_LEN-1-i]) { 190 - level += power_history[POWER_HISTORY_LEN-1-i]; 191 - c++; 192 - } 189 + if (power_history[POWER_HISTORY_LEN-1-i] > c) 190 + c = power_history[POWER_HISTORY_LEN-1-i]; 193 191 194 192 if (c) 195 - level = level / c; /* avg */ 193 + level = c; 196 194 else /* history was empty, get a fresh sample */ 197 195 level = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000; 198 196 ··· 448 446 449 447 while (1) 450 448 { 449 + /* never read power while disk is spinning, unless in USB mode */ 450 + if (ata_disk_is_active() && !usb_inserted()) { 451 + sleep(HZ * 2); 452 + continue; 453 + } 454 + 451 455 /* Make POWER_AVG measurements and calculate an average of that to 452 456 * reduce the effect of backlights/disk spinning/other variation. 453 457 */ ··· 777 781 778 782 /* init history to 0 */ 779 783 memset(power_history, 0x00, sizeof(power_history)); 784 + 785 + #if 0 780 786 /* initialize the history with a single sample to prevent level 781 787 flickering during the first minute of execution */ 782 788 power_history[POWER_HISTORY_LEN-1] = ··· 797 803 /* if the battery is nearly empty, start charging immediately */ 798 804 if (power_history[POWER_HISTORY_LEN-1] < BATTERY_LEVEL_DANGEROUS) 799 805 charger_enable(true); 806 + #endif 800 807 #endif 801 808 802 809 create_thread(power_thread, power_stack, sizeof(power_stack),