fix(scale): progress-bar restart loop + low-weight warning + gateway auto-reconnect cycle

- Fix progress-bar restarting continuously when weight is stable:
  add _cancelScaleTimersOnly() that stops timers/animations without
  _cancelScaleTimersOnly() so the same value resumes counting when
  stability returns instead of always restarting the 5-s wait.
  Add 'else if' branch in _scaleAutoFillUse / _scaleAutoFillRecipeUse
  to restart stability wait after brief instability for the same value.

- Show red blinking warning in scale-live-box when weight < 10 g:
  adds scale-low-weight CSS class with pulsing border/shadow animation,
  the label shows '< 10 g · inserisci manualmente' instead of the
  stability progress bar.  No auto-confirm fires below 10 g.

- Gateway Android app: scale auto-reconnect now retries indefinitely.
  isAutoReconnecting flag keeps the scan→wait→scan cycle running until
  the scale is found again; onScanStopped schedules a new scan after
  10 s whenever autoReconnect is active and scale is still offline.
This commit is contained in:
dadaloop82
2026-04-16 06:25:40 +00:00
parent 1c686fa842
commit 3ff91b3018
4 changed files with 409 additions and 38 deletions
+66
View File
@@ -833,6 +833,72 @@ body {
transition: none;
}
/* ===== SCALE LIVE BOX ===== */
.scale-live-box {
display: flex;
align-items: center;
gap: 10px;
background: var(--bg-card);
border: 1.5px solid var(--border);
border-radius: 10px;
padding: 8px 12px;
margin-bottom: 10px;
}
.scale-live-icon {
font-size: 1.3rem;
flex-shrink: 0;
}
.scale-live-content {
flex: 1;
min-width: 0;
}
.scale-live-val {
font-size: 1.15rem;
font-weight: 700;
color: var(--text);
line-height: 1.2;
}
.scale-live-label {
font-size: 0.72rem;
color: var(--text-muted);
margin-top: 2px;
}
.scale-live-progress {
height: 3px;
background: var(--border);
border-radius: 2px;
margin-top: 5px;
overflow: hidden;
}
.scale-live-progress-bar {
height: 100%;
width: 0%;
background: var(--accent, #7c3aed);
border-radius: 2px;
transition: none;
}
.scale-live-box.scale-low-weight {
border-color: #dc2626;
background: #fef2f2;
animation: scaleLowWeightBlink 0.8s ease-in-out infinite alternate;
}
@media (prefers-color-scheme: dark) {
.scale-live-box.scale-low-weight {
background: #3b0000;
}
}
.scale-low-weight .scale-live-val {
color: #dc2626 !important;
}
.scale-low-weight .scale-live-label {
color: #dc2626 !important;
font-weight: 600;
}
@keyframes scaleLowWeightBlink {
from { border-color: #dc2626; box-shadow: none; }
to { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.25); }
}
.btn-accent {
background: var(--accent);
color: white;