From b4922fe01bd2e51bd6c9699bae0ec587e9e70571 Mon Sep 17 00:00:00 2001 From: Adriano Date: Wed, 3 Jun 2026 10:05:51 +0200 Subject: [PATCH] fix(pose_3d): front-tag detection solo al cambio immagine, non in loop L'overlay tag frontale (D435i) ri-eseguiva la detection ArUco ad ogni tick di pollState() finche' il flag era attivo. Ora gira solo: - al toggle on del checkbox - a fine acquireClouds() (pulsante Acquisisci) se il flag e' attivo Rimosso il piggyback in pollState() e lo stato front_tags.in_flight ormai inutilizzato. Co-Authored-By: Claude Opus 4.8 (1M context) --- web/pose_3d.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/pose_3d.js b/web/pose_3d.js index b8f2d51..06f8d0e 100644 --- a/web/pose_3d.js +++ b/web/pose_3d.js @@ -229,7 +229,6 @@ const state = { }, front_tags: { // overlay tag visibili dalla camera D435i frontale group: null, // THREE.Group child del d435 parent (cloud-like transform) - in_flight: false, // evita richieste sovrapposte se il fetch supera il poll }, }; @@ -796,12 +795,9 @@ async function pollState() { // soft fail: log + segna lo stato console.warn('pose_3d /state fail:', e.message); } - // Front-camera tag overlay: piggyback sul ciclo poll dello state, no - // timer separato. Se il flag e' on aggiorniamo il rendering ad ogni tick. - if ($('p3ShowFrontTags')?.checked && !state.front_tags.in_flight) { - state.front_tags.in_flight = true; - pollFrontTags().finally(() => { state.front_tags.in_flight = false; }); - } + // NB: il front-tag overlay NON viene aggiornato qui. La detection ArUco + // gira solo al cambio dell'immagine (pulsante Acquisisci -> acquireClouds) + // e al toggle on del flag, non ad ogni tick del poll dello state. } function refreshPoseSelect() { @@ -1769,6 +1765,9 @@ async function acquireClouds() { // Memorizza i parametri usati in questa acquisizione (best-effort, // non blocca il rendering del cloud se il save fallisce). saveCloudParamsToConfig(); + // Nuova immagine acquisita: se l'overlay tag e' attivo ri-esegui la + // detection una volta sola, sul frame appena acquisito. + if ($('p3ShowFrontTags')?.checked) pollFrontTags(); } catch (e) { $('p3CloudStatus').textContent = `errore: ${e.message}`; $('p3CloudStatus').style.color = 'var(--danger)';