# Proven LS-CAN broadcast catalog for Opel Vectra C (2002).
# Updated after an October 2026 re-sniff of the same car.
# Goldens match CAN_LS_20261014.LOG attached to the follow-up post.
#
# Notes:
#   - Clock hour is b0>>3 (not b0-0x80). Minutes: b1>=0x80 ? b1-0x80 : b1/4; seconds b2/4.
#   - Vehicle speed km/h = (byte4*2) + (byte5>>7).
#   - Wheel pulse counter is cm/tick distance, not the cluster trip odometer.
#   - Interior brightness maps 0x3F→0%, 0xFF→100%.
#   - Only signals proven against a live capture belong here.

can_network:
  frames:
    - id: "0x100"
      name: "BusWakeUp"
      dlc: 0
      description: "bus wake"
      signals: []

    - id: "0x108"
      name: "EngineStatus"
      dlc: 8
      signals:
        - name: "EngineStateCode"
          byte: 0
          mask: 0xFF
          value_mapping:
            0: "engine off"
            1: "ignition on"
            3: "accessory"
            17: "running"
            18: "running"
        - name: "EngineRPMRaw"
          byte: 1
          byte_count: 2
          endian: big
          mask: 0xFFFF
          factor: 0.25
          unit: "rpm"
        - name: "VehicleSpeedRaw"
          byte: 4
          mask: 0xFF
          factor: 2.0
          unit: "km/h"
          decode_note: "km/h = (byte4*2)+(byte5>>7); factor alone is byte4*2"
        - name: "WheelPulseCounterRaw"
          byte: 6
          byte_count: 2
          endian: big
          mask: 0xFFFF
          factor: 1.5748
          unit: "cm"
      examples:
        - value: "0x110AE4000000EABB"
          description: "rpm=697, speed_kmh=0"

    - id: "0x130"
      name: "FuelInjectionCounter"
      dlc: 5
      signals:
        - name: "InjectionPulseCounterRaw"
          byte: 2
          byte_count: 2
          endian: big
          mask: 0xFFFF
          factor: 0.03054
          unit: "ml"
      examples:
        - value: "0x0046597CFC"
          description: "ml=699.61"

    - id: "0x145"
      name: "EngineData"
      dlc: 8
      signals:
        - name: "WinterMode"
          byte: 0
          mask: 0x04
        - name: "CoolantTempRaw"
          byte: 3
          mask: 0xFF
          factor: 1.0
          offset: -40.0
          unit: "°C"
      examples:
        - value: "0x0000C08800000000"
          description: "coolant_c=96"

    - id: "0x155"
      name: "ClimateControlStatus"
      dlc: 3
      signals:
        - name: "ClimateControlOn"
          byte: 0
          mask: 0x80
        - name: "PressureRaw"
          byte: 2
          mask: 0xFF
      examples:
        - value: "0x00002D"
          description: "ac_on=False, pressure=45"

    - id: "0x170"
      name: "KeyPosition"
      dlc: 1
      signals:
        - name: "KeyPositionCode"
          byte: 0
          mask: 0xFF
          value_mapping:
            0: "key out"
            32: "key out"
            48: "key out"
            64: "key out, bus awake"
            66: "key in"
            68: "key in"
            70: "key in transition"
            84: "starter off, running"
            96: "key in, locked"
            112: "key in, locked"
            114: "key in, unlocked"
            116: "ignition on"
            118: "starter cranking"
      examples:
        - value: "0x44"
          description: "label=key in"

    - id: "0x175"
      name: "CIMButtonStatus"
      dlc: 8
      signals:
        - name: "HighBeamToggle"
          byte: 0
          mask: 0x20
        - name: "HighBeamMomentary"
          byte: 0
          mask: 0x08
        - name: "FrontWashWipe"
          byte: 0
          mask: 0x04
        - name: "WiperModeCode"
          byte: 1
          mask: 0xFF
          value_mapping:
            16: "single"
            160: "cyclic"
            176: "constant"
            208: "constant fast"
        - name: "BlinkerStalkPress"
          byte: 2
          mask: 0x30
          value_mapping:
            1: "left"
            2: "right"
        - name: "SteeringWheelButtonCode"
          byte: 3
          mask: 0x0F
          value_mapping:
            1: "wheel +"
            2: "wheel −"
            3: "wheel ○"
            4: "wheel →"
            5: "wheel ←"
            6: "wheel ↑"
        - name: "WiperSpeedCode"
          byte: 4
          mask: 0xFF
          value_mapping:
            51: "wiper 1"
            102: "wiper 2"
            153: "wiper 3"
            204: "wiper 4"
      examples:
        - value: "0x0000000066000000"
          description: "wiper=wiper 2"

    - id: "0x190"
      name: "Mileage"
      dlc: 5
      signals:
        - name: "OdometerRaw"
          byte: 1
          byte_count: 4
          endian: big
          mask: 0xFFFFFFFF
          factor: 0.015625
          unit: "km"
      examples:
        - value: "0x00014A9280"
          description: "km=338506"

    - id: "0x230"
      name: "DoorOpenStatus"
      dlc: 5
      signals:
        - name: "LockStateCode"
          byte: 0
          mask: 0xFF
        - name: "LeftRearDoorOpen"
          byte: 1
          mask: 0x40
        - name: "RightRearDoorOpen"
          byte: 1
          mask: 0x10
        - name: "DriverDoorOpen"
          byte: 2
          mask: 0x40
        - name: "PassengerDoorOpen"
          byte: 2
          mask: 0x10
        - name: "TrunkOpen"
          byte: 2
          mask: 0x04
      examples:
        - value: "0x4500400000"
          description: "driver_open=True"
        - value: "0x4500000000"
          description: "driver_open=False"

    - id: "0x235"
      name: "InteriorLightStatus"
      dlc: 2
      signals:
        - name: "InteriorBrightnessRaw"
          byte: 1
          mask: 0xFF
          decode_note: "0x3F→0%, 0xFF→100%, linear between"
      examples:
        - value: "0x0047"
          description: "brightness_pct=4"

    - id: "0x23A"
      name: "LightSwitchStatus"
      dlc: 2
      signals:
        - name: "ParkingLightsRequest"
          byte: 1
          mask: 0x20
        - name: "LowBeamRequest"
          byte: 1
          mask: 0x80
        - name: "FrontFogButtonPressed"
          byte: 1
          mask: 0x10
      examples:
        - value: "0x00A8"
          description: "parking=True, low_beam=True"

    - id: "0x260"
      name: "BlinkerStatus"
      dlc: 3
      signals:
        - name: "BlinkerModeCode"
          byte: 0
          mask: 0xFF
          value_mapping:
            0: "no blinkers"
            31: "hazards"
            37: "left blinker"
            58: "right blinker"
      examples:
        - value: "0x254080"
          description: "label=left blinker"
        - value: "0x004080"
          description: "label=no blinkers"
        - value: "0x3A4080"
          description: "label=right blinker"

    - id: "0x350"
      name: "ExternalLightStatus"
      dlc: 2
      signals:
        - name: "IgnitionOn"
          byte: 0
          mask: 0x80
        - name: "HighBeamOn"
          byte: 0
          mask: 0x40
        - name: "PositionLightsOn"
          byte: 0
          mask: 0x04
        - name: "ReverseLightOn"
          byte: 0
          mask: 0x10
      examples:
        - value: "0x8400"
          description: "ignition=True, position=True"
        - value: "0xC400"
          description: "high_beam=True"

    - id: "0x360"
      name: "ClutchStatus"
      dlc: 3
      signals:
        - name: "ClutchPressed"
          byte: 2
          mask: 0x40
      examples:
        - value: "0x400000"
          description: "pressed=False"

    - id: "0x370"
      name: "HandbrakeStatus"
      dlc: 3
      signals:
        - name: "HandbrakeUp"
          byte: 1
          mask: 0x01
      examples:
        - value: "0x000000"
          description: "up=False"

    - id: "0x415"
      name: "PassengerWindowStatus"
      dlc: 5
      signals:
        - name: "WindowMotionCode"
          byte: 1
          mask: 0xFF
          value_mapping:
            0: "idle"
            2: "up"
            4: "down"
      examples:
        - value: "0x000400EC41"
          description: "label=down"
        - value: "0x000200EC41"
          description: "label=up"

    - id: "0x440"
      name: "SystemTime"
      dlc: 8
      signals:
        - name: "ClockHours"
          byte: 0
          mask: 0xFF
          decode_note: "hour = byte0 >> 3"
        - name: "ClockMinutes"
          byte: 1
          mask: 0xFF
          decode_note: "minute = byte1>=0x80 ? byte1-0x80 : byte1/4"
        - name: "ClockSecondsRaw"
          byte: 2
          mask: 0xFF
          factor: 0.25
          unit: "s"
          decode_note: "second = byte2 / 4 (or factor 0.25)"
      examples:
        - value: "0xA0A864020068A01A"
          description: "clock=20:40:25"

    - id: "0x445"
      name: "OutdoorTemperature"
      dlc: 2
      signals:
        - name: "OutdoorTempRaw"
          byte: 1
          mask: 0xFF
          factor: 0.5
          offset: -40.0
          unit: "°C"
      examples:
        - value: "0x0067"
          description: "c=11.5"
        - value: "0x007B"
          description: "c=21.5"
