diff --git a/Software/Tataconfig/Screenshot.png b/Software/Tataconfig/Screenshot.png index 4f59acf..39b1561 100644 Binary files a/Software/Tataconfig/Screenshot.png and b/Software/Tataconfig/Screenshot.png differ diff --git a/Software/Tataconfig/icon128.png b/Software/Tataconfig/icon128.png index 171d0e1..42dc7c8 100644 Binary files a/Software/Tataconfig/icon128.png and b/Software/Tataconfig/icon128.png differ diff --git a/Software/Tataconfig/icon16.png b/Software/Tataconfig/icon16.png index 7becf84..70af99f 100644 Binary files a/Software/Tataconfig/icon16.png and b/Software/Tataconfig/icon16.png differ diff --git a/Software/Tataconfig/icon48.png b/Software/Tataconfig/icon48.png index a110cf8..53d7aef 100644 Binary files a/Software/Tataconfig/icon48.png and b/Software/Tataconfig/icon48.png differ diff --git a/Software/Tataconfig/main.js b/Software/Tataconfig/main.js index 8df4e0d..0136b7b 100644 --- a/Software/Tataconfig/main.js +++ b/Software/Tataconfig/main.js @@ -1,8 +1,8 @@ chrome.app.runtime.onLaunched.addListener(function() { chrome.app.window.create('window.html', { 'innerBounds': { - 'width': 466, - 'height': 580 + 'width': 480, + 'height': 662 } }); }); \ No newline at end of file diff --git a/Software/Tataconfig/manifest.json b/Software/Tataconfig/manifest.json index c47cf35..3d982d3 100644 --- a/Software/Tataconfig/manifest.json +++ b/Software/Tataconfig/manifest.json @@ -1,7 +1,7 @@ { "name": "TaTaConfig", "description": "TaTaCon to USB Configurator", - "version": "0.1", + "version": "0.2", "manifest_version": 2, "minimum_chrome_version": "38", "app": { diff --git a/Software/Tataconfig/style.css b/Software/Tataconfig/style.css index da596a6..ff19f4a 100644 --- a/Software/Tataconfig/style.css +++ b/Software/Tataconfig/style.css @@ -53,7 +53,7 @@ body, html { .tatacon { position: relative; width: 450px; - height: 450px; + height: 532px; background-image: url("tatacon.png"); } @@ -63,7 +63,7 @@ body, html { } .donL, .donR { - top: 210px; + top: 130px; } .katL, .katR { top: 50px; @@ -75,10 +75,10 @@ body, html { right: 70px; } .katL { - left: 50px; + left: 40px; } .katR { - right: 50px; + right: 40px; } .title { diff --git a/Software/Tataconfig/tatacon.png b/Software/Tataconfig/tatacon.png index 338b903..9bca23e 100644 Binary files a/Software/Tataconfig/tatacon.png and b/Software/Tataconfig/tatacon.png differ diff --git a/Software/Tataconfig/tataconfig.js b/Software/Tataconfig/tataconfig.js index 6f1e4a7..0bf1784 100644 --- a/Software/Tataconfig/tataconfig.js +++ b/Software/Tataconfig/tataconfig.js @@ -1,6 +1,5 @@ (function() { var devices = []; - var waitingMessage = "Waiting for a device, plug one in!"; var debounceOptions = [["Off", 0], ["Low", 15], ["Medium", 30], ["High", 50]]; var configBytes = { donL : 0, @@ -13,6 +12,8 @@ reset : 7 }; + var magicResetNumber = 42; + var newDevice = function(device) { if(device.vendorId == 0x16D0) { // Config mode console.log("Added new device with ID " + device.deviceId); @@ -33,7 +34,7 @@ } var createConfigUI = function(device) { - document.getElementById("waiting").textContent = ""; + document.getElementById("waiting").style.display = "none"; var ui = document.createElement("div"); device.ui = ui; @@ -145,9 +146,28 @@ updateUI(device); } + var firmwareUpdate = document.createElement("button"); + device.firmwareUpdate = firmwareUpdate; + firmwareUpdate.type = "button"; + firmwareUpdate.textContent = "Firmware update"; + // Becomes enabled once config is unchanged + firmwareUpdate.disabled = false; + firmwareUpdate.onclick = function() { + console.log("Rebooting for firmware update"); + device.config[configBytes.reset] = magicResetNumber; + chrome.hid.send(device.connId, 0, device.config.buffer, function() { + console.log("Reboot sent, bye bye!"); + // Ignore the failure to send + if(chrome.runtime.lastError) { + ; + } + }); + } + buttons.appendChild(apply); buttons.appendChild(resetConfig); buttons.appendChild(resetDefaults); + buttons.appendChild(firmwareUpdate); config.appendChild(buttons); ui.appendChild(config); @@ -183,9 +203,11 @@ if(changed) { device.apply.disabled = false; device.resetConfig.disabled = false; + device.firmwareUpdate.disabled = true; } else { device.apply.disabled = true; device.resetConfig.disabled = true; + device.firmwareUpdate.disabled = false; } } @@ -200,7 +222,7 @@ } } if(devices.length == 0) { - document.getElementById("waiting").textContent = waitingMessage; + document.getElementById("waiting").style.display = "flex"; } if(removed) { document.getElementById("content").removeChild(removed.ui); @@ -208,7 +230,7 @@ } window.addEventListener('load', function() { - document.getElementById("waiting").textContent = waitingMessage; + document.getElementById("waiting").style.display = "flex"; chrome.hid.getDevices({}, function(devices) { if (chrome.runtime.lastError) { console.error("Unable to enumerate devices: " + diff --git a/Software/Tataconfig/window.html b/Software/Tataconfig/window.html index 9d36e7e..7ffec63 100644 --- a/Software/Tataconfig/window.html +++ b/Software/Tataconfig/window.html @@ -5,7 +5,7 @@ -
+
Waiting for a device, plug one in!
\ No newline at end of file