mirror of
http://10.0.2.1:3031/sauer/bfa-dryer-design.git
synced 2026-06-30 13:06:42 +10:00
Add PLC address, ON/OFF values to card editor for all card types
This commit is contained in:
parent
61605fb7f2
commit
ba697f410f
@ -759,13 +759,48 @@ function editCardProps(id) {
|
|||||||
`<option value="${t}" ${card.type===t?'selected':''}>${t.charAt(0).toUpperCase()+t.slice(1)}</option>`
|
`<option value="${t}" ${card.type===t?'selected':''}>${t.charAt(0).toUpperCase()+t.slice(1)}</option>`
|
||||||
).join('');
|
).join('');
|
||||||
|
|
||||||
let extraFields = '';
|
// Build Modbus address options
|
||||||
|
const modbusRegOpts = [
|
||||||
|
{label:'-- None --', value:''},
|
||||||
|
{label:'%MW0 - Heat Input Temp', value:'MW0'},
|
||||||
|
{label:'%MW1 - Product 1 Temp', value:'MW1'},
|
||||||
|
{label:'%MW2 - Product 2 Temp', value:'MW2'},
|
||||||
|
{label:'%MW3 - Exhaust Temp', value:'MW3'},
|
||||||
|
{label:'%MW10 - Heat SP', value:'MW10'},
|
||||||
|
{label:'%MW11 - Prod1 SP', value:'MW11'},
|
||||||
|
{label:'%MW12 - Prod2 SP', value:'MW12'},
|
||||||
|
{label:'%MW13 - Exhaust SP', value:'MW13'},
|
||||||
|
{label:'%MW20 - Fan Speed', value:'MW20'},
|
||||||
|
{label:'%MW21 - Conveyor Speed', value:'MW21'},
|
||||||
|
{label:'%MW22 - Agitator 1 Speed', value:'MW22'},
|
||||||
|
{label:'%MW23 - Agitator 2 Speed', value:'MW23'},
|
||||||
|
{label:'%MW24 - Spinner Speed', value:'MW24'},
|
||||||
|
{label:'%MW25 - Heater Stage', value:'MW25'},
|
||||||
|
{label:'%M1 - Discharge Agitator', value:'M1'},
|
||||||
|
{label:'%M2 - Brush', value:'M2'},
|
||||||
|
{label:'%M3 - Loading Conveyor', value:'M3'},
|
||||||
|
{label:'%M4 - Discharge Conveyor', value:'M4'},
|
||||||
|
{label:'%M5 - Mill', value:'M5'},
|
||||||
|
{label:'%M6 - Shaker Separator', value:'M6'},
|
||||||
|
{label:'Custom Register', value:'custom'},
|
||||||
|
].map(o => `<option value="${o.value}" ${card.modbusAddr===o.value?'selected':''}>${o.label}</option>`).join('');
|
||||||
|
|
||||||
|
let extraFields = `
|
||||||
|
<div class="prop-row">
|
||||||
|
<label>PLC Address</label>
|
||||||
|
<select id="prop-modbus">${modbusRegOpts}</select>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
if (card.type === 'temp') {
|
if (card.type === 'temp') {
|
||||||
extraFields = `
|
extraFields += `
|
||||||
<div class="prop-row"><label>Setpoint</label><input type="number" id="prop-sp" value="${card.sp_default||70}" min="0" max="200"> <span style="color:var(--text2)">°C</span></div>`;
|
<div class="prop-row"><label>Setpoint</label><input type="number" id="prop-sp" value="${card.sp_default||70}" min="0" max="200"> <span style="color:var(--text2)">°C</span></div>`;
|
||||||
} else if (card.type === 'motor') {
|
} else if (card.type === 'motor') {
|
||||||
extraFields = `
|
extraFields += `
|
||||||
<div class="prop-row"><label>Speed SP</label><input type="number" id="prop-sp" value="${card.sp_default||50}" min="0" max="100" step="5"> <span style="color:var(--text2)">%</span></div>`;
|
<div class="prop-row"><label>Speed SP</label><input type="number" id="prop-sp" value="${card.sp_default||50}" min="0" max="100" step="5"> <span style="color:var(--text2)">%</span></div>`;
|
||||||
|
} else if (card.type === 'output' || card.type === 'burner') {
|
||||||
|
extraFields += `
|
||||||
|
<div class="prop-row"><label>ON Value</label><input type="number" id="prop-onval" value="${card.onValue!==undefined?card.onValue:1}" min="0" max="65535"></div>
|
||||||
|
<div class="prop-row"><label>OFF Value</label><input type="number" id="prop-offval" value="${card.offValue!==undefined?card.offValue:0}" min="0" max="65535"></div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.innerHTML = `
|
p.innerHTML = `
|
||||||
@ -842,9 +877,14 @@ function saveCardProps(id) {
|
|||||||
card.activeColor = document.getElementById('prop-activecolor').value || null;
|
card.activeColor = document.getElementById('prop-activecolor').value || null;
|
||||||
card.inactiveColor = document.getElementById('prop-inactivecolor').value || null;
|
card.inactiveColor = document.getElementById('prop-inactivecolor').value || null;
|
||||||
card.fontSize = parseInt(document.getElementById('prop-fontsize').value) || 18;
|
card.fontSize = parseInt(document.getElementById('prop-fontsize').value) || 18;
|
||||||
|
card.modbusAddr = document.getElementById('prop-modbus').value || null;
|
||||||
|
|
||||||
const spEl = document.getElementById('prop-sp');
|
const spEl = document.getElementById('prop-sp');
|
||||||
if (spEl) card.sp_default = parseInt(spEl.value) || 0;
|
if (spEl) card.sp_default = parseInt(spEl.value) || 0;
|
||||||
|
const onEl = document.getElementById('prop-onval');
|
||||||
|
if (onEl) card.onValue = parseInt(onEl.value);
|
||||||
|
const offEl = document.getElementById('prop-offval');
|
||||||
|
if (offEl) card.offValue = parseInt(offEl.value);
|
||||||
|
|
||||||
closePopup();
|
closePopup();
|
||||||
renderCards();
|
renderCards();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user