I haven't used it, but there now seems to be some good support in the ESP-IDF Framework: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/...