dtc_db.py 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # dtc_db.py
  2. HVAC_DTC_DATABASE = {
  3. # === Temperature Sensors ===
  4. "00785": "Temperature Sensor in Instrument Panel (G56)",
  5. "00779": "Outside Air Temperature Sensor (G17)",
  6. "00797": "Sunlight Photo Sensor (G107)",
  7. "00256": "A/C Pressure/Temperature Sensor (G395) - No Signal",
  8. "00258": "Interior Temp Sensor (G56) - Open/Short",
  9. "00259": "Interior Temp Sensor (G56) - Signal Out of Range",
  10. "00260": "Outside Temp Sensor (G17) - Open/Short",
  11. "00261": "Outside Temp Sensor (G17) - Signal Out of Range",
  12. "00262": "Dashboard Temp Sensor (G86) - Open/Short",
  13. "00263": "Fresh Air Intake Temp Sensor (G89) - Open/Short",
  14. "00818": "Evaporator Outlet Temp Sensor (G263) - Open/Short",
  15. "00819": "A/C High Pressure Sensor (G65) - Signal Too Low",
  16. "00820": "A/C High Pressure Sensor (G65) - Signal Too High",
  17. # === Flap Positioning Motors ===
  18. "01272": "Central Flap Positioning Motor (V70) - Fault",
  19. "01273": "Central Flap Potentiometer (G112) - Open/Short",
  20. "01274": "Air Flow Flap Positioning Motor (V71) - Fault",
  21. "01275": "Air Flow Flap Potentiometer (G113) - Open/Short",
  22. "01276": "Footwell/Defroster Flap Motor (V68) - Fault",
  23. "01277": "Footwell/Defroster Potentiometer (G114) - Open/Short",
  24. "01278": "Temp Regulator Flap Motor (V68) - Fault",
  25. "01279": "Temp Regulator Potentiometer (G92) - Open/Short",
  26. # === Compressor & Pressure ===
  27. "00816": "A/C Compressor Control - Open Circuit",
  28. "00817": "A/C Compressor Clutch (N25) - Short to Ground",
  29. "01206": "A/C Refrigerant Pressure Too High",
  30. "01207": "A/C Refrigerant Pressure Too Low",
  31. # === Blower & Electrical ===
  32. "00898": "Blower Motor Control (V2) - Open Circuit",
  33. "00899": "Blower Motor (V2) - Short to Ground",
  34. "00600": "Fresh Air Blower (V2) - Final Stage Fault",
  35. "01325": "Supply Voltage - Too Low",
  36. "01326": "Supply Voltage - Too High",
  37. # === Control Module ===
  38. "01330": "Climate Control Module - Internal Fault",
  39. "00668": "Supply Voltage Terminal 30 - Voltage Too Low",
  40. "65535": "Internal Control Module Memory Error",
  41. }
  42. ELABORATION_FLAGS = {
  43. 0x00: "No Further Info",
  44. 0x01: "Upper Limit Exceeded",
  45. 0x02: "Lower Limit Exceeded",
  46. 0x04: "No Signal",
  47. 0x08: "Implausible Signal",
  48. 0x10: "Currently Active",
  49. 0x20: "Not Currently Active",
  50. 0x40: "Intermittent",
  51. 0x80: "Not Tested / No Signal",
  52. }
  53. def decode_dtc(code_hi: int, code_lo: int, elaboration: int) -> dict:
  54. code_val = (code_hi << 8) | code_lo
  55. code_str = f"{code_val:05d}"
  56. desc = HVAC_DTC_DATABASE.get(code_str, f"Unknown Code {code_str} (Hex: {code_hi:02X} {code_lo:02X})")
  57. status_str = []
  58. # Simple check for active/intermittent based on elaboration flags
  59. is_active = False
  60. is_intermittent = False
  61. is_stored = True
  62. if elaboration & 0x10:
  63. is_active = True
  64. status_str.append("Currently Active")
  65. if elaboration & 0x40:
  66. is_intermittent = True
  67. status_str.append("Intermittent")
  68. if elaboration == 0x00:
  69. status_str.append("No Further Info")
  70. for mask, meaning in ELABORATION_FLAGS.items():
  71. if mask != 0x00 and mask != 0x10 and mask != 0x40 and (elaboration & mask):
  72. status_str.append(meaning)
  73. status = "Stored"
  74. if is_active:
  75. status = "Active"
  76. elif is_intermittent:
  77. status = "Intermittent"
  78. return {
  79. "code": code_str,
  80. "description": desc,
  81. "status": status,
  82. "details": ", ".join(status_str) if status_str else "Unknown Elaboration",
  83. "elaboration_hex": f"0x{elaboration:02X}"
  84. }