diff options
author | Giovanni Condello <nanomad@users.noreply.github.com> | 2023-05-28 16:37:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-28 16:37:43 +0200 |
commit | 85d9e18b2170526ba902e0affb1c9886f4c042bb (patch) | |
tree | 16256fad8bea15c3459c122e2a8234c1fd8f3142 /assets/js | |
parent | Update ont-odi-realtek-dfp-34x-2c2.md (#203) (diff) | |
download | hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar.gz hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar.bz2 hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar.lz hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar.xz hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.tar.zst hack-gpon.github.io-85d9e18b2170526ba902e0affb1c9886f4c042bb.zip |
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/LTF7267-BHA-ploam.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/assets/js/LTF7267-BHA-ploam.js b/assets/js/LTF7267-BHA-ploam.js new file mode 100644 index 0000000..57cd307 --- /dev/null +++ b/assets/js/LTF7267-BHA-ploam.js @@ -0,0 +1,28 @@ +function hexEncode(str){ + var hex, i; + + var result = ""; + for (i=0; i<str.length; i++) { + hex = str.charCodeAt(i).toString(16); + result += hex.padStart(2, "0"); + } + + return result; +} + +function hisensePloam(ascii_ploam) { + var hex_ploam = hexEncode(ascii_ploam); + var hex_padded_ploam = hex_ploam.padEnd(72, "0"); + var array =[]; + for (i = 0; i<9; i++) { + ploam_segment = hex_padded_ploam.slice(i*8, (i+1)*8); + new_ploam_segment = ""; + for(j = 4; j>0; j--) { + new_ploam_segment = new_ploam_segment + ploam_segment.slice((j-1)*2, j*2); + } + if(new_ploam_segment !== "00000000") { + array.push("INT CFG_ID_PON_REGISTRATION_ID"+i+" = 0x"+new_ploam_segment+";"); + } + } + return array.join("\n"); +}
\ No newline at end of file |