import { paginaMeta, jsonLd } from "@/lib/seo"; export async function generateMetadata({ params }) { const { locale } = await params; const isEn = locale === "en"; const isEs = locale === "es"; const isFr = locale === "fr"; const isDe = locale === "de"; const isZh = locale === "zh-CN"; return paginaMeta({ titulo: isEs ? "Diagnóstico de errores comunes en ESP32: Guía profesional" : isEn ? "Common ESP32 Errors & Diagnostics: Professional Guide" : isFr ? "Diagnostic des erreurs courantes sur ESP32 : guide professionnel" : isZh ? "ESP32 常见故障诊断:专业指南" : isDe ? "Diagnose häufiger ESP32-Fehler: Professioneller Leitfaden" : "Diagnóstico de Erros Comuns no ESP32: Guia Profissional", descricao: isEs ? "Guía técnica definitiva para identificar y solucionar Brownout, Guru Meditation, Task Watchdog, Stack Overflow, fugas de memoria y fallas de arranque en ESP32 (Arduino y ESP-IDF)." : 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)." : isFr ? "Guide technique pour identifier et résoudre Brownout, Guru Meditation, Task Watchdog, Stack Overflow, fuites de mémoire et pannes de démarrage sur ESP32 (Arduino et ESP-IDF)." : isZh ? "权威技术指南,用于识别并解决 ESP32(Arduino 与 ESP-IDF)上的 Brownout、Guru Meditation、Task Watchdog、栈溢出、内存泄漏和启动故障。" : isDe ? "Technischer Leitfaden zur Behebung von Brownout, Guru Meditation, Task Watchdog, Stack Overflow, Speicherlecks und Boot-Problemen beim 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: isEs ? [ "errores comunes ESP32", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "cómo depurar ESP32", "ESP32 reiniciando en bucle", "failed to connect to esp32", ] : 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", ] : isFr ? [ "erreurs courantes ESP32", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "comment déboguer ESP32", "ESP32 redémarre en boucle", "failed to connect to esp32", ] : isZh ? ["ESP32 常见错误", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "如何调试 ESP32", "ESP32 反复重启", "failed to connect to esp32"] : isDe ? [ "häufige ESP32-Fehler", "brownout detector was triggered", "guru meditation error", "task watchdog got triggered", "stack canary watchpoint triggered", "ESP32 debuggen", "ESP32 Bootloop Neustart", "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.", }, ]; const faqsEs = [ { pergunta: "¿Qué causa el error 'Brownout detector was triggered' en el ESP32?", resposta: "Ocurre cuando la tensión en el pin 3V3 cae por debajo de 2.8V ~ 2.43V debido a picos rápidos de corriente de la radio Wi-Fi/BLE (que superan los 500mA), cables USB delgados o un regulador LDO inadecuado. La solución de ingeniería implica agregar condensadores Low-ESR de 10µF a 100µF cerca de VCC y usar reguladores LDO robustos de más de 600mA.", }, { pergunta: "¿Cómo solucionar el 'Guru Meditation Error (LoadProhibited)'?", resposta: "LoadProhibited indica un intento de acceder a un puntero nulo (NULL) o inválido en la memoria. La solución consiste en utilizar Espressif Exception Decoder o addr2line para localizar la línea exacta en el código e implementar comprobaciones defensivas como if (puntero != NULL).", }, { pergunta: "¿Por qué se activa el Task Watchdog Timer (TWDT) en FreeRTOS?", resposta: "El TWDT se activa cuando una tarea de mayor prioridad monopoliza la CPU en un bucle bloqueante (por ejemplo: while(1) sin vTaskDelay), impidiendo que la tarea IDLE alimente el watchdog del sistema operativo.", }, { pergunta: "¿Por qué fallan las conexiones HTTPS y TLS con el código -0x2700 en ESP32?", resposta: "Porque al encenderse, el reloj interno del ESP32 comienza en el año 1970. El validador de certificados TLS considera inválido el certificado del servidor por estar en el 'futuro'. Sincronizar el reloj mediante SNTP (configTime) antes de la conexión resuelve el problema.", }, ]; const faqsFr = [ { pergunta: "Quelle est la cause de l'erreur 'Brownout detector was triggered' sur l'ESP32 ?", resposta: "Elle survient lorsque la tension sur la broche 3V3 chute sous 2.8V ~ 2.43V en raison des pics rapides de courant de la radio Wi-Fi/BLE (dépassant 500mA), de câbles USB trop fins ou d'un régulateur LDO sous-dimensionné. La solution d'ingénierie consiste à ajouter des condensateurs Low-ESR de 10µF à 100µF près du VCC et à utiliser un régulateur LDO robuste de 600mA+.", }, { pergunta: "Comment résoudre le 'Guru Meditation Error (LoadProhibited)' ?", resposta: "LoadProhibited indique une tentative d'accès à un pointeur nul (NULL) ou invalide en mémoire. La solution consiste à utiliser l'Espressif Exception Decoder ou addr2line pour identifier la ligne exacte du code et à appliquer des vérifications défensives telles que if (pointeur != NULL).", }, { pergunta: "Pourquoi le Task Watchdog Timer (TWDT) se déclenche-t-il sous FreeRTOS ?", resposta: "Le TWDT se déclenche lorsqu'une tâche de priorité plus élevée monopolise le CPU dans une boucle bloquante (par exemple : while(1) sans vTaskDelay), empêchant la tâche IDLE de nourrir le watchdog du système d'exploitation.", }, { pergunta: "Pourquoi les connexions HTTPS et TLS échouent-elles avec l'erreur -0x2700 sur l'ESP32 ?", resposta: "Au démarrage, l'horloge interne de l'ESP32 démarre à l'année 1970. Le validateur de certificats TLS considère le certificat du serveur invalide car situé dans le 'futur'. Synchroniser l'horloge via SNTP (configTime) avant la connexion résout le problème.", }, ]; const faqsDe = [ { pergunta: "Was verursacht den Fehler 'Brownout detector was triggered' beim ESP32?", resposta: "Er tritt auf, wenn die Spannung an der 3V3-Leitung durch schnelle Stromspitzen des Wi-Fi/BLE-Funkmoduls (über 500mA), dünne USB-Kabel oder einen unterdimensionierten LDO-Regler unter 2.8V ~ 2.43V abfällt. Die Lösung besteht darin, Low-ESR-Kondensatoren von 10µF bis 100µF nahe an VCC zu platzieren und robuste LDO-Regler mit 600mA+ einzusetzen.", }, { pergunta: "Wie behebt man den 'Guru Meditation Error (LoadProhibited)'?", resposta: "LoadProhibited weist auf den Versuch hin, auf einen Null-Zeiger (NULL) oder eine ungültige Speicheradresse zuzugreifen. Die Lösung besteht darin, den Espressif Exception Decoder oder addr2line zu verwenden, um die genaue Quellcodezeile zu lokalisieren, und defensive Prüfungen wie if (ptr != NULL) einzufügen.", }, { pergunta: "Warum löst der Task Watchdog Timer (TWDT) in FreeRTOS aus?", resposta: "Der TWDT löst aus, wenn ein Task mit höherer Priorität die CPU in einer blockierenden Schleife monopolisiert (z. B. while(1) ohne vTaskDelay) und so verhindert, dass der IDLE-Task den Watchdog des Betriebssystems bedient.", }, { pergunta: "Warum schlagen HTTPS- und TLS-Verbindungen beim ESP32 mit Fehler -0x2700 fehl?", resposta: "Beim Start beginnt die interne Systemuhr des ESP32 im Jahr 1970. Die TLS-Zertifikatsprüfung stuft das Serverzertifikat als ungültig ein, da es in der fernen 'Zukunft' liegt. Eine Zeitsynchronisation über SNTP (configTime) vor dem Verbindungsaufbau behebt das Problem.", }, ]; const faqsZh = [ { pergunta: "ESP32 上出现“Brownout detector was triggered”是什么原因?", resposta: "当 Wi-Fi/BLE 射频产生快速电流峰值(常超过 500mA)时,3V3 电源轨跌到 2.8V ~ 2.43V 以下,就会出现这个错误,通常由过细的 USB 线或容量不足的 LDO 稳压器引起。工程上的解决办法是在 VCC 附近放置 10µF 到 100µF 的低 ESR 旁路电容,并使用 600mA 以上的可靠 LDO 稳压器。", }, { pergunta: "如何解决“Guru Meditation Error (LoadProhibited)”?", resposta: "LoadProhibited 表示试图读取或写入空(NULL)或无效的内存地址。解决办法是用 Espressif Exception Decoder 或 addr2line 定位源代码行,并加入 if (ptr != NULL) 这类防御式检查。", }, { pergunta: "为什么 FreeRTOS 中会触发任务看门狗定时器(TWDT)?", resposta: "当高优先级任务在紧凑的阻塞循环中独占 CPU(例如没有 vTaskDelay 的 while(1)),使负责喂操作系统看门狗的低优先级 IDLE 任务得不到运行时,TWDT 就会触发。", }, { pergunta: "为什么 ESP32 上 HTTPS 和 TLS 连接会出现错误 -0x2700?", resposta: "ESP32 启动时,内部系统时钟从 1970 年纪元开始。TLS 证书校验器会因服务器证书的有效期落在遥远的“未来”而拒绝该证书。在发起 TLS 连接之前,通过 SNTP(configTime)同步时间即可解决。", }, ]; export default async function DiagnosticoLayout({ children, params }) { const { locale } = await params; const isEn = locale === "en"; const isEs = locale === "es"; const isFr = locale === "fr"; const isDe = locale === "de"; const isZh = locale === "zh-CN"; const faqs = isEs ? faqsEs : isEn ? faqsEn : isFr ? faqsFr : isZh ? faqsZh : isDe ? faqsDe : faqsPt; const canonPath = isEs ? "/es/diagnostico" : isEn ? "/en/diagnostics" : isFr ? "/fr/diagnostic" : isZh ? "/zh-CN/diagnostics" : isDe ? "/de/diagnose" : "/diagnostico"; return ( <>