Night-watch caught the instability in the act at 7min uptime: E H_SDIO_DRV: sdio_write_task: Failed to send data: 258 (timeout) E H_SDIO_DRV: Unrecoverable host sdio state -> SW_CPU_RESET i.e. esp-hosted-mcu#167. Known mitigation: 1-bit SDIO bus (#148), still ~80x voice bandwidth. Also: recovery reboots no longer ring the gong (esp_reset_reason gate) - a butler doesn't bong at 3am. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
74 lines
1.7 KiB
C
74 lines
1.7 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 "esp_system.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();
|
|
if (esp_reset_reason() == ESP_RST_POWERON) {
|
|
audio_play_gong(); /* cold boot only — recovery reboots stay silent */
|
|
}
|
|
|
|
#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");
|
|
}
|