@RWB, I think this is not a really helpful suggestion, especially since you yourself had a similar problem to which I responded with this
So again
PMIC _pmic; // instantiate an object
...
void setup()
{
_pmic.disableCharging();
...
}
Thanks for editing your post accordingly