Read the battery voltage

Sorry to be late.
I need to explain some complex circuit knowledge. What is read using analogRead() is the value of the ADC. When there is a USB cable supply, at this time the IC supply voltage is 3.3V and the components are operating at normal voltage, so the ADC input of 2.9V can be distinguished normally.
When the USB cable is unplugged, because the input voltage is less than the set ldo input voltage range, the ldo cannot step down and the output becomes 2.9V, at this time the IC can only work at 2.9V, it will be misjudged as full voltage (3.3V) supply, which is a phenomenon caused by illegal operation, we also do not allow such a low input voltage, although the IC can work normally, but the ADC has appeared The situation of inaccurate reading has occurred.
If you need to measure voltage, our advice is. Use a battery higher than 3.3V (not greater than 5V) and let him work with a voltage lower than 3.3V (or equal) then the alarm warns that it should be charged and used.