Unplugging USB stops Sparkfun ESP-32 Thing Plus from reading sensors

Still my first project to make a self powered temperature monitor. I have a SHTC3 and 2 TMP102 sensors working to record data and send results to an ADAFRUIT FEATHER SD and RTC card. All worked fine until I tried to unplug USB and run off a battery. First, everything quit until I stopped any SerialPrint calls in the LOOP. I even put a serial.end() call at the end of SETUP.

At this point, at least the sketch restarted at time zero, but obviously recorded no data while unplugged from the USB. Last try was to comment out any serial.print calls in setup, even the Serial.begin(9600) call.

The following call:

#ifndef ESP8266

while (!Serial); // wait for serial port to connect. Needed for native USB

is still in the sketch because it looked important. I this my mistake?

Now the sketch continues to run while unplugged, but none of the sensors provide meaningful readings. SHTC3 gives 0.0 Humidity and -49 temp., while the TMP102’s say nan.

I am sure there is a simple explanation for this behavior, since I am not the first person to try to record data while unplugged from USB. However, I tried, unsuccessfully, to find a similar topic in this forum.

Thanks for any help. Rudy

Forget it everyone. I am a dumekopf. How many times did I read that the i2C connection can only have one set of pull up resistors. My only excuse is that old Heathkit televisions and house wiring don’t use pullup resistors. Again sorry for taking your time.