Simple way how to reboot ESP32 in Arduino or PlatformIO

Just use

ESP.restart();

This will immediately reboot the ESP32 controller