Add "Use microphone control" option to developer settings
This commit is contained in:
1 parent
8a86cf28e1
commit
e98f19d7e4
4 files changed
+28
-4
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { getStringSetting, setStringSetting } from "../../native/settings-store";
|
||||
import { useMicControlSetting } from "../../ui/dashboard-settings";
|
||||
import { toJavaBytes } from "../../native/cloud-stt";
|
||||
import { toUint8Array } from "../../util/array-util";
|
||||
import {
|
||||
@@ -38,7 +39,7 @@ function activeCommunicator(): any {
|
||||
}
|
||||
|
||||
/** True when the connected glasses advertise the CFW mic_control feature. */
|
||||
export function micControlSupported(): boolean {
|
||||
export function micControlAdvertised(): boolean {
|
||||
const communicator = activeCommunicator();
|
||||
if (!communicator) return false;
|
||||
try {
|
||||
@@ -49,6 +50,16 @@ export function micControlSupported(): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the connected glasses advertise the CFW mic_control feature AND
|
||||
* the "Use microphone control" developer setting is on. With the setting off
|
||||
* (the default), Faceclaw behaves exactly as it would on firmware without the
|
||||
* micctl caps token.
|
||||
*/
|
||||
export function micControlSupported(): boolean {
|
||||
return useMicControlSetting.get() && micControlAdvertised();
|
||||
}
|
||||
|
||||
export function loadMicConfig(): MicConfig {
|
||||
const raw = getStringSetting(CONFIG_SETTING_KEY, "");
|
||||
if (!raw) return defaultMicConfig();
|
||||
|
||||
@@ -23,7 +23,7 @@ import { isAsrModelReady, startAsrModelDownload, asrModelState } from "../../nat
|
||||
import { CaptionsLayer } from "./captions-layer";
|
||||
import { LevelsLayer } from "./levels-layer";
|
||||
import { RadarLayer } from "./radar-layer";
|
||||
import { loadMicConfig, micArrayController, micControlSupported, saveMicConfig } from "./mic-control";
|
||||
import { loadMicConfig, micArrayController, micControlAdvertised, micControlSupported, saveMicConfig } from "./mic-control";
|
||||
import { isMicModelReady, micModelState, startMicModelDownload } from "./mic-models";
|
||||
import { micChannelLabel, type MicChannelKey, type MicConfig } from "./mic-protocol";
|
||||
import { micSession } from "./mic-session";
|
||||
@@ -166,7 +166,7 @@ function micSetupMenu(): MenuLayer {
|
||||
{
|
||||
label: "Array status",
|
||||
description:
|
||||
"Per-temple mic-control status. Requires the mic-control custom firmware (caps token micctl).",
|
||||
"Per-temple mic-control status. Requires the mic-control custom firmware (caps token micctl) and the Use microphone control developer setting.",
|
||||
onSelect: (ctx) => {
|
||||
micArrayController.query();
|
||||
const { left, right } = micArrayController.getStatuses();
|
||||
@@ -186,7 +186,9 @@ function micSetupMenu(): MenuLayer {
|
||||
"Array status",
|
||||
micControlSupported()
|
||||
? `${describe("Left", left)}\n${describe("Right", right)}\n${consistency}`
|
||||
: "The connected firmware does not advertise mic-control. Flash the microphone-configurations CFW build to control the four mics individually; on stock firmware the glasses stream one mixed channel with a firmware-computed direction of arrival.",
|
||||
: micControlAdvertised()
|
||||
? "Mic-control is available but disabled. Turn on Settings > Developer > Use microphone control to control the four mics individually."
|
||||
: "The connected firmware does not advertise mic-control. Flash the microphone-configurations CFW build to control the four mics individually; on stock firmware the glasses stream one mixed channel with a firmware-computed direction of arrival.",
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -390,6 +390,15 @@ export const suspendEvenHubWhenScreenOffSetting = new ConfigSettingBoolean({
|
||||
description: "Suspend the EvenHub session while the display is off. This significantly improves battery life, but increases the latency of waking the screen.",
|
||||
});
|
||||
|
||||
export const useMicControlSetting = new ConfigSettingBoolean({
|
||||
id: "use-mic-control",
|
||||
label: "Use microphone control",
|
||||
storageKey: "developer.useMicControl",
|
||||
defaultValue: true,
|
||||
description:
|
||||
"Use the custom firmware's per-temple mic-control channel (caps token micctl) for the Microphones app's array capture. When off, behave as if the firmware doesn't have the feature and use the standard single mixed stream.",
|
||||
});
|
||||
|
||||
export type RingConnectionMode = "glasses" | "direct";
|
||||
|
||||
export const ringConnectionModeSetting = new ConfigSettingEnum<RingConnectionMode>({
|
||||
|
||||
@@ -54,6 +54,7 @@ import {
|
||||
textSettingMenuItem,
|
||||
timeFormatSetting,
|
||||
toggleSettingMenuItem,
|
||||
useMicControlSetting,
|
||||
verticalPositionSetting,
|
||||
voiceProviderSetting,
|
||||
screenTimeoutSetting,
|
||||
@@ -174,6 +175,7 @@ function settingsSections(): SettingsSection[] {
|
||||
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||
toggleSettingMenuItem(firmwareDebugFlagsSetting),
|
||||
toggleSettingMenuItem(suspendEvenHubWhenScreenOffSetting),
|
||||
toggleSettingMenuItem(useMicControlSetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user