diff --git a/index.html b/index.html
index 0d29e21..60b0dee 100644
--- a/index.html
+++ b/index.html
@@ -1,3 +1,11 @@
+
@@ -50,6 +58,10 @@
h1{
margin: 0;
}
+ #variableNameContainer {
+ display: none;
+ margin: 0;
+ }
@@ -108,8 +120,12 @@
4. Output
-
+
Adds some extra Arduino code around the output for easy copy-paste into this example.
+
+
+
+
@@ -130,7 +146,7 @@
// Filetypes accepted by the file picker
- var fileTypes = ['jpg', 'jpeg', 'png', 'bmp', 'gif'];
+ var fileTypes = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'svg'];
// The canvas we will draw on
@@ -159,6 +175,9 @@
invertColors: false
};
+ // Variable name, when 'arduino code' is required
+ var variableName = 'myBitmap';
+
// Easy way to update settings controlled by a textfield
function updateInteger(fieldName){
@@ -185,6 +204,12 @@
place_image();
}
+ // Updates Arduino code check-box
+ function updateArduinoCode(checkbox) {
+ var c = document.getElementById('variableNameContainer');
+ c && checkbox.checked ? c.style.display = "block" : c.style.display = "none";
+ settings['addArduinoCode'] = checkbox.checked;
+ }
// Make the canvas black and white
function blackAndWhite(){
@@ -406,6 +431,13 @@
}
+ // Get the custom arduino output variable name, if any
+ function getVariableName() {
+ var vn = document.getElementById('variableName');
+ return vn && vn.value.length ? vn.value : variableName;
+ }
+
+
// Output the image string to the textfield
function outputString(){
var output_string = "";
@@ -416,7 +448,7 @@
}
if(settings['addArduinoCode']){
- output_string = "const unsigned char myBitmap [] PROGMEM = {\n" + output_string + "\n};";
+ output_string = "const unsigned char " + getVariableName() + " [] PROGMEM = {\n" + output_string + "\n};";
}
document.getElementById('outputField').value = output_string;
}
@@ -555,4 +587,3 @@
-