I have a program working for flying a Tello drone with ESP32 based wifi. See:
https://www.hackster.io/jjs357/esp32-based-drone-controller-db079d
I am currently using an AdaFruit Feather ESP32 (not S2 or S3).
I am trying to convert this to allow a Nano ESP32 to be used instead.
I got basic flying to work but I also use WiFi Manager for pairing a Tello drone to the controller and the SPIFFS file system for saving a flight while it is being flown manually so it can be replayed.
SPIFFS must be initialized before use.
Something in the startup code is broken but the Dfu port and the serial port don't play nice with each other, at least for 2.1.1 of the IDE. So I see no errors but the serial port shows nothing even after I reselect the right port and the boot-up messages are missing (where do they get written?).
My setup code begins:
void setup(){
wm.setConfigPortalTimeout(45); // auto close configportal after 45 seconds
// Initilize hardware serial:
Serial.begin(115200);
// Serial.setTimeout(0);
String manageTello = "ManageTello";
// manageTello = manageTello + "456";
Serial.println(manageTello);
if(!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)){
Serial.println("SPIFFS Mount Failed");
return;
}
With the feather if I wait for awhile then SPIFFS does get formatted and a restart of the ESP32 then begins normally.
My use of the WiFi manager library is supposed to spawn a captive portal as part of setup:
WiFi.mode(WIFI_STA);
WiFi.onEvent(WiFiEvent);
// wm.resetSettings(); // uncomment to force new Tello Binding here
bool res;
// res = wm.autoConnect("ManageTello","telloadmin"); // password protected ap
res = wm.autoConnect(manageTello.c_str(),"telloadmin"); // password protected ap
if(!res) {
Serial.println("Failed to connect or hit timeout");
display.clearDisplay();
display.setCursor(0, 0);
display.println("Reset Controller");
display.println("Use ManageTello AP");
display.println("On Phone or Computer");
display.println("To Connect to Tello");
display.display();
// ESP.restart();
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected with DroneBlocks controller to Tello WiFi :)");
tello_ssid = (String)wm.getWiFiSSID();
}
}
Something is failing at startup but I don't know what to blame.
Anyone have a suggestion to locate where and what the bad startup can be blamed on?