Update app assets and add button to reset to firmware
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 17 KiB |
|
|
@ -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
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 97 KiB |
|
|
@ -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: " +
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<script type="text/javascript" src="tataconfig.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="waiting"></div>
|
||||
<div id="waiting">Waiting for a device, plug one in!</div>
|
||||
<div id="content"></div>
|
||||
</body>
|
||||
</html>
|
||||