I’m using that SparkFun battery shield with Photon with no issues getting updates on I2C.
You are right taking these calls out of
getBatteryData() and put them into setup.
// Set up the MAX17043 LiPo fuel gauge:
lipo.begin(); // Initialize the MAX17043 LiPo fuel gauge
// Quick start restarts the MAX17043 in hopes of getting a more accurate
// guess for the SOC.
// We can set an interrupt to alert when the battery SoC gets too low.
// We can alert at anywhere between 1% - 32%:
lipo.setThreshold(20); // Set alert threshold to 20%.
Have you tested that POST to be sure it isn’t locking things up? I’d try commenting out the POST in the function to rule out any issues there as well (print to serial instead?). That interrupt may need clearing so you may be making that POST on startup, even if your battery is charged above the interrupt threshold.
Anyways, more serial debug is always better to try to see where things have gone pear-shaped.
My main bugaboo with that battery charging breakout is that there is no way to tell if the circuit is charging (in software or hardware). They missed that…