From 5ae472358e961f58c6175f1e9a6095aac19301a1 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 23 Jul 2025 20:08:18 +0100 Subject: [PATCH] promenu: workaround 2v2[67] bug - use separate touch handler See: - 8b2e5a5 - https://github.com/orgs/espruino/discussions/7697#discussioncomment-13782299 - https://github.com/espruino/Espruino/issues/2648#issuecomment-3095831472 --- apps/promenu/bootb2.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/promenu/bootb2.ts b/apps/promenu/bootb2.ts index 196db3404..46fe112fc 100644 --- a/apps/promenu/bootb2.ts +++ b/apps/promenu/bootb2.ts @@ -270,12 +270,26 @@ E.showMenu = ((items?: Menu): MenuInstance | void => { remove: () => { if (nameScroller) clearInterval(nameScroller); Bangle.removeListener("swipe", onSwipe); + if(is2v26_27) + Bangle.removeListener("touch", touchcb); options.remove?.(); }, - touch: touchcb, - } as SetUIArg<"updown">; + } satisfies SetUIArg<"updown">; + + const is2v26_27 = process.env.VERSION === "2v26" || process.env.VERSION === "2v27"; + if (!is2v26_27) { + // no need for workaround + (uiopts as any).touch = touchcb; + } Bangle.setUI(uiopts, cb); + if(is2v26_27){ + // work around: + // - https://github.com/espruino/Espruino/issues/2648 + // - https://github.com/orgs/espruino/discussions/7697#discussioncomment-13782299 + Bangle.on("touch", touchcb); + } + return l; }) as typeof E.showMenu;