Root cause of the dead data path (assoc/scan/RPC fine, zero data frames): esp-hosted 1.4.x is formally incompatible with IDF 5.5 (esp-hosted-mcu#47) and the factory C6 slave firmware was ancient (couldn't even answer a version RPC). Waveshare's examples pin 1.4.* — do not follow them. Fix: - host: espressif/esp_hosted ^2.12 (+ esp_wifi_remote 1.6) - slave: 2.12.11 network_adapter.bin embedded in the app (c6_ota.c streams it to the C6 over the SDIO RPC channel at boot when the reported version is < 2.x; ~10s, no wires, idempotent) - RAM diet for hosted 2.x's footprint (MEMPOOL_PREFER_SPIRAM, reduced WIFI_RMT buffers) — without it internal SRAM famine boot-loops in xTaskCreateStaticPinnedToCore before app_main - conservative 20MHz SDIO clock for first verified data path Verified on hardware: DHCP lease (even that healed), 8/8 pings to router and tower-of-joy at 1-5ms, WebSocket to the gateway connected, device registered at /devices as desklock-p4 with fw version. Also: wifi_diag.c L1 SoftAP diagnostic mode (DESKLOCK-DIAG) with review fixes, boot ping ladder in net.c, static-IP fallback, face_status() line, docs for the whole failure taxonomy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
/* DeskLock — living-room face and voice for the Tatlock butler.
|
|
*
|
|
* Boot: display + face -> audio (gong) -> Wi-Fi (C6/ESP-Hosted) -> gateway WS.
|
|
* Interaction (phase 2): touch-to-talk — tap to speak, tap again to finish.
|
|
*/
|
|
|
|
#include "esp_log.h"
|
|
#include "bsp/esp-bsp.h"
|
|
|
|
#include "desklock.h"
|
|
|
|
/* 1 = L1 wifi driver diagnosis (SoftAP, no STA/gateway). 0 = normal app. */
|
|
#define WIFI_DIAG_MODE 0
|
|
|
|
static const char *TAG = "desklock";
|
|
|
|
static bool s_talking;
|
|
|
|
void app_on_touch(void)
|
|
{
|
|
face_activity();
|
|
|
|
if (!gw_connected()) {
|
|
return;
|
|
}
|
|
if (!s_talking) {
|
|
if (audio_is_playing() || face_get() == FACE_EFFORT) {
|
|
return; /* barge-in is phase 4 */
|
|
}
|
|
s_talking = true;
|
|
gw_send_text("{\"type\":\"utterance_start\"}");
|
|
audio_capture_start();
|
|
face_set(FACE_LISTENING);
|
|
ESP_LOGI(TAG, "listening…");
|
|
} else {
|
|
s_talking = false;
|
|
audio_capture_stop();
|
|
gw_send_text("{\"type\":\"utterance_end\"}");
|
|
face_set(FACE_PENSIVE);
|
|
ESP_LOGI(TAG, "utterance sent");
|
|
}
|
|
}
|
|
|
|
void app_on_playback_done(void)
|
|
{
|
|
#if !WIFI_DIAG_MODE
|
|
face_set(FACE_IDLE); /* in diag mode the status line must stay visible */
|
|
#endif
|
|
}
|
|
|
|
void app_main(void)
|
|
{
|
|
ESP_LOGI(TAG, "DeskLock starting");
|
|
|
|
bsp_display_start();
|
|
bsp_display_backlight_on();
|
|
face_init();
|
|
|
|
audio_init();
|
|
audio_play_gong();
|
|
|
|
#if WIFI_DIAG_MODE
|
|
wifi_diag_start();
|
|
#else
|
|
net_start();
|
|
c6_ota_start(); /* one-shot C6 radio firmware update — remove once proven */
|
|
#endif
|
|
|
|
ESP_LOGI(TAG, "DeskLock up");
|
|
}
|