I did some AI, this gives me my original code.
I charge batt to 4.2 V with a solar + bms

But my readings, as mention, are different, actual batt is 3.88, reading is 4.68?
After voltage divider I messure 1.92v (2x 1.92 = 3.84)

If your voltage divider, consisting of two 1 kΩ resistors, gives a maximum voltage of 2100 mV (2.1V), and you want to use the map() function to scale an analog reading to this range, you should use the following parameters:

fromLow is the minimum value of your analog reading (usually 0).

fromHigh is the maximum value of your analog reading (usually 1023 for a 10-bit ADC).

toLow is 0 (as you want to map to 0V).

toHigh is 2100 (as this is the maximum voltage you can measure).

Here, analogReading is the analog value you want to scale within the range of 0 to 2100 based on your voltage divider's output. The map() function will linearly map this value to the new range. If analogReading is 0, the result will be 0 mV, and if analogReading is 1023, the result will be 2100 mV (2.1V), and values in between will be linearly interpolated between these two endpoints.

To start with, by default the ESP32 ADC output ranges from 0 to 4095 for input from 0 to 3.3V, so there is really nothing correct about your scaling or use of the map function.

The ADC is also nonlinear, and not very useful for making accurate measurements.

There are some tutorials on line on how to use the ESP32 ADC, so spend some time studying them.

I did some AI

Does this mean you asked chatGPT for advice? Good luck with that.

Given the nonlinearity of the ESP32 ADC, that is about what you could expect. Careful re-calibration of the ADC in the voltage range of interest should produce a more accurate result.