@ -791,6 +791,7 @@
document.getElementsByName(i)[0].checked = obj[i];
document.getElementsByName(i)[0].checked = obj[i];
var e = document.getElementById("dispPins");
var e = document.getElementById("dispPins");
//KEEP this order !!!
var pins = [['clock', 'disp_clk'], ['data', 'disp_data'], ['cs', 'disp_cs'], ['dc', 'disp_dc'], ['reset', 'disp_rst']];
var pins = [['clock', 'disp_clk'], ['data', 'disp_data'], ['cs', 'disp_cs'], ['dc', 'disp_dc'], ['reset', 'disp_rst']];
if("ESP32" == type)
if("ESP32" == type)
pins.push(['busy', 'disp_bsy']);
pins.push(['busy', 'disp_bsy']);
@ -806,7 +807,7 @@
}
}
// keep display types grouped
// keep display types grouped
var opts = [[0, "None"], [2, "SH1106 1.3\" 128X64"], [5, "SSD1306 0.66\" 64X48"], [4, "SSD1306 0.91\" 128X32"], [1, "SSD1306 0.96\" 128X64"], [3, "Nokia5110"]];
var opts = [[0, "None"], [2, "SH1106 1.3\" 128X64"], [5, "SSD1306 0.66\" 64X48 (Wemos OLED Shield) "], [4, "SSD1306 0.91\" 128X32"], [1, "SSD1306 0.96\" 128X64"], [3, "Nokia5110"]];
if("ESP32" == type)
if("ESP32" == type)
opts.push([10, "ePaper"]);
opts.push([10, "ePaper"]);
var dispType = sel("disp_typ", opts, obj["disp_typ"]);
var dispType = sel("disp_typ", opts, obj["disp_typ"]);
@ -817,7 +818,7 @@
])
])
);
);
dispType.addEventListener('change', (e) => {
dispType.addEventListener('change', (e) => {
hideDispPins(pins, e.target.value)
hideDispPins(pins, parseInt( e.target.value))
});
});
opts = [[0, "0° "], [2, "180° "]];
opts = [[0, "0° "], [2, "180° "]];
@ -837,23 +838,26 @@
}
}
function hideDispPins(pins, dispType) {
function hideDispPins(pins, dispType) {
// create pin map for each display type.
// It depends on fix pin array (see var pins)
// var pins = [['clock', 'disp_clk'], ['data', 'disp_data'], ['cs', 'disp_cs'], ['dc', 'disp_dc'], ['reset', 'disp_rst']];
const pinMap = new Map([
[0, [0,0,0,0,0]], //none
[1, [1,1,0,0,0]], //SSD1306_128X64
[2, [1,1,0,0,0]], //SH1106_128X64
[3, [1,1,1,1,0]], //PCD8544_84X48 /nokia5110
[4, [1,1,0,0,0]], //SSD1306_128X32
[5, [1,1,0,0,0]], //SSD1306_64X48
[10, [1,1,1,1,1]] //ePaper
])
for(var i = 0; i < pins.length ; i + + ) {
for(var i = 0; i < pins.length ; i + + ) {
var cl = document.getElementById("row_" + pins[i][1]).classList;
var cl = document.getElementById("row_" + pins[i][1]).classList;
if(pinMap.get(dispType)[i]) {
if(0 == dispType)
cl.add("hide");
else if(dispType < = 2 || dispType == 4) { // OLED
if(i < 2 )
cl.remove("hide");
else
cl.add("hide");
} else if(dispType == 3) { // Nokia
if(i < 4 )
cl.remove("hide");
else
cl.add("hide");
} else // ePaper
cl.remove("hide");
cl.remove("hide");
}
else {
cl.add("hide");
}
}
}
}
}