'captureButton');
let isButtonEnabled = true;

function enableCaptureButton() {
    isButtonEnabled = true;
    captureButton.disabled = false;
}

function capturePreview(camera_num) {
    let captureButton = document.getElementById(`captureButton_${camera_num}`);
    if (!captureButton) {
        console.error(`Button for camera ${camera_num} not found`);
        return;
    }

    // Disable the button to prevent rapid presses
    captureButton.disabled = true;

    fetch('/preview_' + camera_num, {
     