diff --git a/index.html b/index.html
index d23dcfc..f51a49e 100644
--- a/index.html
+++ b/index.html
@@ -153,8 +153,9 @@ distance = TOF · c avec c ≈ 1500 m/s en eau de mer
USBL A (fixe)
USBL B (mobile)
- ping (A→B)
- pong (B→A)
+ ping1 (A→B, plein)
+ pong (B→A, plein)
+ ping2 (A→B, anneau)
@@ -338,8 +339,13 @@ Ce schéma est exactement celui qu'utilisent les puces UWB DecaWave DW1000 /
const history = [];
let nCycles = 0;
+ // Guard interval (s sim) between two consecutive cycles, to avoid the visual
+ // confusion where A's ping2 (end of cycle N) and ping1 (start of cycle N+1)
+ // look like two back-to-back transmissions from A.
+ const CYCLE_GUARD = 0.6;
+
function ensureCycle() {
- if (!cycle || simT >= cycle.tPing2Recv) {
+ if (!cycle || simT >= cycle.tPing2Recv + CYCLE_GUARD) {
if (cycle) {
history.push({
tStart: cycle.tPing1Send,
@@ -352,7 +358,7 @@ Ce schéma est exactement celui qu'utilisent les puces UWB DecaWave DW1000 /
nCycles++;
if (history.length > 600) history.shift();
}
- const startT = cycle ? cycle.tPing2Recv : 0;
+ const startT = cycle ? cycle.tPing2Recv + CYCLE_GUARD : 0;
cycle = buildCycle(startT);
}
}
@@ -405,9 +411,9 @@ Ce schéma est exactement celui qu'utilisent les puces UWB DecaWave DW1000 /
// Pulses for current cycle
if (cycle) {
const pulses = [
- { sendT: cycle.tPing1Send, recvT: cycle.tPing1Recv, fromA: true, color: '#5ad1ff', label: 'ping' },
- { sendT: cycle.tPongSend, recvT: cycle.tPongRecv, fromA: false, color: '#ff8b5a', label: 'pong' },
- { sendT: cycle.tPing2Send, recvT: cycle.tPing2Recv, fromA: true, color: '#5ad1ff', label: 'ping2' },
+ { sendT: cycle.tPing1Send, recvT: cycle.tPing1Recv, fromA: true, color: '#5ad1ff', label: 'ping1', shape: 'solid' },
+ { sendT: cycle.tPongSend, recvT: cycle.tPongRecv, fromA: false, color: '#ff8b5a', label: 'pong', shape: 'solid' },
+ { sendT: cycle.tPing2Send, recvT: cycle.tPing2Recv, fromA: true, color: '#5ad1ff', label: 'ping2', shape: 'ring' },
];
for (const p of pulses) {
if (t < p.sendT || t > p.recvT) continue;
@@ -421,8 +427,14 @@ Ce schéma est exactement celui qu'utilisent les puces UWB DecaWave DW1000 /
const x = xs + (xe - xs) * frac;
ctx.beginPath();
ctx.arc(x, yLine, 7, 0, Math.PI * 2);
- ctx.fillStyle = p.color;
- ctx.fill();
+ if (p.shape === 'ring') {
+ ctx.strokeStyle = p.color;
+ ctx.lineWidth = 2.5;
+ ctx.stroke();
+ } else {
+ ctx.fillStyle = p.color;
+ ctx.fill();
+ }
// trail
const trailLen = 60;
const dir = (xe > xs) ? -1 : 1;