SerialBT.println failing when callback contains delay() command
Posted: Fri Oct 11, 2019 6:23 pm
In the code below if I uncomment either the delay() or restart() lines I don't receive the 'Restarting...' message on my phone.
I can understand why just restarting with a delay might kill the serial Bluetooth message before it's sent but why would just a delay command affect it?
I can understand why just restarting with a delay might kill the serial Bluetooth message before it's sent but why would just a delay command affect it?
Code: Select all
void callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
if (event == ESP_SPP_DATA_IND_EVT && client_wifi_ssid != "not_set") {
client_wifi_password = SerialBT.readString();
SerialBT.println("Restarting...");
preferences.putString("pref_ssid", client_wifi_ssid);
preferences.putString("pref_pass", client_wifi_password);
preferences.end();
//delay(1000);
//ESP.restart();
}
}