From b6c97b97329689a18bd15d91a01cc867c3a218da Mon Sep 17 00:00:00 2001 From: Guo KK Date: Mon, 6 Jan 2020 15:51:21 -0500 Subject: [PATCH 1/4] add read data feature --- app.js | 42 ++++++++++++++++++++++++++++++++++++++---- index.html | 20 ++++---------------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/app.js b/app.js index 06d7651..c062c9b 100644 --- a/app.js +++ b/app.js @@ -16,7 +16,7 @@ function updateTable() { var height = matrix.length; $('#_grid').html(''); - $('#_grid').append(populateTable(null, height, width, "")); + $('#_grid').append(populateTable(null, height, width, matrix)); // events $table.on("mousedown", "td", toggle); @@ -25,9 +25,10 @@ function updateTable() { } function initOptions() { - $('#clearButton').click(function() { matrix = createArray(matrix.length,matrix[0].length); updateTable(); $('#_output').hide(); }); + $('#clearButton').click(function() { matrix = createArray(matrix.length,matrix[0].length); updateTable(); $('#_output').hide();}); $('#generateButton').click(updateCode); - + $('#readButton').click(readData); + $('#widthDropDiv li a').click(function () { var width = parseInt($(this).html()); var height = matrix.length; @@ -82,6 +83,36 @@ function updateCode() { prettyPrint(); } +function readData() { + var bytestr = prompt("Input your data here, in hex format: 0x1, 0x2"); + if (!bytestr) return; + var width = matrix.length; + var height = matrix[0].length; + var bytes = bytestr.split(',').map(function (x) { return parseInt(x)}); + + var byteinarow=Math.ceil(width/8); + var byteinacol=Math.ceil(height/8); + var byteindex ; + var bitindex; + for (var y=0;y> bitindex) & 0x1; + } + } + updateTable(); + updateSummary(); + updateCode(); +} + + function generateByteArray() { var width = matrix[0].length; var height = matrix.length; @@ -157,8 +188,11 @@ function populateTable(table, rows, cells, content) { row.appendChild(document.createElement('td')); $(row.cells[j]).data('i', i); $(row.cells[j]).data('j', j); + if (content[i][j]) { + $(row.cells[j]).addClass('on'); + } } - table.appendChild(row); + table.appendChild(row); } $table = $(table); return table; diff --git a/index.html b/index.html index 724f9c5..dffd7d4 100644 --- a/index.html +++ b/index.html @@ -15,21 +15,6 @@ - - - - @@ -59,7 +44,10 @@
- + +
+
+
From c32d849b3c446582cbb4378b5117e6089006da92 Mon Sep 17 00:00:00 2001 From: Guo KK Date: Mon, 13 Jan 2020 10:35:40 -0500 Subject: [PATCH 2/4] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a1c0b4c..cb5e6a4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Dot Matrix Tool +Edited version, with feature of read back data +https://hxlvelectronicclub.github.io/dotmatrixtool/ + + +Below is from the oringinal repo. + A web application for generating character or image byte arrays for dot matrix style OLED or LCD displays. Use it live at http://dotmatrixtool.com From fc6865115433fbba141d4a401276c2cf67cf982e Mon Sep 17 00:00:00 2001 From: Guo KK Date: Mon, 13 Jan 2020 10:36:51 -0500 Subject: [PATCH 3/4] disable this to resolve error from github --- CNAME | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CNAME b/CNAME index 24af1be..bef3f1c 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -dotmatrixtool.com +#dotmatrixtool.com From c8546c7de498aa85b0cb429313122bb37e8981a0 Mon Sep 17 00:00:00 2001 From: Stefan Gordon Date: Fri, 2 Feb 2024 12:09:12 -0500 Subject: [PATCH 4/4] Update app.js Co-authored-by: Jose Padron --- app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index c062c9b..699b9c6 100644 --- a/app.js +++ b/app.js @@ -86,7 +86,8 @@ function updateCode() { function readData() { var bytestr = prompt("Input your data here, in hex format: 0x1, 0x2"); if (!bytestr) return; - var width = matrix.length; + var width = matrix[0].length; + var height = matrix.length; var height = matrix[0].length; var bytes = bytestr.split(',').map(function (x) { return parseInt(x)});