@@ -2025,7 +2025,7 @@ static unsigned long display_time_wait_next = 0;
2025
2025
void display_idle_time (void ) {
2026
2026
unsigned long w ,f ;
2027
2027
unsigned char hour ,min ,sec ,centisec ;
2028
- unsigned char percent ;
2028
+ unsigned short percent ;
2029
2029
2030
2030
/* display time, but not too often. keep the rate limited. */
2031
2031
time_source -> poll (time_source );
@@ -2057,20 +2057,20 @@ void display_idle_time(void) {
2057
2057
d = wav_data_length ;
2058
2058
2059
2059
/* it's a percentage from 0 to 99, we don't need high precision for large files */
2060
- while ((m |d ) >= 0x100000UL ) {
2060
+ while ((m |d ) >= 0x10000UL ) {
2061
2061
m >>= 4UL ;
2062
2062
d >>= 4UL ;
2063
2063
}
2064
2064
2065
2065
/* we don't want divide by zero */
2066
2066
if (d == 0UL ) d = 1UL ;
2067
2067
2068
- percent = (unsigned char )((m * 100UL ) / d );
2068
+ percent = (unsigned short )((m * 1000UL ) / d );
2069
2069
}
2070
2070
2071
2071
printf ("\x0D" );
2072
- printf ("%02u:%02u:%02u.%02u %%%02u %lu/%lu as %lu-Hz %u-ch %u-bit " ,
2073
- hour ,min ,sec ,centisec ,percent ,wav_play_position ,wav_data_length ,
2072
+ printf ("%02u:%02u:%02u.%02u %%%02u.%u %lu/%lu as %lu-Hz %u-ch %u-bit " ,
2073
+ hour ,min ,sec ,centisec ,percent / 10U , percent % 10U ,wav_play_position ,wav_data_length ,
2074
2074
(unsigned long )play_codec .sample_rate ,
2075
2075
(unsigned int )play_codec .number_of_channels ,
2076
2076
(unsigned int )play_codec .bits_per_sample );
0 commit comments