Fix animations: stirrer/grains static at rest, fire uses power soll

- Stirrer starts at speed 0 (was 50) so blades don't spin on connect
- Grain particles only levitate when stirrer is running
- Fire size driven by PowerSet (soll) instead of Power (ist)
- Split animation-play-state out of stirrer shorthand for reliable pausing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JLR2133M2PyjiYq584i2G7
This commit is contained in:
2026-06-27 08:40:53 +02:00
co-authored by Claude Sonnet 4.6
parent c92c41230d
commit 545d924111
3 changed files with 13 additions and 5 deletions
+8 -3
View File
@@ -38,6 +38,7 @@ let initialStirrerActivateSync = true;
let ambientTemp = null;
let warpFactor = 1.0;
let heaterPowerIst = 0;
let heaterPowerSoll = 0;
let heaterMaxPower = 100;
// Sud state - mirrors the sud_* fields on client/brewpi_gui.py's Window.
@@ -278,13 +279,16 @@ function updateStepPlates() {
function updateStirrerVisualization() {
const g = document.getElementById('stirrer-blades');
const particles = document.getElementById('grain-particles');
if (!g) return;
if (stirrerSpeedIst > 0) {
const duration = Math.min(10, 50 / stirrerSpeedIst).toFixed(2);
g.style.setProperty('--stir-duration', duration + 's');
g.classList.add('spinning');
if (particles) particles.classList.add('stirring');
} else {
g.classList.remove('spinning');
if (particles) particles.classList.remove('stirring');
}
}
@@ -297,11 +301,11 @@ function updateFireVisualization() {
const fireBase = 248; // y of flame base (all paths end here)
const fireTip = 177; // y of tallest flame tip
const fireH = fireBase - fireTip; // 71px total flame height
if (heaterPowerIst <= 0) {
if (heaterPowerSoll <= 0) {
g.style.opacity = '0';
clipRect.setAttribute('height', '0');
} else {
const intensity = Math.min(1, heaterPowerIst / heaterMaxPower);
const intensity = Math.min(1, heaterPowerSoll / heaterMaxPower);
// Always show the lower 35% (base), scale upper 65% with intensity
const visibleH = (0.35 + 0.65 * intensity) * fireH;
const topBuffer = 20; // headroom for flicker scaleY overshoot (~12% of height)
@@ -513,7 +517,9 @@ function onHeaterChanged(msg) {
initialHeaterActivateSync = false;
}
} else if (key === 'PowerSet') {
heaterPowerSoll = msg.PowerSet;
document.getElementById('lcd-power-soll').textContent = msg.PowerSet;
updateFireVisualization();
} else if (key === 'Power') {
heaterPowerIst = msg.Power;
document.getElementById('lcd-power-ist').textContent = msg.Power;
@@ -522,7 +528,6 @@ function onHeaterChanged(msg) {
document.getElementById('heater-power-readout').textContent = msg.Power;
initialPowerSync = false;
}
updateFireVisualization();
} else if (key === 'Capabilities') {
const power = msg.Capabilities.Power;
heaterMaxPower = power.Max || 100;