{# Rendered by /programmer/identify. Shows CV7 + CV8, and the catalog candidates whose NMRA manufacturer ID matches CV8. Each candidate has a "Use this decoder" button which populates the Manufacturer / Family / Model dropdowns at the top of the page so a subsequent single-CV read/write knows the decoder context — matches the "expert mode" workflow: identify, then poke CVs without opening the full pane view. #} {% if error is defined and error %}
Identify failed: {{ error }} {% if cv7 is defined %}

CV7={{ cv7 }} CV8={{ cv8 }}

{% endif %}
{% else %}

Decoder identity

CV7 (version)
{{ cv7 }}
CV8 (mfg ID)
{{ cv8 }}
{% if candidates %}
Manufacturer
{{ candidates[0].mfg }}
{% endif %} {% if product_id %}
Product ID
{{ product_id }}
{% endif %}
{% if product_id_error %}

Product ID probe failed: {{ product_id_error }} — falling back to family list.

{% endif %} {% if candidates %}

Matching decoder{% if total_models == 1 %} {% else %} families ({{ candidates|length }} {% if total_models and total_models != candidates|length %} · {{ total_models }} models {% endif %}){% endif %}

{% if total_models == 1 %}

Product ID narrowed to a single model. Click "Use" to lock in Manufacturer, Family, and Model above.

{% else %}

Grouped by family — CV7 / CV8 alone rarely pinpoint a single model. Click "Use" to lock in Manufacturer and Family; then choose the specific model from the Model dropdown above.

{% endif %} {% for c in candidates %} {% endfor %}
MfgFamilyModel{% if total_models != 1 %}s{% endif %}
{{ c.mfg }} {{ c.family }} {%- if c.model_count == 1 -%}{{ c.models[0] }} {%- else -%}{{ c.model_count }}{%- endif -%}
{% else %}

No matching decoder definitions in the loaded catalog.

{% endif %}
{# Wire the "Use" buttons. Two-stage cascade driven by direct ``htmx.ajax`` calls that each return a Promise — this avoids the racy dispatchEvent + htmx:afterSwap approach and preserves ordering even if the mfg selection was already set. Model isn't set here; the user picks it from the (now filtered) Model dropdown. #} {% endif %}