/* 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"); }