forked from Blendman974/faceclaw
Fix some microphone-related bugs, add a debug panel
This commit is contained in:
1 parent
e8d2f5ade9
commit
7d0becfaa7
8 files changed
+650
-37
No files matched your search
@@ -6,6 +6,7 @@ import { BuzzerDemoLayer } from "./buzzer-demo";
|
||||
import { AccelerometerDemoLayer } from "./accelerometer-demo";
|
||||
import { BandwidthBenchmarkLayer } from "./bandwidth-benchmark";
|
||||
import { LightSensorDemoLayer } from "./light-sensor-demo";
|
||||
import { MicrophonesMonitorLayer } from "./microphones-monitor";
|
||||
import { ResourceUsageLayer } from "./resource-usage";
|
||||
import { LoadAppFromQrLayer, LoadAppFromUrlLayer } from "./load-app";
|
||||
import { unicodeTestMenu } from "./unicode-test";
|
||||
@@ -49,8 +50,10 @@ function submenuItem(label: string, onSelect: MenuItem["onSelect"]): MenuItem {
|
||||
};
|
||||
}
|
||||
|
||||
type OpenPage = (ctx: Parameters<MenuItem["onSelect"]>[0]) => void;
|
||||
|
||||
/** The diagnostic demos, one level down from the root menu. */
|
||||
function debugTestsMenu(openInputEvents: (ctx: Parameters<MenuItem["onSelect"]>[0]) => void): MenuLayer {
|
||||
function debugTestsMenu(openInputEvents: OpenPage, openMicrophones: OpenPage): MenuLayer {
|
||||
return new MenuLayer(
|
||||
"Debug tests",
|
||||
[
|
||||
@@ -85,6 +88,12 @@ function debugTestsMenu(openInputEvents: (ctx: Parameters<MenuItem["onSelect"]>[
|
||||
ctx.stack.push(new LightSensorDemoLayer(DEVELOPER_WINDOW_ID, ctx.actions.requestRender));
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Microphones",
|
||||
disabled: global.isIOS,
|
||||
description: global.isIOS ? "Not available on iOS yet." : undefined,
|
||||
onSelect: openMicrophones,
|
||||
},
|
||||
{
|
||||
label: "BLE bandwidth",
|
||||
onSelect: (ctx) => {
|
||||
@@ -107,6 +116,7 @@ function debugTestsMenu(openInputEvents: (ctx: Parameters<MenuItem["onSelect"]>[
|
||||
*/
|
||||
export function createDeveloperAppWindow(appContext: AppContext, options: InProcessAppOptions): InProcessWindow {
|
||||
let inputEvents: InputEventsLayer | null = null;
|
||||
let microphones: MicrophonesMonitorLayer | null = null;
|
||||
const menu = new MenuLayer(
|
||||
"Developer",
|
||||
[
|
||||
@@ -141,6 +151,11 @@ export function createDeveloperAppWindow(appContext: AppContext, options: InProc
|
||||
() => { if (inputEvents === page) inputEvents = null; });
|
||||
inputEvents = page;
|
||||
inputCtx.stack.push(page);
|
||||
}, (micCtx) => {
|
||||
const page = new MicrophonesMonitorLayer(DEVELOPER_WINDOW_ID, micCtx.actions.requestRender,
|
||||
() => { if (microphones === page) microphones = null; });
|
||||
microphones = page;
|
||||
micCtx.stack.push(page);
|
||||
}));
|
||||
}),
|
||||
],
|
||||
@@ -155,7 +170,7 @@ export function createDeveloperAppWindow(appContext: AppContext, options: InProc
|
||||
icon: "wrench",
|
||||
closeable: true,
|
||||
actions: options.actions,
|
||||
menuItems: () => inputEvents?.menuItems() ?? [],
|
||||
menuItems: () => inputEvents?.menuItems() ?? microphones?.menuItems() ?? [],
|
||||
// Dictating a URL is the one thing worth speaking at in this app; the
|
||||
// load pages take the text and every other page ignores it.
|
||||
receiveTextInput: (text) => {
|
||||
|
||||
Reference in new issue
Block a user