I'm dipping my toes into using LiPo batteries for supplying power to small devboard projects, currently with an LOLIN S2 mini.
So I got hold of a MH-CD42 module, which seemed like a safe way to start with.
I came up with this example schematic to illustrate what I'm trying to do: to use the onboard USB port to power the board and charge the battery when connected, and to power the board with the battery if USB is disconnected. In this schematic I would need to flip the switch to accomplish this but I wonder if there is a way to wire this up so that a switch is not needed and the board does not reset when (dis)connecting the USB connection. Any thoughts on this are appreciated.

