setVolume values / question
h1aji opened this issue · 1 comments
h1aji commented
I was comparing setVolume
ESP_VS1053_Library/src/VS1053.cpp
Lines 189 to 218 in f501eb7
with the code from Adafruit
void Adafruit_VS1053::setVolume(uint8_t left, uint8_t right) {
// accepts values between 0 and 255 for left and right.
uint16_t v;
v = left;
v <<= 8;
v |= right;
noInterrupts(); // cli();
sciWrite(VS1053_REG_VOLUME, v);
interrupts(); // sei();
}
And found that maximum value for setVolume is 254. So, which value would be correct in this case?
Dr-Dawg commented
The map function maps the values from 0-100 to 0-254 (= 0xFE ), see
https://www.arduino.cc/reference/de/language/functions/math/map/
So basically both funtions do the same. Using a range from 0-100 is of course coarser, but imho is more intuitive and does not really make a difference.