From 325836042781ca26bdc2eb24d23d480bbf948081 Mon Sep 17 00:00:00 2001 From: Handle Date: Sat, 10 Aug 2019 02:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20SimPad=20v2=20=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=81=AF=E5=85=89=E9=80=9F=E5=BA=A6=E8=B0=83=E6=95=B4=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/devices/simpadv2/page3.html | 39 +++++++++++++++++++++++++++ app/devices/simpadv2/script.js | 48 ++++++++++++++++++++++++++++++--- app/script.js | 2 +- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/app/devices/simpadv2/page3.html b/app/devices/simpadv2/page3.html index a13aef4..5f8a2ac 100644 --- a/app/devices/simpadv2/page3.html +++ b/app/devices/simpadv2/page3.html @@ -286,6 +286,45 @@

changeLights

>

+
+

+ lightsDelay +

+

+ + + + +

+

+ + + + +

+

new Array(8)) @@ -109,6 +109,7 @@ const getAllSettings = (dev = device) => { .then(() => getSettings(8, dev)) .then(() => getSettings(9, dev)) .then(() => getSettings(10, dev)) + .then(() => getSettings(11, dev)) // 灯光速度 .then( () => new Promise(r => { @@ -271,6 +272,28 @@ const initSettings = () => { radio.checked = true } }) + + // 灯光速度 + const DEFAULT_LIGHT_DELAY = 0x0a00 + const easeLightDelayInput = document.getElementById('easeLightDelayInput') + easeLightDelayInput.value = (settingsSet[11][0] << 8) | settingsSet[11][1] + if ( + easeLightDelayInput.value === 0x10000 || + easeLightDelayInput.value < 0x0a + ) { + easeLightDelayInput.value = DEFAULT_LIGHT_DELAY + } + const rainbowLightDelayInput = document.getElementById( + 'rainbowLightDelayInput' + ) + rainbowLightDelayInput.value = (settingsSet[11][2] << 8) | settingsSet[11][3] + if ( + rainbowLightDelayInput.value === 0x10000 || + rainbowLightDelayInput.value < 0x0a + ) { + rainbowLightDelayInput.value = DEFAULT_LIGHT_DELAY + } + countChanges() } @@ -422,6 +445,24 @@ const initSettingsFunction = () => { countChanges() }) }) + + // 灯光速度 + const easeLightDelayInput = document.getElementById('easeLightDelayInput') + easeLightDelayInput.addEventListener('change', e => { + const trueValue = easeLightDelayInput.value + settingChanged[11][0] = (trueValue & 0xff00) >> 8 + settingChanged[11][1] = trueValue & 0x00ff + countChanges() + }) + const rainbowLightDelayInput = document.getElementById( + 'rainbowLightDelayInput' + ) + rainbowLightDelayInput.addEventListener('change', e => { + const trueValue = rainbowLightDelayInput.value + settingChanged[11][2] = (trueValue & 0xff00) >> 8 + settingChanged[11][3] = trueValue & 0x00ff + countChanges() + }) } // 默认数据 @@ -433,9 +474,10 @@ const templeData = [ [0x05, 0x00, 0x3b, 0x00, 0x00], //F3 [0x06, 0x00, 0xff, 0x00, 0x04], //#00FF00 100%(4) [0x07, 0x00, 0x00, 0xff, 0x04], //#0000FF 100%(4) - [0x08, 0x00, 0x00, 0x00, 0x00], //Mode 0 + [0x08, 0x06, 0x00, 0x00, 0x00], //Mode 6 彩虹 [0x09, 0x00, 0x00, 0x00, 0x60], //0x60 => 96 (MAX 16^6-1) - [0x0a, 0x00, 0x00, 0x00, 0x40] //0x00 极速模式处于关闭 + [0x0a, 0x00, 0x00, 0x00, 0x40], //0x00 极速模式处于关闭,夜灯打开 + [0x0b, 0x05, 0x00, 0x0a, 0x00] //0x0A00 延迟设置 ] templeData.forEach(arr => { arr[5] = arr[1] ^ arr[2] ^ arr[3] ^ arr[4] diff --git a/app/script.js b/app/script.js index ffb00af..d53e1f7 100644 --- a/app/script.js +++ b/app/script.js @@ -6,7 +6,7 @@ var app = require('electron').app const path = require('path') var AdmZip = require('adm-zip') -const APP_VERSION = 'v0.159' +const APP_VERSION = 'v0.160' var clearAllTimeout = () => { for (var i = setTimeout(() => {}, 0); i; i--) {