I tried below simple sketch on TTGO LoRa32 V2.
I connected GPIO35 via 2x 100k (1%) voltage divider (like LoRa32 V2.1) to a an adjustable power supply (instead of battery) so I could do some measurements. Power to TTGO LoRa32 was supplied via USB connector. Voltage measured on the 3.3V pin was 3.287V
I measured the actual voltage on GPIO35 with a multimeter. In contrast to the values measured with analogRead, the multimeter (as expected) correctly showed 50% of the value from the adjustable power supply over the full measured range.
Results:
On average the analog reading on GPIO35 was around 0.2V too low.
Only when the input voltage on GPIO35 approached 3.0V did the difference between actual input voltage and the value reported by analogRead start to decrease.
On 3.0V input it reported around 2.9V. So the difference suddenly started to change here. On 3.30V input the reported value was 3.30V, no differences anymore.
(The measured values did fluctuate, I have taken estimated averages.)
Conclusion:
A constant (about) 0.2V too low from 0 to about 3.0V and from 3.0V the difference quickly disappearing. So there is quite some none-linearity.
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C display(/*reset*/ U8X8_PIN_NONE);
#define ANALOG_PIN 35
#define ANALOG_MAX_VALUE 4095
void setup() {
display.begin();
display.setFont(u8x8_font_victoriamedium8_r);
display.print("analogRead(");
display.print(ANALOG_PIN);
display.print(")");
}
void loop() {
int analogValue = analogRead(ANALOG_PIN);
float voltage = analogValue * (3.3 / ANALOG_MAX_VALUE);
display.clearLine(2);
display.setCursor(0, 2);
display.print(analogValue);
display.clearLine(4);
display.setCursor(0, 4);
display.print(voltage);
display.print(" V");
delay(1000);
}