ESP32 ADC measurment with variable input voltage?

The Uno has an internal fixed reference you can select as an option. Look to see if the ESP32 has one. If so, drop your battery voltage to a compatible range with a large-value divider, measure that, and back-calculate the actual battery voltage.