format
This commit is contained in:
parent
acef9ed154
commit
3a5edef9e9
6
app.js
6
app.js
@ -20,8 +20,7 @@ const mimeTypes = {
|
|||||||
".txt": "text/plain",
|
".txt": "text/plain",
|
||||||
};
|
};
|
||||||
|
|
||||||
http
|
http.createServer((req, res) => {
|
||||||
.createServer((req, res) => {
|
|
||||||
// Parse the URL and extract just the pathname, ignoring query parameters
|
// Parse the URL and extract just the pathname, ignoring query parameters
|
||||||
const parsedUrl = url.parse(req.url);
|
const parsedUrl = url.parse(req.url);
|
||||||
let filePath = "." + decodeURIComponent(parsedUrl.pathname);
|
let filePath = "." + decodeURIComponent(parsedUrl.pathname);
|
||||||
@ -39,7 +38,6 @@ http
|
|||||||
res.end(content);
|
res.end(content);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}).listen(port, host, () => {
|
||||||
.listen(port, host, () => {
|
|
||||||
console.log(`Server running at http://${host}:${port}/`);
|
console.log(`Server running at http://${host}:${port}/`);
|
||||||
});
|
});
|
||||||
|
883
index.html
883
index.html
File diff suppressed because it is too large
Load Diff
92
js/core.js
92
js/core.js
@ -36,7 +36,11 @@ var available_langs = {
|
|||||||
ko_kr: { name: "한국어", file: "ko_kr.json", direction: "ltr" },
|
ko_kr: { name: "한국어", file: "ko_kr.json", direction: "ltr" },
|
||||||
nl_nl: { name: "Nederlands", file: "nl_nl.json", direction: "ltr" },
|
nl_nl: { name: "Nederlands", file: "nl_nl.json", direction: "ltr" },
|
||||||
pl_pl: { name: "Polski", file: "pl_pl.json", direction: "ltr" },
|
pl_pl: { name: "Polski", file: "pl_pl.json", direction: "ltr" },
|
||||||
pt_br: { name: "Português do Brasil", file: "pt_br.json", direction: "ltr" },
|
pt_br: {
|
||||||
|
name: "Português do Brasil",
|
||||||
|
file: "pt_br.json",
|
||||||
|
direction: "ltr",
|
||||||
|
},
|
||||||
pt_pt: { name: "Português", file: "pt_pt.json", direction: "ltr" },
|
pt_pt: { name: "Português", file: "pt_pt.json", direction: "ltr" },
|
||||||
rs_rs: { name: "Srpski", file: "rs_rs.json", direction: "ltr" },
|
rs_rs: { name: "Srpski", file: "rs_rs.json", direction: "ltr" },
|
||||||
ru_ru: { name: "Русский", file: "ru_ru.json", direction: "ltr" },
|
ru_ru: { name: "Русский", file: "ru_ru.json", direction: "ltr" },
|
||||||
@ -423,10 +427,23 @@ async function ds4_calibrate_sticks() {
|
|||||||
) {
|
) {
|
||||||
d1 = dec2hex32(data.getUint32(0, false));
|
d1 = dec2hex32(data.getUint32(0, false));
|
||||||
d2 = dec2hex32(data2.getUint32(0, false));
|
d2 = dec2hex32(data2.getUint32(0, false));
|
||||||
la("ds4_calibrate_sticks_failed", { s: 2, i: i, d1: d1, d2: d2 });
|
la("ds4_calibrate_sticks_failed", {
|
||||||
|
s: 2,
|
||||||
|
i: i,
|
||||||
|
d1: d1,
|
||||||
|
d2: d2,
|
||||||
|
});
|
||||||
close_calibrate_window();
|
close_calibrate_window();
|
||||||
return show_popup(
|
return show_popup(
|
||||||
err + l("Error 2") + " (" + d1 + ", " + d2 + " at i=" + i + ")",
|
err +
|
||||||
|
l("Error 2") +
|
||||||
|
" (" +
|
||||||
|
d1 +
|
||||||
|
", " +
|
||||||
|
d2 +
|
||||||
|
" at i=" +
|
||||||
|
i +
|
||||||
|
")",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,13 +485,19 @@ async function ds4_nvstatus() {
|
|||||||
// 1: temporary, 0: permanent
|
// 1: temporary, 0: permanent
|
||||||
ret = data.getUint8(1, false);
|
ret = data.getUint8(1, false);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
$("#d-nvstatus").html("<font color='green'>" + l("locked") + "</font>");
|
$("#d-nvstatus").html(
|
||||||
|
"<font color='green'>" + l("locked") + "</font>",
|
||||||
|
);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ret == 0) {
|
} else if (ret == 0) {
|
||||||
$("#d-nvstatus").html("<font color='red'>" + l("unlocked") + "</font>");
|
$("#d-nvstatus").html(
|
||||||
|
"<font color='red'>" + l("unlocked") + "</font>",
|
||||||
|
);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
$("#d-nvstatus").html("<font color='purple'>unk " + ret + "</font>");
|
$("#d-nvstatus").html(
|
||||||
|
"<font color='purple'>unk " + ret + "</font>",
|
||||||
|
);
|
||||||
if (ret == 0 || ret == 1) return 2;
|
if (ret == 0 || ret == 1) return 2;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -494,10 +517,14 @@ async function ds5_nvstatus() {
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
if (ret == 0x03030201) {
|
if (ret == 0x03030201) {
|
||||||
$("#d-nvstatus").html("<font color='green'>" + l("locked") + "</font>");
|
$("#d-nvstatus").html(
|
||||||
|
"<font color='green'>" + l("locked") + "</font>",
|
||||||
|
);
|
||||||
return 1; // temporary
|
return 1; // temporary
|
||||||
} else if (ret == 0x03030200) {
|
} else if (ret == 0x03030200) {
|
||||||
$("#d-nvstatus").html("<font color='red'>" + l("unlocked") + "</font>");
|
$("#d-nvstatus").html(
|
||||||
|
"<font color='red'>" + l("unlocked") + "</font>",
|
||||||
|
);
|
||||||
return 0; // permanent
|
return 0; // permanent
|
||||||
} else {
|
} else {
|
||||||
$("#d-nvstatus").html(
|
$("#d-nvstatus").html(
|
||||||
@ -565,7 +592,9 @@ async function ds5_system_info(base, num, length, decode = true) {
|
|||||||
return l("error");
|
return l("error");
|
||||||
} else {
|
} else {
|
||||||
if (decode)
|
if (decode)
|
||||||
return new TextDecoder().decode(pcba_id.buffer.slice(4, 4 + length));
|
return new TextDecoder().decode(
|
||||||
|
pcba_id.buffer.slice(4, 4 + length),
|
||||||
|
);
|
||||||
else return buf2hex(pcba_id.buffer.slice(4, 4 + length));
|
else return buf2hex(pcba_id.buffer.slice(4, 4 + length));
|
||||||
}
|
}
|
||||||
return l("Unknown");
|
return l("Unknown");
|
||||||
@ -586,7 +615,9 @@ async function ds5_info() {
|
|||||||
var hwinfo = view.getUint32(24, true);
|
var hwinfo = view.getUint32(24, true);
|
||||||
var fwversion = view.getUint32(28, true);
|
var fwversion = view.getUint32(28, true);
|
||||||
|
|
||||||
var deviceinfo = new TextDecoder().decode(view.buffer.slice(32, 32 + 12));
|
var deviceinfo = new TextDecoder().decode(
|
||||||
|
view.buffer.slice(32, 32 + 12),
|
||||||
|
);
|
||||||
var updversion = view.getUint16(44, true);
|
var updversion = view.getUint16(44, true);
|
||||||
var unk = view.getUint8(46, true);
|
var unk = view.getUint8(46, true);
|
||||||
|
|
||||||
@ -631,7 +662,11 @@ async function ds5_info() {
|
|||||||
append_info(l("FW Version"), "0x" + dec2hex32(fwversion), "fw");
|
append_info(l("FW Version"), "0x" + dec2hex32(fwversion), "fw");
|
||||||
append_info(l("FW Update"), "0x" + dec2hex(updversion), "fw");
|
append_info(l("FW Update"), "0x" + dec2hex(updversion), "fw");
|
||||||
append_info_extra(l("FW Update Info"), "0x" + dec2hex8(unk), "fw");
|
append_info_extra(l("FW Update Info"), "0x" + dec2hex8(unk), "fw");
|
||||||
append_info_extra(l("SBL FW Version"), "0x" + dec2hex32(fwversion1), "fw");
|
append_info_extra(
|
||||||
|
l("SBL FW Version"),
|
||||||
|
"0x" + dec2hex32(fwversion1),
|
||||||
|
"fw",
|
||||||
|
);
|
||||||
append_info_extra(
|
append_info_extra(
|
||||||
l("Venom FW Version"),
|
l("Venom FW Version"),
|
||||||
"0x" + dec2hex32(fwversion2),
|
"0x" + dec2hex32(fwversion2),
|
||||||
@ -947,12 +982,18 @@ async function ds5_edge_flash_modules() {
|
|||||||
modal.show();
|
modal.show();
|
||||||
|
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 6, 0, 11]));
|
await device.sendFeatureReport(
|
||||||
|
0x80,
|
||||||
|
alloc_req(0x80, [21, 6, 0, 11]),
|
||||||
|
);
|
||||||
await new Promise((r) => setTimeout(r, 200));
|
await new Promise((r) => setTimeout(r, 200));
|
||||||
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 0]));
|
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 0]));
|
||||||
await new Promise((r) => setTimeout(r, 200));
|
await new Promise((r) => setTimeout(r, 200));
|
||||||
|
|
||||||
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 6, 1, 11]));
|
await device.sendFeatureReport(
|
||||||
|
0x80,
|
||||||
|
alloc_req(0x80, [21, 6, 1, 11]),
|
||||||
|
);
|
||||||
await new Promise((r) => setTimeout(r, 200));
|
await new Promise((r) => setTimeout(r, 200));
|
||||||
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 1]));
|
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 1]));
|
||||||
await new Promise((r) => setTimeout(r, 200));
|
await new Promise((r) => setTimeout(r, 200));
|
||||||
@ -1142,7 +1183,10 @@ async function ds5_finetune() {
|
|||||||
data = await read_finetune_data();
|
data = await read_finetune_data();
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
curModal = new bootstrap.Modal(document.getElementById("finetuneModal"), {});
|
curModal = new bootstrap.Modal(
|
||||||
|
document.getElementById("finetuneModal"),
|
||||||
|
{},
|
||||||
|
);
|
||||||
curModal.show();
|
curModal.show();
|
||||||
|
|
||||||
list = [
|
list = [
|
||||||
@ -1335,10 +1379,13 @@ function refresh_stick_pos() {
|
|||||||
|
|
||||||
function cc_to_color(cc) {
|
function cc_to_color(cc) {
|
||||||
var dd = Math.sqrt(Math.pow(1.0 - cc, 2));
|
var dd = Math.sqrt(Math.pow(1.0 - cc, 2));
|
||||||
if (cc <= 1.0) hh = 220 - 220 * Math.min(1.0, Math.max(0, dd - 0.05) / 0.1);
|
if (cc <= 1.0)
|
||||||
|
hh = 220 - 220 * Math.min(1.0, Math.max(0, dd - 0.05) / 0.1);
|
||||||
else
|
else
|
||||||
hh =
|
hh =
|
||||||
(245 + (360 - 245) * Math.min(1.0, Math.max(0, dd - 0.05) / 0.15)) %
|
(245 +
|
||||||
|
(360 - 245) *
|
||||||
|
Math.min(1.0, Math.max(0, dd - 0.05) / 0.15)) %
|
||||||
360;
|
360;
|
||||||
return hh;
|
return hh;
|
||||||
}
|
}
|
||||||
@ -1430,7 +1477,9 @@ function refresh_stick_pos() {
|
|||||||
if (enable_circ_test) {
|
if (enable_circ_test) {
|
||||||
var pld = Math.sqrt(plx * plx + ply * ply);
|
var pld = Math.sqrt(plx * plx + ply * ply);
|
||||||
var pla =
|
var pla =
|
||||||
(parseInt(Math.round((Math.atan2(ply, plx) * MAX_N) / 2.0 / Math.PI)) +
|
(parseInt(
|
||||||
|
Math.round((Math.atan2(ply, plx) * MAX_N) / 2.0 / Math.PI),
|
||||||
|
) +
|
||||||
MAX_N) %
|
MAX_N) %
|
||||||
MAX_N;
|
MAX_N;
|
||||||
var old = ll_data[pla];
|
var old = ll_data[pla];
|
||||||
@ -1439,7 +1488,9 @@ function refresh_stick_pos() {
|
|||||||
|
|
||||||
var prd = Math.sqrt(prx * prx + pry * pry);
|
var prd = Math.sqrt(prx * prx + pry * pry);
|
||||||
var pra =
|
var pra =
|
||||||
(parseInt(Math.round((Math.atan2(pry, prx) * MAX_N) / 2.0 / Math.PI)) +
|
(parseInt(
|
||||||
|
Math.round((Math.atan2(pry, prx) * MAX_N) / 2.0 / Math.PI),
|
||||||
|
) +
|
||||||
MAX_N) %
|
MAX_N) %
|
||||||
MAX_N;
|
MAX_N;
|
||||||
var old = rr_data[pra];
|
var old = rr_data[pra];
|
||||||
@ -1996,7 +2047,10 @@ async function multi_calibrate_sticks() {
|
|||||||
if (mode == 0) return;
|
if (mode == 0) return;
|
||||||
|
|
||||||
set_progress(0);
|
set_progress(0);
|
||||||
curModal = new bootstrap.Modal(document.getElementById("calibrateModal"), {});
|
curModal = new bootstrap.Modal(
|
||||||
|
document.getElementById("calibrateModal"),
|
||||||
|
{},
|
||||||
|
);
|
||||||
curModal.show();
|
curModal.show();
|
||||||
|
|
||||||
await new Promise((r) => setTimeout(r, 1000));
|
await new Promise((r) => setTimeout(r, 1000));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user