Skip to content

Commit 65dc3d2

Browse files
author
gemi254
committed
Updated v1.1.2
1 parent 275c958 commit 65dc3d2

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

examples/ControlAssist-Scope/scopePMem.h

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ PROGMEM const char HTML_HEADERS[] = R"=====(
55
<meta charset="utf-8">
66
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
77
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
8-
<title>Control Assist</title>
8+
<link rel="shortcut icon" href="data:" />
9+
<title>ControlAssist</title>
910
<style>
1011
html, body {
1112
margin: 0;
@@ -26,7 +27,7 @@ html, body {
2627
width: 512px;
2728
text-align: center;
2829
}
29-
#canvas {
30+
#canvas {
3031
background-color: #181818;
3132
}
3233
#controls {
@@ -52,6 +53,13 @@ html, body {
5253
.on {
5354
background-color: #49cb61;
5455
}
56+
.bottom {
57+
position: relative;
58+
top: 5px;
59+
width: 100%;
60+
font-size: x-small;
61+
text-align: center;
62+
}
5563
</style>
5664
</head>
5765
)=====";
@@ -61,14 +69,18 @@ PROGMEM const char HTML_BODY[] = R"=====(
6169
<div id="container" class="center">
6270
<h3>ControlAssist Monitor ADC port</h3>
6371
<div id="controls">
64-
<button id="on-off">Turn On</button>
72+
<button id="on-off">Turn On</button>
6573
<input type="text" id="adc_val" value="0" style="display:none;">
6674
<label for="speed">Delay: <span id="speedValue">40</span> ms</label>
6775
<input id="speed" type="range" min="0" max="1500" step="1" value="40">
6876
<label for="gain">Input Gain: <span id="gainValue">1</span></label>
6977
<input id="gain" type="range" min="0" max="5" step="0.05" value="1">
7078
</div>
7179
<canvas id="canvas"></canvas>
80+
<div class="bottom">
81+
<div id="conLed" class="center"></div>
82+
<span id="wsStatus" style="display: none1;"></span>
83+
</div>
7284
</div>
7385
</body>
7486
)=====";
@@ -86,7 +98,7 @@ const canvas = document.getElementById("canvas"),
8698
adc_val = document.getElementById("adc_val"),
8799
dataArray = new Uint16Array(datBitCount);
88100

89-
speed = speedSlider.value;
101+
speed = speedSlider.value;
90102
canvas.width = window.innerWidth;
91103
canvas.height = window.innerHeight;
92104
pixelRatio = window.devicePixelRatio;
@@ -108,7 +120,7 @@ segmentWidth = canvas.width / datBitCount;
108120
powerBtn.addEventListener("click", () => {
109121
if (isPlaying) {
110122
powerBtn.innerHTML = "Turn On";
111-
} else {
123+
} else {
112124
powerBtn.innerHTML = "Turn Off";
113125
}
114126
powerBtn.classList.toggle("on");
@@ -123,11 +135,11 @@ powerBtn.addEventListener("wsChange", (event) => {
123135
if (isPlaying) {
124136
powerBtn.innerHTML = "Turn Off";
125137
powerBtn.classList.add("on");
126-
} else {
138+
} else {
127139
powerBtn.innerHTML = "Turn On";
128140
powerBtn.classList.remove("on");
129141
}
130-
if (isPlaying) draw();
142+
if (isPlaying) draw();
131143
});
132144

133145
// Speed slider handlers
@@ -154,7 +166,7 @@ adc_val.addEventListener("wsChange", (event) => {
154166
return false;
155167
});
156168

157-
const shiftRight = (collection, value) => {
169+
const shiftRight = (collection, value) => {
158170
collection.set(collection.subarray(0, -1), 1)
159171
collection.fill(value, 0, 1)
160172
return collection;
@@ -165,14 +177,14 @@ const scale = (number, [inMin, inMax], [outMin, outMax]) => {
165177
}
166178

167179
const draw = () => {
168-
if(dbg) console.time("Draw");
180+
if(dbg) console.time("Draw");
169181
c.fillRect(0, 0, canvas.width, canvas.height);
170182
c.beginPath();
171183
c.moveTo(-100, canvas.height / 2);
172-
184+
173185
if (isPlaying) {
174186
for (let i = 0; i < datBitCount; i += 1) {
175-
let x = i * segmentWidth;
187+
let x = i * segmentWidth;
176188
let y = canvas.height - scale(dataArray[i],[0,4095], [0,canvas.height])
177189
c.lineTo(x, y);
178190
}

0 commit comments

Comments
 (0)