Reboot when switching on Wi-Fi or load often indicates a drop in voltage or disturbance. First read the cause reset and check the power supply before changing the software logic.
If the ESP32 resets only at engine start, separate the power supply test from the control signal test. Also monitor the heating of the converter and connections.
Switching off the brownout protection masks the symptom. The rated power of the power supply does not yet prove a good response to current shocks or a small drop on the cable.
Select products according to the above criteria; the list is not a confirmation that they are all interchangeable.
ESP32 38 pin WIFI IoT Bluetooth
ESP32-S3 N16R8 WiFi development panel BT 8MB PSRAM
Mini360 DC-DC voltage converter down
Double 5V DC automatic relay with diode and optocopler
MOSFET Module 15A 400W PWM DC 5V-36V Strength Arduino Module
Look
Arduino and ESP32: overview of power supply, signal levels and module connections
Look
EV4300 – instructions for use in Slovene (V2.0)