From 84536618254effc0ad2fd913282879300ef29750 Mon Sep 17 00:00:00 2001 From: javl Date: Sat, 15 Aug 2026 11:14:46 +0200 Subject: [PATCH] Remove identifier placeholder, fixing #62 --- index.html | 2 +- js/script.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 7e28015..cc26f51 100644 --- a/index.html +++ b/index.html @@ -287,7 +287,7 @@
- +
diff --git a/js/script.js b/js/script.js index c35e454..1cc2c67 100644 --- a/js/script.js +++ b/js/script.js @@ -198,8 +198,6 @@ function Images() { const images = new Images(); // Filetypes accepted by the file picker // const fileTypes = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'svg']; -// Variable name, when "arduino code" is required -const identifier = 'myBitmap'; // Invert the colors of the canvas function invert(canvas, ctx) { @@ -849,7 +847,7 @@ function imageToString(image) { // Get the custom arduino output variable name, if any function getIdentifier() { const vn = document.getElementById('identifier'); - return (vn && vn.value.length) ? vn.value : identifier; + return (vn && vn.value.length) ? vn.value : ''; } // Builds the "// 'glyph', WxHpx" comment line placed before each image's @@ -883,7 +881,7 @@ function generateOutputString() { const comment = glyphComment(image); bytesUsed += code.split('\n').length * 16; // 16 bytes per line. - const varname = getIdentifier() + (image.glyph ? `_${image.glyph.replace(/[^a-zA-Z0-9]/g, '_')}` : ''); + const varname = getIdentifier() + (image.glyph ? `${image.glyph.replace(/[^a-zA-Z0-9]/g, '_')}` : ''); varQuickArray.push(varname); code = `${comment}const ${getImageType()} ${varname} []${progmemKeyword()} = {\n${code}};\n`; outputString += code;