in sim/visuals/ltc.ts [497:552]
private updateSerial() {
let state = this.board;
if (!state || !state.serialState) return;
if (state.serialState.usesSerial && !this.scopeElement) {
// Show Scope
svg.hydrate(this.element, {
"version": "1.0",
"viewBox": `0 -140 230 250`,
"class": "sim",
"x": "112.5px",
"y": "200px",
"width": "100%",
"height": "100%"
});
const scopeG = svg.child(this.element, "g", {
transform: ""
})
this.scopeElement = new DOMParser().parseFromString(SCOPE_SVG, "image/svg+xml").querySelector("svg") as SVGSVGElement;
svg.hydrate(this.scopeElement, {
"version": "1.0",
"viewBox": `0 0 200 250`,
"class": "sim",
"x": "80px",
"y": "-140px",
"width": "200px",
"height": "220px",
});
scopeG.appendChild(this.scopeElement);
this.scopeTextNode0 = this.scopeElement.getElementById('SCOPE_text0') as SVGTextElement;
this.scopeTextNode1 = this.scopeElement.getElementById('SCOPE_text1') as SVGTextElement;
this.scopeTextNode2 = this.scopeElement.getElementById('SCOPE_text2') as SVGTextElement;
this.scopeTextNode3 = this.scopeElement.getElementById('SCOPE_text3') as SVGTextElement;
const whiteWire = this.mkWirePart([137, -30], [147, 5], "blue");
const redWire = this.mkWirePart([153, -30], [167, 5], "red");
const blackWire = this.mkWirePart([171, -30], [192, 5], "black");
this.element.appendChild(whiteWire.el);
this.element.appendChild(redWire.el);
this.element.appendChild(blackWire.el);
}
if (state.serialState.usesSerial) {
if (state.serialState.lines.length > 0) {
this.scopeTextNode0.textContent = state.serialState.lines[0];
}
if (state.serialState.lines.length > 1) {
this.scopeTextNode1.textContent = state.serialState.lines[1];
}
if (state.serialState.lines.length > 2) {
this.scopeTextNode2.textContent = state.serialState.lines[2];
}
if (state.serialState.lines.length > 3) {
this.scopeTextNode3.textContent = state.serialState.lines[3];
}
}
}