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();
}
}