Calibration: pre-select device by LED count match or last remembered
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -214,6 +214,20 @@ export async function showCSSCalibration(cssId) {
|
|||||||
const testGroup = document.getElementById('calibration-css-test-group');
|
const testGroup = document.getElementById('calibration-css-test-group');
|
||||||
testGroup.style.display = devices.length ? '' : 'none';
|
testGroup.style.display = devices.length ? '' : 'none';
|
||||||
|
|
||||||
|
// Pre-select device: 1) LED count match, 2) last remembered, 3) first
|
||||||
|
if (devices.length) {
|
||||||
|
const rememberedId = localStorage.getItem('css_calibration_test_device');
|
||||||
|
let selected = null;
|
||||||
|
if (source.led_count > 0) {
|
||||||
|
selected = devices.find(d => d.led_count === source.led_count) || null;
|
||||||
|
}
|
||||||
|
if (!selected && rememberedId) {
|
||||||
|
selected = devices.find(d => d.id === rememberedId) || null;
|
||||||
|
}
|
||||||
|
if (selected) testDeviceSelect.value = selected.id;
|
||||||
|
testDeviceSelect.onchange = () => localStorage.setItem('css_calibration_test_device', testDeviceSelect.value);
|
||||||
|
}
|
||||||
|
|
||||||
// Populate calibration fields
|
// Populate calibration fields
|
||||||
const preview = document.querySelector('.calibration-preview');
|
const preview = document.querySelector('.calibration-preview');
|
||||||
preview.style.aspectRatio = '';
|
preview.style.aspectRatio = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user