The lock feature in PMIC only prevents simultaneous access from the system thread and system power manager and your user calls to the PMIC. If you don’t lock, there’s a possibility that the system and user calls will be interleaved and not have the desired effect.
You want the lock in a small scope, even surrounding it with {}.
{
PMIC pmic(true); //Calling it with true locks it to the user code
pmic.disableCharging();
}
Don’t lock across a long period of time, like the whole time charging is disabled.