Files
desklock/firmware/main/desklock.h
T
jpmschweitzerandClaude Opus 4.8 cdb23bda05 feat(firmware): volume control goes to eleven
Rework the speaker volume from a 0-100 percentage to an 11-step level
(0..11, mapped to the codec's percent), with mute that remembers the
prior level so unmute restores it. Any non-silent change plays the gong
as feedback; a new change cuts the in-flight gong off and restarts it
rather than queueing another. The tap overlay shows the level number and
0..11 bar, and a "11" drifts up off the bar when you hit maximum.

Also lands the device side of gateway volume commands: gw_client routes a
"command" message to face_volume_command, which applies the change and
shows a compact auto-hiding volume HUD (a centered bar) — the gateway
half that sends these lives in a following commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKPbR6DY2JygHbyLjxm7Uu
2026-07-15 21:27:48 +02:00

66 lines
2.3 KiB
C

/* Shared app types and cross-module hooks. */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
typedef enum {
FACE_BOOT, /* connecting — idle glyphs + status tag */
FACE_IDLE, /* clock, rare drips */
FACE_LISTENING, /* mic hot */
FACE_PENSIVE, /* transcribing / short waits */
FACE_EFFORT, /* Tatlock working: max rain + orbit + elapsed */
FACE_SPEAKING, /* mouth sync */
FACE_RAGE, /* request failed: table flip, auto-returns to idle */
FACE_ERROR, /* gateway unreachable */
} face_state_t;
/* face.c */
void face_init(void);
void face_set(face_state_t state); /* safe from any task */
face_state_t face_get(void);
void face_activity(void);
void face_status(const char *text); /* bottom status line (diag/boot) */ /* reset the power ladder to active */
void face_screenshot_dump(bool overlay); /* dev: raw RGB565 screen dump over USB */
void face_volume_command(const char *action, int level); /* apply a gateway volume command */
/* audio.c */
void audio_init(void);
void audio_play_gong(void);
void audio_play_chime(void); /* short wake acknowledgement */
void audio_capture_start(void); /* begin streaming the utterance upstream */
void audio_capture_stop(void);
bool audio_capture_active(void);
void audio_playback_begin(void);
void audio_playback_feed(const uint8_t *data, size_t len);
void audio_playback_end(void);
bool audio_is_playing(void);
#define AUDIO_VOL_MAX 11 /* volume level range 0..11 (goes to eleven) */
void audio_level_set(int level); /* 0..AUDIO_VOL_MAX; also unmutes */
int audio_level_get(void);
void audio_mute(bool on); /* gate output; keeps the set level */
bool audio_is_muted(void);
/* net.c */
void net_start(void);
/* gw_client.c */
void gw_start(void);
bool gw_connected(void);
void gw_send_text(const char *json);
void gw_send_bin(const uint8_t *data, size_t len);
/* wifi_diag.c */
void wifi_diag_start(void);
/* c6_ota.c */
void c6_ota_start(void);
/* desklock_main.c */
void app_on_touch(void);
void app_on_wake(void); /* wake word detected (from audio detect_task) */
void app_on_speech_end(void); /* AFE VAD detected end of utterance */
void app_on_disconnect(void);
void app_on_playback_done(void);