aboutsummaryrefslogtreecommitdiff
path: root/aepd/share/aepscope.html
diff options
context:
space:
mode:
Diffstat (limited to 'aepd/share/aepscope.html')
-rw-r--r--aepd/share/aepscope.html94
1 files changed, 53 insertions, 41 deletions
diff --git a/aepd/share/aepscope.html b/aepd/share/aepscope.html
index aa63d9c..68427ef 100644
--- a/aepd/share/aepscope.html
+++ b/aepd/share/aepscope.html
@@ -212,6 +212,8 @@ var order;
var do_title = 0;
var sent_time = 0;
var peak_time = 0;
+var ring_start_time = 0;
+var ring_head_time = 0;
var viewport_offset_time = 0;
var dirty = 1;
@@ -256,12 +258,12 @@ function event_wheel(e)
// " Raw Value: " + raw + " Normalized Value: " + normal;
f = viewport_offset_time + (normal / 3) * rates[rate] * 0.0001 * xlen / 10;
- if (f < (-peak_time + (rates[rate] * 0.0001 * xlen) - 0.0001) || f > 0)
+ if (f < (-ring_head_time + ((rates[rate] * 0.0001 * xlen))) || f > 0)
return cancelEvent(e);
viewport_offset_time = f;
-// document.getElementById("val").textContent = viewport_offset_time.toFixed(4)+" "+(-peak_time).toFixed(4);
+// document.getElementById("val").textContent = viewport_offset_time.toFixed(4)+" "+(-ring_head_time).toFixed(4);
update_options();
@@ -348,6 +350,7 @@ function event_drag_end(e)
{
caliper_drag_index = -1;
trigger_drag = 0;
+ dirty = 1;
}
function update_measure()
@@ -634,7 +637,7 @@ function channel_list_changed()
function conn_retry()
{
- var r1, r2, r3, x, y, chan, z, block, channel_data = 0;
+ var r1, r2, r3, x, y, chan, z, block, channel_data = 0, tpt;
if (connection)
return;
@@ -676,8 +679,10 @@ function conn_retry()
f = msg.data.substr(1);
y = f.split(' ');
sent_time = parseFloat(y[0]);
- peak_time = sent_time; // + ((rates[rate] * 0.0001) * xlen);
- running = y[1];
+ tpt = sent_time; // + ((rates[rate] * 0.0001) * xlen);
+ ring_start_time = parseFloat(y[1]);
+ ring_head_time = parseFloat(y[2]);
+ running = y[3];
if (running != 0)
document.getElementById("run").checked = true;
else
@@ -828,7 +833,7 @@ function conn_retry()
if (ring_head == ring_size)
ring_head = 0;
- peak_time += (rates[rate] * 0.0001);
+ tpt += (rates[rate] * 0.0001);
if (loading)
loading--;
@@ -836,7 +841,8 @@ function conn_retry()
block++;
}
-
+ if (!channel_data)
+ peak_time = tpt;
if (!channel_data && do_title)
channel_list_changed();
@@ -937,7 +943,7 @@ function units3(n) {
function show(cv)
{
var n, p, y, chan, q, z, peak, ro, rx, extent, x2, xx, q1,
- effective_channels;
+ effective_channels, eff_peak_time;
if (!connection || !ring_size)
return;
@@ -945,6 +951,8 @@ function show(cv)
if (!dirty)
return;
+ eff_peak_time = peak_time;
+
dirty = 0;
last_running = running;
@@ -973,22 +981,26 @@ function show(cv)
x2 = xlen + y_axis_width;
extent = rates[rate] * 0.0001 * xlen;
- ro = peak_time + viewport_offset_time;
+ ro = (ring_head_time - ring_start_time) + viewport_offset_time;
rx = ro - extent;
if (rx < 0)
rx = 0;
- x = (x2 * (rx / peak_time));
- xx = x2 * (extent / peak_time);
+ x = (x2 * (rx / (ring_head_time - ring_start_time)));
+ xx = x2 * (extent / (ring_head_time - ring_start_time));
if (xx < 10) { // minimum width
x -= (10 - xx) / 2;
xx = 10;
}
-// document.getElementById("val").textContent = peak_time+" "+ro+" "+extent+" "+rx+" "+x;
+// document.getElementById("val").textContent = (ring_head_time - ring_start_time)+" "+ro+" "+extent+" "+rx+" "+x;
ctx.fillRect(x, ylen + x_axis_height + caliper_headroom - 12, xx, 8);
+ /*
+ * waveform drawing
+ */
+
q1 = ring_head;
last_head = q1;
@@ -1017,10 +1029,6 @@ function show(cv)
for (n = xlen - 1; n >= 0; n--) {
- q--;
- if (q < 0)
- q = ring_size - 1;
-
ctx.beginPath();
if (q >= 0)
@@ -1037,6 +1045,11 @@ function show(cv)
height[n] -= p;
}
ctx.stroke();
+
+ q--;
+ if (q < 0)
+ q = ring_size - 1;
+
}
chan++;
@@ -1044,7 +1057,7 @@ function show(cv)
/* x (time) axis marks */
- ro = peak_time + viewport_offset_time;
+ ro = eff_peak_time /* + viewport_offset_time; */
r = ro;
/* rates[rate] * 0.0001s per pixel */
time_pp = rates[rate] * 0.0001;
@@ -1061,29 +1074,28 @@ function show(cv)
while (r >= limit) {
var f;
-
- if (r >= 0) {
- x = xlen - (xlen * ((ro - r) / (ro - limit)));
-
- f = r.toFixed(sigs[rate]);
- if (sigs[rate]) {
- while (f.charAt(f.length - 1) == '0')
- f = f.substring(0, f.length - 1);
- if (f.charAt(f.length - 1) == '.')
- f = f.substring(0, f.length - 1);
- }
- ctx.lineWidth = 1;
- if ( r.toFixed(0) == r)
- ctx.lineWidth = 2;
-
- if (x < xlen) {
- ctx.beginPath();
- ctx.moveTo(x, caliper_headroom + ylen);
- ctx.lineTo(x, caliper_headroom + 1);
- ctx.stroke();
- }
- ctx.fillText(f, x, caliper_headroom + ylen + 16 - 2);
+
+ x = xlen - (xlen * ((ro - r) / (ro - limit)));
+
+ f = r.toFixed(sigs[rate]);
+ if (sigs[rate]) {
+ while (f.charAt(f.length - 1) == '0')
+ f = f.substring(0, f.length - 1);
+ if (f.charAt(f.length - 1) == '.')
+ f = f.substring(0, f.length - 1);
}
+ ctx.lineWidth = 1;
+ if ( r.toFixed(0) == r)
+ ctx.lineWidth = 2;
+
+ if (x < xlen) {
+ ctx.beginPath();
+ ctx.moveTo(x, caliper_headroom + ylen);
+ ctx.lineTo(x, caliper_headroom + 1);
+ ctx.stroke();
+ }
+ ctx.fillText(f, x, caliper_headroom + ylen + 16 - 2);
+
r -= interval;
}
@@ -1195,8 +1207,8 @@ function update_options()
localStorage["aepd.rate"] = document.getElementById("rate").value;
document.getElementById("tb").textContent = units(xlen * rates[rate] * 0.0001)+"s";
- if (viewport_offset_time < (-peak_time + (rates[rate] * 0.0001 * xlen) - 0.0001))
- viewport_offset_time = (-peak_time + (rates[rate] * 0.0001 * xlen) - 0.0001);
+ if (viewport_offset_time < (-ring_head_time /*+ ((rates[rate] * 0.0001 * xlen)) - 0.0001*/))
+ viewport_offset_time = (-ring_head_time /*+ ((rates[rate] * 0.0001 * xlen)) - 0.0001*/);
if (viewport_offset_time > 0)
viewport_offset_time = 0;