Files
CANveyor/vehicle/komatsu.py
T
eeeck 7da427dd09 Implement a modular vehicle decoding system
- Add Komatsu specific rules
- Possibility to expand to any brand
2026-07-23 00:34:18 +02:00

41 lines
1.1 KiB
Python

# File: vehicle/komatsu.py
# Copyright (C) 2026 Erick Ahmed
# SPDX-License-Identifier: AGPL-3.0-or-later
from vehicle.base import (
SignalDef, FrameDef, normalize_id, decode_dataframe as _decode_dataframe, plot_signal
)
DECODER_RULES = {
normalize_id("0x011F"): FrameDef(
can_id="0x011F",
description="Engine ECM Main Broadcast",
signals=[
SignalDef(
name="Engine RPM (b0:b1)",
bit_start=0,
bit_length=16,
factor=0.125,
offset=0.0,
is_signed=False,
byte_order="big",
unit="RPM",
),
SignalDef(
name="Pressure / Load (b3:b2)",
bit_start=16,
bit_length=16,
factor=1.0,
offset=0.0,
is_signed=False,
byte_order="little",
unit="raw",
),
],
),
}
def decode_dataframe(df, can_id):
return _decode_dataframe(df, can_id, DECODER_RULES)