{"id":115,"date":"2026-09-04T20:48:09","date_gmt":"2026-09-04T20:48:09","guid":{"rendered":"https:\/\/www.dmx-tool.com\/?page_id=115"},"modified":"2026-11-07T22:51:30","modified_gmt":"2026-11-07T22:51:30","slug":"dip-switch-calculator","status":"publish","type":"page","link":"https:\/\/www.dmx-tool.com\/index.php\/dip-switch-calculator\/","title":{"rendered":"DIP SWITCH CALCULATOR"},"content":{"rendered":"\n<!-- DIP Switch DMX Calculator \u2014 adapt\u00e9 \u00e0 la palette style-v2 (th\u00e8me sombre) -->\n<!-- DMX ADDRESS \u2014 Version 8 -->\n<div id=\"dip-switch-calculator\" class=\"dip-calculator alignfull\">\n\n  <div class=\"dip-address-block\">\n  <h3 class=\"dip-title\">DMX ADDRESS<\/h3>\n\n  <input\n    type=\"number\"\n    id=\"dmx-address\"\n    aria-label=\"DMX ADDRESS\"\n    min=\"1\"\n    max=\"512\"\n    step=\"1\"\n    value=\"1\"\n  >\n  <\/div>\n\n  <div class=\"dip-switches\">\n\n    <label class=\"dip-item\">\n      <span>DIP 1<\/span>\n      <input type=\"checkbox\" data-value=\"1\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 2<\/span>\n      <input type=\"checkbox\" data-value=\"2\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 3<\/span>\n      <input type=\"checkbox\" data-value=\"4\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 4<\/span>\n      <input type=\"checkbox\" data-value=\"8\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 5<\/span>\n      <input type=\"checkbox\" data-value=\"16\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 6<\/span>\n      <input type=\"checkbox\" data-value=\"32\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 7<\/span>\n      <input type=\"checkbox\" data-value=\"64\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 8<\/span>\n      <input type=\"checkbox\" data-value=\"128\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 9<\/span>\n      <input type=\"checkbox\" data-value=\"256\">\n    <\/label>\n\n    <label class=\"dip-item\">\n      <span>DIP 10<\/span>\n      <input type=\"checkbox\" data-value=\"512\">\n    <\/label>\n\n  <\/div>\n\n  <div class=\"dip-position-result\">\n    <div class=\"dip-position-title\">DIP SWITCH POSITION<\/div>\n    <strong id=\"dip-result-binary\" aria-live=\"polite\">1000000000<\/strong>\n  <\/div>\n<\/div>\n\n<style>\n  \/* Palette et typographie h\u00e9rit\u00e9e du site : Channel Finder 3.14.1. *\/\n  #dip-switch-calculator {\n    width: 100%;\n    box-sizing: border-box;\n    margin: 20px auto;\n    padding: 18px;\n    background: #0b0d10;\n    color: #eee;\n    border-radius: 14px;\n    font-family: inherit;\n    text-align: center;\n  }\n  #dip-switch-calculator *,\n  #dip-switch-calculator *::before {\n    box-sizing: border-box;\n  }\n  #dip-switch-calculator .dip-address-block {\n    margin-bottom: 20px;\n    padding: 14px 20px;\n    background: #175b8e;\n    border: 1px solid #3b4650;\n    border-left: 5px solid #2589d8;\n    border-radius: 9px;\n    box-shadow: 0 14px 34px rgba(0,0,0,.25), 0 7px 20px rgba(37,137,216,.17);\n  }\n  #dip-switch-calculator .dip-address-block .dip-title {\n    min-height: 0;\n    margin: 0 0 10px;\n    padding: 0;\n    background: transparent;\n    border: 0;\n    box-shadow: none;\n  }\n  #dip-switch-calculator .dip-title {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    width: 100%;\n    min-height: 52px;\n    margin: 0 0 20px;\n    padding: 14px 20px;\n    background: #175b8e;\n    border: 0;\n    border-left: 5px solid #2589d8;\n    border-radius: 9px;\n    box-shadow: inset 0 -1px 0 rgba(255,255,255,.16), 0 4px 12px rgba(0,0,0,.18);\n    color: #fff;\n    font-family: inherit;\n    font-size: 16px;\n    font-weight: 700;\n    line-height: 1.2;\n    letter-spacing: .5px;\n    text-transform: uppercase;\n  }\n  #dip-switch-calculator #dmx-address {\n    display: block;\n    width: 100%;\n    min-height: 46px;\n    margin: 0;\n    padding: 10px 12px;\n    background: #fff;\n    color: #111827;\n    border: 1px solid #cbd5e1;\n    border-radius: 9px;\n    font-family: inherit;\n    font-size: 16px;\n    font-weight: 700;\n    line-height: 1.2;\n    text-align: center;\n    appearance: textfield;\n    -moz-appearance: textfield;\n    transition: border-color .18s ease, box-shadow .18s ease;\n  }\n  #dip-switch-calculator #dmx-address:hover {\n    background: #f8fafc;\n    border-color: #94a3b8;\n    border-left-color: #2589d8;\n  }\n  #dip-switch-calculator #dmx-address:focus {\n    background: #fff;\n    color: #111827;\n    border-color: #52a8ff;\n    border-left-color: #2589d8;\n    box-shadow: 0 0 0 3px rgba(82,168,255,.16);\n    outline: none;\n  }\n  #dip-switch-calculator #dmx-address::-webkit-inner-spin-button,\n  #dip-switch-calculator #dmx-address::-webkit-outer-spin-button {\n    -webkit-appearance: none;\n    margin: 0;\n  }\n  #dip-switch-calculator .dip-switches {\n    display: grid;\n    grid-template-columns: repeat(10, minmax(0, 1fr));\n    gap: 8px;\n    width: 100%;\n    margin: 0;\n    padding: 20px;\n    background: linear-gradient(180deg, #1c1f22 0%, #141619 100%);\n    border: 1px solid #3b4650;\n    border-left: 5px solid #2589d8;\n    border-radius: 11px;\n    box-shadow: 0 14px 34px rgba(0,0,0,.25), 0 7px 20px rgba(37,137,216,.17);\n  }\n  #dip-switch-calculator .dip-item {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 7px;\n    min-width: 0;\n    width: 100%;\n    margin: 0;\n    font-family: inherit;\n    font-size: 12px;\n    font-weight: 700;\n    line-height: 1.2;\n    color: #4ba8eb;\n    white-space: nowrap;\n  }\n  #dip-switch-calculator .dip-item input {\n    appearance: none;\n    -webkit-appearance: none;\n    display: block;\n    flex: 0 0 auto;\n    position: relative;\n    width: 36px;\n    height: 58px;\n    margin: 0;\n    padding: 0;\n    background: #0b0d10;\n    border: 2px solid #46515e;\n    border-radius: 5px;\n    cursor: pointer;\n  }\n  #dip-switch-calculator .dip-item input::before {\n    content: \"OFF\";\n    position: absolute;\n    left: 2px;\n    right: 2px;\n    bottom: 3px;\n    padding: 4px 0;\n    background: #202225;\n    border-radius: 3px;\n    color: #eee;\n    font-family: inherit;\n    font-size: 9px;\n    font-weight: 700;\n    text-align: center;\n  }\n  #dip-switch-calculator .dip-item input:checked {\n    background: #2589d8;\n    border-color: #2589d8;\n  }\n  #dip-switch-calculator .dip-item input:checked::before {\n    content: \"ON\";\n    top: 3px;\n    bottom: auto;\n    background: #fff;\n    color: #111827;\n  }\n  #dip-switch-calculator .dip-item input:focus-visible {\n    outline: 3px solid #52a8ff;\n    outline-offset: 3px;\n  }\n  @media (max-width: 768px) {\n    #dip-switch-calculator {\n      padding: 9px;\n      border-radius: 10px;\n    }\n    #dip-switch-calculator .dip-title {\n      padding: 12px 20px;\n    }\n    #dip-switch-calculator .dip-switches {\n      grid-template-columns: repeat(5, minmax(0, 1fr));\n      gap: 16px 4px;\n      padding: 16px;\n    }\n  }\n  #dip-switch-calculator .dip-position-result {\n    margin-top: 20px;\n    padding: 14px 20px;\n    background: #9a4d1d;\n    border: 1px solid #70482d;\n    border-left: 5px solid #f08a3c;\n    border-radius: 9px;\n    color: #fff;\n    font-family: inherit;\n    text-align: center;\n    box-shadow: 0 16px 38px rgba(0,0,0,.28), 0 8px 22px rgba(240,138,60,.18);\n  }\n  #dip-switch-calculator .dip-position-title {\n    font-size: 16px;\n    font-weight: 700;\n    line-height: 1.2;\n    letter-spacing: .5px;\n  }\n  #dip-switch-calculator #dip-result-binary {\n    display: block;\n    margin-top: 10px;\n    font-size: 16px;\n    font-weight: 700;\n    line-height: 1.2;\n    letter-spacing: normal;\n    color: #111827;\n    background: #fff;\n    padding: 10px 12px;\n    border: 1px solid #cbd5e1;\n    border-radius: 9px;\n    overflow-wrap: anywhere;\n  }\n  \/* Typographie commune aux deux valeurs. *\/\n  #dip-switch-calculator #dmx-address,\n  #dip-switch-calculator #dip-result-binary {\n    font-family: inherit;\n    font-size: 16px;\n    font-weight: 700;\n    font-style: normal;\n    line-height: 1.2;\n    letter-spacing: normal;\n    text-transform: none;\n    color: #111827;\n    text-align: center;\n  }\n<\/style>\n\n<script>\n  document.addEventListener(\"DOMContentLoaded\", function () {\n    const addressInput = document.getElementById(\"dmx-address\");\n    const resultBinary = document.getElementById(\"dip-result-binary\");\n\n    const switches = document.querySelectorAll(\n      \"#dip-switch-calculator input[data-value]\"\n    );\n\n\n    \/* Calcul des valeurs (DIP 1=1, DIP 2=2, DIP 3=4, ... DIP 10=512) *\/\n    const dipValues = [];\n    switches.forEach(function (dipSwitch) {\n      dipValues.push(Number(dipSwitch.dataset.value));\n    });\n\n    \/* Bornes DMX *\/\n    const MIN_ADDR = 1;\n    const MAX_ADDR = 512;\n\n    \/* Force la saisie dans l'intervalle [1..512] et corrige les NaN *\/\n    function clampAddress(raw) {\n      let address = Number(raw);\n\n      if (!Number.isFinite(address) || address < MIN_ADDR) {\n        address = MIN_ADDR;\n      }\n\n      if (address > MAX_ADDR) {\n        address = MAX_ADDR;\n      }\n\n      return Math.trunc(address);\n    }\n\n    \/* Met \u00e0 jour l'\u00e9tat des switches depuis une adresse *\/\n    function updateFromAddress(address, syncInput = true) {\n      switches.forEach(function (dipSwitch, i) {\n        dipSwitch.checked = (address & dipValues[i]) !== 0;\n      });\n\n      updateDisplay(syncInput);\n    }\n\n    \/* Recalcule adresse + cha\u00eene binaire depuis l'\u00e9tat des switches *\/\n    function updateDisplay(syncInput = true) {\n      let address = 0;\n      let binary = \"\";\n\n      switches.forEach(function (dipSwitch, i) {\n        if (dipSwitch.checked) {\n          address += dipValues[i];\n          binary += \"1\";\n        } else {\n          binary += \"0\";\n        }\n      });\n\n\n      if (address < MIN_ADDR || address > MAX_ADDR) {\n        updateFromAddress(clampAddress(address));\n        return;\n      }\n      resultBinary.textContent = binary;\n\n      \/* Synchronise le champ de saisie avec la valeur calcul\u00e9e *\/\n      if (addressInput && syncInput) {\n        addressInput.value = address;\n      }\n    }\n\n    if (addressInput) {\n      \/* Laisser le champ vide pendant la saisie, sans r\u00e9injecter imm\u00e9diatement 1. *\/\n      addressInput.addEventListener(\"input\", function () {\n        const raw = addressInput.value.trim();\n        if (raw === \"\") return;\n\n        const address = Number(raw);\n        const boundedAddress = clampAddress(raw);\n        updateFromAddress(boundedAddress, address !== boundedAddress);\n      });\n\n      \/* Corriger une valeur incompl\u00e8te ou hors plage seulement \u00e0 la fin. *\/\n      addressInput.addEventListener(\"blur\", function () {\n        updateFromAddress(clampAddress(addressInput.value));\n      });\n\n      addressInput.addEventListener(\"keydown\", function (event) {\n        if (event.key === \"Enter\") addressInput.blur();\n      });\n    }\n\n    switches.forEach(function (dipSwitch) {\n      dipSwitch.addEventListener(\"change\", function () {\n        if (dipSwitch.checked) {\n          if (Number(dipSwitch.dataset.value) === 512) {\n            switches.forEach(function (other) {\n              if (other !== dipSwitch) other.checked = false;\n            });\n          } else {\n            const dipTen = document.querySelector(\n              '#dip-switch-calculator input[data-value=\"512\"]'\n            );\n            if (dipTen) dipTen.checked = false;\n          }\n        }\n        updateDisplay();\n      });\n    });\n\n    \/* Initialisation : partir de la valeur du champ, born\u00e9e *\/\n    if (addressInput) {\n      updateFromAddress(clampAddress(addressInput.value));\n    } else {\n      updateDisplay();\n    }\n  });\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>DMX ADDRESS DIP 1 DIP 2 DIP 3 DIP 4 DIP 5 DIP 6 DIP 7 DIP 8 DIP 9 DIP 10 DIP SWITCH POSITION 1000000000<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-115","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/pages\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":11,"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/pages\/115\/revisions"}],"predecessor-version":[{"id":325,"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/pages\/115\/revisions\/325"}],"wp:attachment":[{"href":"https:\/\/www.dmx-tool.com\/index.php\/wp-json\/wp\/v2\/media?parent=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}