Enhance ACE mode visibility logic in applyState function - fix ACE Dryer visability. Adds/Removes ACE Dryer(s) from UI when switching to/from an ace mode and toolhead mode. Add/Remove Dryer(s) when ACE count increases/decreases

This commit is contained in:
Gangoke
2026-05-19 15:06:12 -10:00
parent 43e3d6516d
commit e4b2351fea

View File

@@ -3369,6 +3369,7 @@ function applyState(){
var units=(dry.units||[]);
var unitMap={};
units.forEach(function(u){var id=Number(u.id);if(id>=0&&id<=3)unitMap[id]=u;});
var aceMode=s.filament_mode==='ace_direct'||s.filament_mode==='ace_hub';
var detected=(s.ace_units||[]).filter(function(id){return id>=0&&id<=3;});
if(!detected.length){
Object.keys(unitMap).forEach(function(k){detected.push(Number(k));});
@@ -3378,11 +3379,11 @@ function applyState(){
}
detected.sort(function(a,b){return a-b;});
var aceWrap=document.getElementById('d-ace-dry-wrap');
if(aceWrap)aceWrap.style.display=detected.length?'contents':'none';
if(aceWrap)aceWrap.style.display=(aceMode&&detected.length)?'contents':'none';
for(var i=0;i<4;i++){
var card=document.getElementById('d-ace-dry-card-'+i);
if(!card)continue;
var show=detected.indexOf(i)>=0;
var show=aceMode&&detected.indexOf(i)>=0;
card.style.display=show?'':'none';
if(!show)continue;
var ud=unitMap[i]||dry;