First of all, BLE is work in progress. From time to time changes are uploaded.
At same time, esp-idf is changed very often.
Since this is my hobby only, please don't expect a full blown up implementation soon.
Your problem seems to be one of those changes in esp-idf. Sequence of calls during setup (and params for release ??) changed.
You could try this
void jsble_init(){
esp_err_t ret;
ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
if(ret) {jsWarn("mem release failed:%x\n",ret); return;}
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ret = esp_bt_controller_init(&bt_cfg);if(ret) {jsWarn("initialize controller failed:%x\n",ret); return;}
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);if(ret) {jsWarn("enable controller failed:%x\n",ret); return;}
ret = esp_bluedroid_init();if (ret) {jsWarn("init bluetooth failed:%x\n",ret);return;}
ret = esp_bluedroid_enable();if (ret) {jsWarn("enable bluetooth failed:%x\n",ret);return;}
ret = esp_ble_gap_register_callback(gap_event_handler);if (ret){jsWarn("gap register error:%x\n", ret);return;}
ret = esp_ble_gatts_register_callback(gatts_event_handler);if(ret){jsWarn("gatts register error:%x\n", ret);return;}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
First of all, BLE is work in progress. From time to time changes are uploaded.
At same time, esp-idf is changed very often.
Since this is my hobby only, please don't expect a full blown up implementation soon.
Your problem seems to be one of those changes in esp-idf. Sequence of calls during setup (and params for release ??) changed.
You could try this