import { paginaMeta, jsonLd } from "@/lib/seo"; export async function generateMetadata({ params }) { const { locale } = await params; const isEn = locale === "en"; return paginaMeta({ titulo: isEn ? "Common ESP32 Errors & Diagnostics: Professional Guide" : "Diagnóstico de Erros Comuns no ESP32: Guia Profissional", descricao: isEn ? "Definitive technical guide to identify and fix Brownout, Guru Meditation, Task Watchdog, Stack Overflow, memory leaks, and boot issues on ESP32 (Arduino & ESP-IDF)." : "Guia técnico definitivo para identificar e resolver Brownout, Guru Meditation, Task Watchdog, Stack Overflow, vazamento de memória e falhas de boot no ESP32 (Arduino e ESP-IDF).", caminho: "/diagnostico", locale, keywords: isEn ? [ "common ESP32 errors", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "how to debug ESP32", "ESP32 bootloop rebooting", "failed to connect to esp32", ] : [ "erros comuns ESP32", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "como debugar ESP32", "ESP32 reiniciando em loop", "failed to connect to esp32", ], }); } const faqsPt = [ { pergunta: "O que causa o erro 'Brownout detector was triggered' no ESP32?", resposta: "Ocorre quando a tensão no pino 3V3 cai abaixo de 2.8V ~ 2.43V devido a picos rápidos de corrente do rádio Wi-Fi/BLE (superando 500mA), cabos USB finos ou regulador LDO inadequado. A solução de engenharia envolve adicionar capacitores Low-ESR de 10µF a 100µF próximos ao VCC e usar LDOs robustos de 600mA+.", }, { pergunta: "Como resolver o 'Guru Meditation Error (LoadProhibited)'?", resposta: "LoadProhibited indica tentativa de acessar um ponteiro nulo (NULL) ou inválido na memória. A solução consiste em usar o Espressif Exception Decoder ou addr2line para localizar a linha exata no código e implementar validações defensivas como if (ponteiro != NULL).", }, { pergunta: "Por que o Task Watchdog Timer (TWDT) dispara no FreeRTOS?", resposta: "O TWDT dispara quando uma tarefa de prioridade maior monopoliza a CPU em um loop bloqueante (ex: while(1) sem vTaskDelay), impedindo a tarefa IDLE de alimentar o watchdog do sistema operacional.", }, { pergunta: "Por que conexões HTTPS e TLS falham com código -0x2700 no ESP32?", resposta: "Porque ao ligar, o ESP32 inicia o relógio interno no ano de 1970. O validador de certificados TLS considera o certificado do servidor inválido por estar no 'futuro'. Sincronizar o relógio via SNTP (configTime) antes da conexão resolve o problema.", }, ]; const faqsEn = [ { pergunta: "What causes 'Brownout detector was triggered' on ESP32?", resposta: "It occurs when the 3V3 rail drops below 2.8V ~ 2.43V during rapid Wi-Fi/BLE radio current spikes (often exceeding 500mA), caused by thin USB cables or an undersized LDO regulator. The engineering solution involves placing 10µF to 100µF Low-ESR bypass capacitors near VCC and using 600mA+ robust LDO regulators.", }, { pergunta: "How to resolve 'Guru Meditation Error (LoadProhibited)'?", resposta: "LoadProhibited indicates an attempt to read from or write to a null (NULL) or invalid memory address. The fix involves using the Espressif Exception Decoder or addr2line to pinpoint the source line and applying defensive checks such as if (ptr != NULL).", }, { pergunta: "Why does the Task Watchdog Timer (TWDT) trigger in FreeRTOS?", resposta: "The TWDT triggers when a high-priority task monopolizes the CPU in a tight blocking loop (e.g. while(1) without vTaskDelay), starving the lower-priority IDLE task that feeds the operating system watchdog.", }, { pergunta: "Why do HTTPS and TLS connections fail with error -0x2700 on ESP32?", resposta: "On boot, the ESP32 internal system clock starts at epoch year 1970. The TLS certificate validator rejects the server certificate because its validity dates appear in the distant 'future'. Synchronizing time via SNTP (configTime) prior to initiating TLS connections resolves the issue.", }, ]; export default async function DiagnosticoLayout({ children, params }) { const { locale } = await params; const isEn = locale === "en"; const faqs = isEn ? faqsEn : faqsPt; return ( <>