firmware: v17 — waitForReady restaurado, sin watchdog
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// ================================================================
|
||||
// OTA CONFIG
|
||||
// ================================================================
|
||||
#define FW_VERSION 16
|
||||
#define FW_VERSION 17
|
||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||
#define GITEA_OWNER "Natxo"
|
||||
#define GITEA_REPO "Arduino-Car"
|
||||
@@ -110,6 +110,35 @@ static void checkOTA() {
|
||||
WiFi.mode(WIFI_OFF); // apaga radio para ahorrar energía
|
||||
}
|
||||
|
||||
void waitForReady() {
|
||||
delay(300);
|
||||
while (Serial.available()) Serial.read();
|
||||
unsigned long timeout = millis() + 90000UL;
|
||||
String buf = "";
|
||||
while (millis() < timeout) {
|
||||
while (Serial.available()) {
|
||||
char c = Serial.read();
|
||||
if (c == '\n') {
|
||||
buf.trim();
|
||||
if (buf == "GO") {
|
||||
Serial.print("OK\n");
|
||||
delay(50);
|
||||
while (Serial.available()) Serial.read();
|
||||
// 2 pitidos: conexión entre placas lista
|
||||
for (int i = 0; i < 2; i++) {
|
||||
digitalWrite(buzzerPin, HIGH); delay(180);
|
||||
digitalWrite(buzzerPin, LOW); delay(180);
|
||||
}
|
||||
return;
|
||||
}
|
||||
buf = "";
|
||||
} else if (c != '\r' && buf.length() < 8) {
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// 1. Pines y parada inmediata
|
||||
@@ -133,9 +162,8 @@ void setup() {
|
||||
servoX.write(posX);
|
||||
servoY.write(posY);
|
||||
|
||||
// 5. Esperar a que el ESP32-CAM termine de arrancar
|
||||
unsigned long elapsed = millis();
|
||||
if (elapsed < 15000) delay(15000 - elapsed);
|
||||
// 5. Esperar "GO\n" del ESP32-CAM antes de procesar comandos
|
||||
waitForReady();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// ================================================================
|
||||
// OTA CONFIG
|
||||
// ================================================================
|
||||
#define FW_VERSION 16
|
||||
#define FW_VERSION 17
|
||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||
#define GITEA_OWNER "Natxo"
|
||||
#define GITEA_REPO "Arduino-Car"
|
||||
@@ -24,6 +24,29 @@ const char *password = "Suprak1llm1ndS23S";
|
||||
void startCameraServer();
|
||||
void setupLedFlash();
|
||||
|
||||
static void handshakeTask(void *) {
|
||||
unsigned long deadline = millis() + 30000UL;
|
||||
String buf = "";
|
||||
while (millis() < deadline) {
|
||||
Serial.print("GO\n");
|
||||
unsigned long t = millis();
|
||||
while (millis() - t < 300) {
|
||||
while (Serial.available()) {
|
||||
char c = Serial.read();
|
||||
if (c == '\n') {
|
||||
buf.trim();
|
||||
if (buf == "OK") { vTaskDelete(NULL); return; }
|
||||
buf = "";
|
||||
} else if (c != '\r' && buf.length() < 8) {
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(5));
|
||||
}
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
// ── OTA: comprueba si hay firmware nuevo y actualiza si hace falta ──
|
||||
static void checkOTA() {
|
||||
@@ -147,6 +170,8 @@ void setup() {
|
||||
|
||||
// ── Servidor cámara ───────────────────────────────────────────────
|
||||
startCameraServer();
|
||||
|
||||
xTaskCreate(handshakeTask, "handshake", 4096, NULL, 1, NULL);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
16
|
||||
17
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
16
|
||||
17
|
||||
Reference in New Issue
Block a user