P channel mosfet with esp32

See answer #3 in this thread:

And change R1 to 1k for the 42V supply.