How to detect whether the battery pack is disconnected