From 53fd91fdb3fe94f84de00318095b67f61a43d718 Mon Sep 17 00:00:00 2001 From: Mathias Malmqvist Date: Tue, 23 Sep 2025 23:01:19 +0200 Subject: [PATCH] Move the Quick Test button --- index.html | 14 ++++++++------ js/controllers/ds5-controller.js | 6 +++--- js/modals/quick-test-modal.js | 24 +++++++++++++++++------- templates/quick-test-modal.html | 8 ++++---- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index c12376c..8a7c021 100644 --- a/index.html +++ b/index.html @@ -137,11 +137,17 @@
-
+
+ +
+ +
-
@@ -150,10 +156,6 @@ -
diff --git a/js/controllers/ds5-controller.js b/js/controllers/ds5-controller.js index e2f1817..739f66c 100644 --- a/js/controllers/ds5-controller.js +++ b/js/controllers/ds5-controller.js @@ -314,8 +314,8 @@ class DS5Controller extends BaseController { { key: l("FW Type"), value: "0x" + dec2hex(fwtype), cat: "fw", isExtra: true }, { key: l("FW Series"), value: "0x" + dec2hex(swseries), cat: "fw", isExtra: true }, { key: l("HW Model"), value: "0x" + dec2hex32(hwinfo), cat: "hw", isExtra: true }, - { key: l("FW Version"), value: "0x" + dec2hex32(fwversion), cat: "fw" }, - { key: l("FW Update"), value: "0x" + dec2hex(updversion), cat: "fw" }, + { key: l("FW Version"), value: "0x" + dec2hex32(fwversion), cat: "fw", isExtra: true }, + { key: l("FW Update"), value: "0x" + dec2hex(updversion), cat: "fw", isExtra: true }, { key: l("FW Update Info"), value: "0x" + dec2hex8(unk), cat: "fw", isExtra: true }, { key: l("SBL FW Version"), value: "0x" + dec2hex32(fwversion1), cat: "fw", isExtra: true }, { key: l("Venom FW Version"), value: "0x" + dec2hex32(fwversion2), cat: "fw", isExtra: true }, @@ -334,7 +334,7 @@ class DS5Controller extends BaseController { const nv = await this.queryNvStatus(); const bd_addr = await this.getBdAddr(); - infoItems.push({ key: l("Bluetooth Address"), value: bd_addr, cat: "hw" }); + infoItems.push({ key: l("Bluetooth Address"), value: bd_addr, cat: "hw", isExtra: true }); const pending_reboot = (nv?.status === 'pending_reboot'); diff --git a/js/modals/quick-test-modal.js b/js/modals/quick-test-modal.js index a375e36..24e597d 100644 --- a/js/modals/quick-test-modal.js +++ b/js/modals/quick-test-modal.js @@ -101,13 +101,13 @@ export class QuickTestModal { const allTestsCompleted = this._areAllTestsCompleted(); if (activeTest === 'buttons') { - $instructionsText.html(this.l('Test all buttons, or long-press Square to Pass and Cross to Fail')); + $instructionsText.html(this.l('Test all buttons, or long-press Square to Pass and Cross to Fail, or Circle to skip.')); } else if (activeTest) { - $instructionsText.html(this.l('Press Square to Pass or Cross to Fail')); + $instructionsText.html(this.l('Press Square to Pass, Cross to Fail, or Circle to skip.')); } else if (allTestsCompleted) { $instructionsText.html(this.l('Press Circle to close, or Square to start over')); } else { - $instructionsText.html(this.l('Press Square to begin')); + $instructionsText.html(this.l('Press Square to begin or Circle to close')); } } @@ -688,7 +688,15 @@ export class QuickTestModal { } else if (changes.triangle === true) { handleButtonPress(() => this._moveToPreviousTest()); } else if (changes.circle === true) { - handleButtonPress(() => bootstrap.Modal.getOrCreateInstance('#quickTestModal').hide()); + handleButtonPress(() => { + if (activeTest) { + // Skip the current test by expanding the next one + this._expandNextTest(activeTest); + } else { + // Close the modal if no test is active + bootstrap.Modal.getOrCreateInstance('#quickTestModal').hide(); + } + }); } } @@ -707,7 +715,7 @@ export class QuickTestModal { */ _trackButtonPresses(changes) { BUTTONS.forEach(button => { - const handleLongpress = ['cross', 'square', 'triangle'].includes(button); + const handleLongpress = ['cross', 'square', 'triangle', 'circle'].includes(button); if (changes[button] === true) { // Button pressed - increment count and show dark blue infill this.state.buttonPressCount[button]++; @@ -796,6 +804,8 @@ export class QuickTestModal { this.markTestResult('buttons', false); } else if (button === 'triangle') { this._moveToPreviousTest(); + } else if (button === 'circle') { + this._expandNextTest(activeTest); } } @@ -913,8 +923,8 @@ function destroyCurrentInstance() { export function updateQuickTestButtonVisibility(controller) { const $button = $('#quick-test-btn'); const model = controller?.getModel(); - const supported = (controller?.isConnected() && (model === "DS5" || model === "DS5_Edge")); - $button.css('display', supported ? 'block' : 'none'); + const supported = (controller?.isConnected() && (model === "DS5" /* || model === "DS5_Edge" */)); + $button.toggleClass('disabled', !supported); } /** diff --git a/templates/quick-test-modal.html b/templates/quick-test-modal.html index 2c4d2b1..47677d2 100644 --- a/templates/quick-test-modal.html +++ b/templates/quick-test-modal.html @@ -7,7 +7,7 @@