I have been trying to implement modem sleep in the ESP32-C3, more specifically for BLE, since I could not find a singular function that handles modem sleep. The current draw when modem is on, is about 80 mA, and when modem has not been turned on, the average current draw is 10 mA.
So far I have been able to come up with this:
- while (1)
- {
- vTaskDelay(pdMS_TO_TICKS(3000));
- // modem sleep
- esp_bt_sleep_enable();
- esp_bt_controller_disable();
- esp_wifi_bt_power_domain_off();
- vTaskDelay(pdMS_TO_TICKS(3000));
- // turn modem on
- esp_wifi_bt_power_domain_on();
- esp_bt_controller_enable(ESP_BT_MODE_BLE);
- esp_bt_sleep_disable();
- }
Is there an easy way to turn on modem sleep? And is there a way to find out if there are any ongoing or pending BLE transmissions?