添加无线模块
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
The ZLG SDK accepting a transmit request is not evidence that an ECU acted.
|
||||
This module contains the small, byte-exact subset of CAN_DEV feedback that the
|
||||
web console is allowed to present as physical state.
|
||||
web console is allowed to present as physical state. CH1 signal definitions
|
||||
come from ``project-code/canfd/CAN矩阵表_filled.xlsx`` Sheet1; decoded
|
||||
summaries embedded in an MQTT envelope are never used here.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -294,8 +296,43 @@ def decode_feedback(frame: CanFrame) -> dict[str, Any]:
|
||||
"rear_brightness_level": (
|
||||
rear_brightness_raw - 1 if 1 <= rear_brightness_raw <= 6 else None
|
||||
),
|
||||
"front_color_index": front_color,
|
||||
"rear_color_index": rear_color,
|
||||
# Sheet1 rows 1896-1897 define 0x01-0x1F as colors and
|
||||
# 0x20-0x7F as reserved. Do not expose a reserved raw value
|
||||
# as though it were a real cabin color.
|
||||
"front_color_index": (
|
||||
front_color if 1 <= front_color <= 0x1F else None
|
||||
),
|
||||
"rear_color_index": (
|
||||
rear_color if 1 <= rear_color <= 0x1F else None
|
||||
),
|
||||
},
|
||||
}
|
||||
return decoded
|
||||
|
||||
if frame.arbitration_id == 0x3FF and len(data) >= 8:
|
||||
# CAN矩阵表_filled.xlsx Sheet1 rows 169, 172 and 173. The
|
||||
# illuminance signal reserves 0x3FE and uses 0x3FF as its initial
|
||||
# value, so only the explicitly valid 0x000-0x3FD range is physical.
|
||||
illuminance_raw = _bits(data, 46, 10)
|
||||
decoded["domain_state"] = {
|
||||
"interior_light": {
|
||||
"power": _state(_bits(data, 28, 2)),
|
||||
"footwell_power": _state(_bits(data, 35, 2)),
|
||||
"ambient_illuminance_lux": (
|
||||
illuminance_raw * 30 if illuminance_raw <= 0x3FD else None
|
||||
),
|
||||
}
|
||||
}
|
||||
return decoded
|
||||
|
||||
if frame.arbitration_id == 0x3F3 and len(data) >= 8:
|
||||
# CAN矩阵表_filled.xlsx Sheet1 rows 2336 and 2338.
|
||||
decoded["domain_state"] = {
|
||||
"interior_light": {
|
||||
"wall_light_power": _state(_bits(data, 58, 2)),
|
||||
},
|
||||
"ambient_light": {
|
||||
"power": _state(_bits(data, 62, 2), on=2, off=1),
|
||||
},
|
||||
}
|
||||
return decoded
|
||||
|
||||
Reference in New Issue
Block a user