forked from Blendman974/faceclaw
Add a wake-lock when the G2 screen is on
This commit is contained in:
1 parent
6632ada3c3
commit
116e8891e7
4 files changed
+45
No files matched your search
@@ -13,6 +13,7 @@ import { voiceControlBridge } from "../native/voice-control";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
|
||||
import {
|
||||
applyDashboardScreenTimeout,
|
||||
dashboardState,
|
||||
drawDashboard,
|
||||
noteDashboardPhoneTextInput,
|
||||
openAndroidNotificationFromSleep,
|
||||
@@ -561,9 +562,15 @@ class DashboardController {
|
||||
this.updateDisplayPreviewFromImage(image);
|
||||
}
|
||||
if (this.communicator) {
|
||||
if (dashboardState.screenOn) {
|
||||
await this.communicator.setG2ScreenOn(true);
|
||||
}
|
||||
console.log("submitDashboardImage");
|
||||
await this.communicator.submitDashboardImage(image.to8bppBuffer(), image.width, image.height, fingerprint, paintMs);
|
||||
await this.communicator.waitForNextFrameMetrics(FRAME_TRANSMIT_BACKPRESSURE_TIMEOUT_MS);
|
||||
if (!dashboardState.screenOn) {
|
||||
await this.communicator.setG2ScreenOn(false);
|
||||
}
|
||||
if (updatePreviewAfterTransmit) {
|
||||
await this.updateConnectedDisplayPreviewFromImage(image);
|
||||
}
|
||||
|
||||
@@ -225,6 +225,10 @@ export class FaceclawCommunicatorBridge {
|
||||
await this.enqueueJavaCall(() => this.communicator.start());
|
||||
}
|
||||
|
||||
async setG2ScreenOn(screenOn: boolean): Promise<void> {
|
||||
await this.enqueueJavaCall(() => this.communicator.setG2ScreenOn(Boolean(screenOn)));
|
||||
}
|
||||
|
||||
async submitDashboardImage(image8bpp: Uint8Array, width: number, height: number, fingerprint: string, paintMs = -1): Promise<void> {
|
||||
const snapshot = new Uint8Array(image8bpp);
|
||||
await this.enqueueJavaCall(() => {
|
||||
|
||||
Reference in new issue
Block a user