From 5773adfdbd45f0e27ceef1ac191965ef66a26b29 Mon Sep 17 00:00:00 2001 From: dualshock-tools Date: Thu, 25 Apr 2024 23:42:20 +0200 Subject: [PATCH] Improved error logging; Add eth address --- core.js | 61 +++++++++++++++++++++++++++++++++++++++++++++-------- donate.png | Bin 0 -> 449 bytes index.html | 25 +++++++++++++++++++--- 3 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 donate.png diff --git a/core.js b/core.js index 25218aa..8472d56 100644 --- a/core.js +++ b/core.js @@ -162,6 +162,7 @@ async function ds4_calibrate_range_begin(perm_ch) { if(perm_ch) { await ds4_nvunlock(); if(await ds4_nvstatus() != 0) { + la("ds4_calibrate_range_begin_failed", {"r": "nvunlock"}); close_calibrate_window(); return show_popup(err + l("Cannot unlock NVS")); } @@ -173,11 +174,15 @@ async function ds4_calibrate_range_begin(perm_ch) { // Assert data = await device.receiveFeatureReport(0x91) data2 = await device.receiveFeatureReport(0x92) - if(data.getUint32(0, false) != 0x91010201 || data2.getUint32(0, false) != 0x920102ff) { + d1 = data.getUint32(0, false); + d2 = data2.getUint32(0, false); + if(d1 != 0x91010201 || d2 != 0x920102ff) { + la("ds4_calibrate_range_begin_failed", {"d1": d1, "d2": d2}); close_calibrate_window(); return show_popup(err + l("Error 1")); } } catch(e) { + la("ds4_calibrate_range_begin_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); @@ -193,7 +198,10 @@ async function ds4_calibrate_range_end(perm_ch) { data = await device.receiveFeatureReport(0x91) data2 = await device.receiveFeatureReport(0x92) - if(data.getUint32(0, false) != 0x91010202 || data2.getUint32(0, false) != 0x92010201) { + d1 = data.getUint32(0, false); + d2 = data2.getUint32(0, false); + if(d1 != 0x91010202 || d2 != 0x92010201) { + la("ds4_calibrate_range_end_failed", {"d1": d1, "d2": d2}); close_calibrate_window(); return show_popup(err + l("Error 3")); } @@ -201,6 +209,7 @@ async function ds4_calibrate_range_end(perm_ch) { if(perm_ch) { await ds4_nvlock(); if(await ds4_nvstatus() != 1) { + la("ds4_calibrate_range_end_failed", {"r": "nvlock"}); close_calibrate_window(); return show_popup(err + l("Cannot relock NVS")); } @@ -209,6 +218,7 @@ async function ds4_calibrate_range_end(perm_ch) { close_calibrate_window(); show_popup(l("Range calibration completed")); } catch(e) { + la("ds4_calibrate_range_end_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); @@ -222,6 +232,7 @@ async function ds4_calibrate_sticks_begin(has_perm_changes) { if(has_perm_changes) { await ds4_nvunlock(); if(await ds4_nvstatus() != 0) { + la("ds4_calibrate_sticks_begin_failed", {"r": "nvunlock"}); show_popup(err + l("Cannot unlock NVS")); return false; } @@ -231,15 +242,19 @@ async function ds4_calibrate_sticks_begin(has_perm_changes) { await device.sendFeatureReport(0x90, alloc_req(0x90, [1,1,1])) // Assert - data = await device.receiveFeatureReport(0x91) - data2 = await device.receiveFeatureReport(0x92) - if(data.getUint32(0, false) != 0x91010101 || data2.getUint32(0, false) != 0x920101ff) { + data = await device.receiveFeatureReport(0x91); + data2 = await device.receiveFeatureReport(0x92); + d1 = data.getUint32(0, false); + d2 = data2.getUint32(0, false); + if(d1 != 0x91010101 || d2 != 0x920101ff) { + la("ds4_calibrate_sticks_begin_failed", {"d1": d1, "d2": d2}); show_popup(err + l("Error 1")); return false; } return true; } catch(e) { + la("ds4_calibrate_sticks_begin_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); show_popup(err + e); return false; @@ -260,6 +275,7 @@ async function ds4_calibrate_sticks_sample() { close_calibrate_window(); d1 = dec2hex32(data.getUint32(0, false)); d2 = dec2hex32(data2.getUint32(0, false)); + la("ds4_calibrate_sticks_sample_failed", {"d1": d1, "d2": d2}); show_popup(err + l("Error 2") + " (" + d1 + ", " + d2 + " at i=" + i + ")"); return false; } @@ -280,6 +296,7 @@ async function ds4_calibrate_sticks_end(has_perm_changes) { if(data.getUint32(0, false) != 0x91010101 || data2.getUint32(0, false) != 0x920101FF) { d1 = dec2hex32(data.getUint32(0, false)); d2 = dec2hex32(data2.getUint32(0, false)); + la("ds4_calibrate_sticks_end_failed", {"d1": d1, "d2": d2}); show_popup(err + l("Error 3") + " (" + d1 + ", " + d2 + " at i=" + i + ")"); return false; } @@ -287,6 +304,7 @@ async function ds4_calibrate_sticks_end(has_perm_changes) { if(has_perm_changes) { await ds4_nvlock(); if(await ds4_nvstatus() != 1) { + la("ds4_calibrate_sticks_end_failed", {"r": "nvlock"}); show_popup(err + l("Cannot relock NVS")); return false; } @@ -294,6 +312,7 @@ async function ds4_calibrate_sticks_end(has_perm_changes) { return true; } catch(e) { + la("ds4_calibrate_sticks_end_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); show_popup(err + e); return false; @@ -310,9 +329,12 @@ async function ds4_calibrate_sticks() { await device.sendFeatureReport(0x90, alloc_req(0x90, [1,1,1])) // Assert - data = await device.receiveFeatureReport(0x91) - data2 = await device.receiveFeatureReport(0x92) - if(data.getUint32(0, false) != 0x91010101 || data2.getUint32(0, false) != 0x920101ff) { + data = await device.receiveFeatureReport(0x91); + data2 = await device.receiveFeatureReport(0x92); + d1 = data.getUint32(0, false); + d2 = data2.getUint32(0, false); + if(d1 != 0x91010101 || d2 != 0x920101ff) { + la("ds4_calibrate_sticks_failed", {"s": 1, "d1": d1, "d2": d2}); close_calibrate_window(); return show_popup(err + l("Error 1")); } @@ -328,9 +350,10 @@ async function ds4_calibrate_sticks() { data = await device.receiveFeatureReport(0x91); data2 = await device.receiveFeatureReport(0x92); if(data.getUint32(0, false) != 0x91010101 || data2.getUint32(0, false) != 0x920101ff) { - close_calibrate_window(); d1 = dec2hex32(data.getUint32(0, false)); d2 = dec2hex32(data2.getUint32(0, false)); + la("ds4_calibrate_sticks_failed", {"s": 2, "i": i, "d1": d1, "d2": d2}); + close_calibrate_window(); return show_popup(err + l("Error 2") + " (" + d1 + ", " + d2 + " at i=" + i + ")"); } @@ -343,6 +366,7 @@ async function ds4_calibrate_sticks() { if(data.getUint32(0, false) != 0x91010101 || data2.getUint32(0, false) != 0x920101FF) { d1 = dec2hex32(data.getUint32(0, false)); d2 = dec2hex32(data2.getUint32(0, false)); + la("ds4_calibrate_sticks_failed", {"s": 3, "d1": d1, "d2": d2}); close_calibrate_window(); return show_popup(err + l("Error 3") + " (" + d1 + ", " + d2 + " at i=" + i + ")"); } @@ -352,6 +376,7 @@ async function ds4_calibrate_sticks() { close_calibrate_window() show_popup(l("Stick calibration completed")); } catch(e) { + la("ds4_calibrate_sticks_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); @@ -488,6 +513,7 @@ async function ds5_calibrate_sticks_begin(has_perm_changes) { if(has_perm_changes) { await ds5_nvunlock(); if(await ds5_nvstatus() != 0) { + la("ds5_calibrate_sticks_begin_failed", {"r": "nvunlock"}); show_popup(err + l("Cannot unlock NVS")); return false; } @@ -499,11 +525,13 @@ async function ds5_calibrate_sticks_begin(has_perm_changes) { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010101) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_begin_failed", {"d1": d1}); show_popup(err + l("Error 1") + " (" + d1 + ")."); return false; } return true; } catch(e) { + la("ds5_calibrate_sticks_begin_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); show_popup(err + e); return false; @@ -521,11 +549,13 @@ async function ds5_calibrate_sticks_sample() { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010101) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_sample_failed", {"d1": d1}); show_popup(err + l("Error 2") + " (" + d1 + ")."); return false; } return true; } catch(e) { + la("ds5_calibrate_sticks_sample_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); show_popup(err + e); return false; @@ -542,6 +572,7 @@ async function ds5_calibrate_sticks_end(has_perm_changes) { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010102) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_end_failed", {"d1": d1}); show_popup(err + l("Error 3") + " (" + d1 + ")."); return false; } @@ -549,12 +580,14 @@ async function ds5_calibrate_sticks_end(has_perm_changes) { if(has_perm_changes) { await ds5_nvlock(); if(await ds5_nvstatus() != 1) { + la("ds5_calibrate_sticks_end_failed", {"r": "nvlock"}); show_popup(err + l("Cannot relock NVS")); return false; } } return true; } catch(e) { + la("ds5_calibrate_sticks_end_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); show_popup(err + e); return false; @@ -574,6 +607,7 @@ async function ds5_calibrate_sticks() { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010101) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_failed", {"s": 1, "d1": d1}); close_calibrate_window(); return show_popup(err + l("Error 1") + " (" + d1 + ")."); } @@ -590,6 +624,7 @@ async function ds5_calibrate_sticks() { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010101) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_failed", {"s": 2, "i": i, "d1": d1}); close_calibrate_window(); return show_popup(err + l("Error 2") + " (" + d1 + ")."); } @@ -607,6 +642,7 @@ async function ds5_calibrate_sticks() { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010102) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_sticks_failed", {"s": 3, "d1": d1}); close_calibrate_window(); return show_popup(err + l("Error 3") + " (" + d1 + ")."); } @@ -618,6 +654,7 @@ async function ds5_calibrate_sticks() { show_popup(l("Stick calibration completed")); } catch(e) { + la("ds5_calibrate_sticks_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); @@ -631,6 +668,7 @@ async function ds5_calibrate_range_begin(perm_ch) { if(perm_ch) { await ds5_nvunlock(); if(await ds5_nvstatus() != 0) { + la("ds5_calibrate_range_begin_failed", {"r": "nvunlock"}); close_calibrate_window(); return show_popup(err + l("Cannot unlock NVS")); } @@ -643,10 +681,12 @@ async function ds5_calibrate_range_begin(perm_ch) { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010201) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_range_begin_failed", {"d1": d1}); close_calibrate_window(); return show_popup(err + l("Error 1") + " (" + d1 + ")."); } } catch(e) { + la("ds5_calibrate_range_begin_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); @@ -664,6 +704,7 @@ async function ds5_calibrate_range_end(perm_ch) { data = await device.receiveFeatureReport(0x83) if(data.getUint32(0, false) != 0x83010202) { d1 = dec2hex32(data.getUint32(0, false)); + la("ds5_calibrate_range_end_failed", {"d1": d1}); close_calibrate_window(); return show_popup(err + l("Error 1") + " (" + d1 + ")."); } @@ -671,6 +712,7 @@ async function ds5_calibrate_range_end(perm_ch) { if(perm_ch) { await ds5_nvlock(); if(await ds5_nvstatus() != 1) { + la("ds5_calibrate_range_end_failed", {"r": "nvlock"}); close_calibrate_window(); return show_popup(err + l("Cannot relock NVS")); } @@ -679,6 +721,7 @@ async function ds5_calibrate_range_end(perm_ch) { close_calibrate_window(); show_popup(l("Range calibration completed")); } catch(e) { + la("ds5_calibrate_range_end_failed", {"r": e}); await new Promise(r => setTimeout(r, 500)); close_calibrate_window(); return show_popup(err + e); diff --git a/donate.png b/donate.png new file mode 100644 index 0000000000000000000000000000000000000000..f6e15c1780e78a09cd749331e1d1ac6a7f8371df GIT binary patch literal 449 zcmV;y0Y3hTP)qRY^^BAOkX+wgXi=;7`6^*W6!P(6_xuy0epuY_hQ2Uhd(B>PE5NVeba+eL(W?i*6PNAM5HVEa>Wn!T(-tZG-qa^ zFKmrq?#)!iWY*^t>l;FB!`flMftH35Y!T;4G1%s;$t3pGx% zTA+12k3^nOqk7R5C0|}r&<^q#r1OO8alRjj?I50NsBEa?IYW-U5KFP+r7bLd8mT4i rjVBCOxQ>|ANUf^u3%}Y8Z)gf1-)V@UwDg4f00000NkvXXu0mjfDWb|~ literal 0 HcmV?d00001 diff --git a/index.html b/index.html index 568ca3a..56bf60a 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,13 @@ + + + + + + + @@ -307,10 +314,22 @@

If you're finding it helpful and you want to support my efforts, feel free to buy me a coffee! :)

Do you have any suggestion or issue? Drop me a message via email or discord.

Cheers!

+ +
+
+
Ethereum Address
+
+ +
+
@@ -438,7 +457,7 @@