schreibfaul1 / ESP32-vs1053_ext

With this library You can easily build a WebRadio with a ESP32 board and a mp3-module. See: https://www.youtube.com/watch?v=u4u9NvZvWRk
GNU General Public License v3.0
106 stars 29 forks source link

VS1053::getVolume() correction #20

Closed clear-sky closed 3 years ago

clear-sky commented 3 years ago

HI dear wolle thanks for this great lib i found a little bug in this lib : VS1053::getVolume() returns wrong value ins it needs a little correction in VS1053::setVolume this is your code: void VS1053::setVolume(uint8_t vol) { uint16_t value; // Value to send to SCI_VOL if(vol > 21) vol=21; vol=volumetable[vol]; if(vol != curvol) { curvol=vol; // Save for later use value=map(vol, 0, 100, 0xF8, 0x00); // 0..100% to one channel value=(value << 8) | value; write_register(SCI_VOL, value); // Volume left and right } }

for correction please edit: void VS1053::setVolume(uint8_t vol) { uint16_t value; // Value to send to SCI_VOL if(vol > 21) vol=21;

if(vol != curvol)
{
    curvol=vol;                                      // Save for later use
    vol=volumetable[vol];
    value=map(vol, 0, 100, 0xF8, 0x00);              // 0..100% to one channel
    value=(value << 8) | value;
    write_register(SCI_VOL, value);                  // Volume left and right
}

}

schreibfaul1 commented 3 years ago

thanks!