mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-21 09:12:25 +08:00
683b6151ce
4f82d01e gitignore 5cb83454 Honda FCM: diagnostic signals d309cdce Added linter to opendbc (#203) d452706f add requirements.txt ec3b4595 deterministic dependency order a265d351 Azure pipelines ci (#202) bce9a2e1 packer depends on libdbc 5d5fdd6a no more python version of libdbc, everything through cython 541705bf move CANDefine to parser code da25c52a add test for can define 0ba7926b unify can packer and parser 25d88009 consistent naming a5c640a5 fix linter be210fef remove obsolete make file ffd9dca7 opendbc needs cereal b559f63d remove more make d0929496 seems to work now 41e80836 don't make 3254d1fc think scons works eb78f6aa scons sort of working 0ef1e35d fix gitignore e155e017 Can migration (#199) 3eded83a Honda: correct steering torque sensor sign to be consistent with standard convention (left+) 32f70e2f Fix outback endianness consistency (#196) a7da471f Update subaru_outback_2015_eyesight.dbc (#195) git-subtree-dir: opendbc git-subtree-split: 4f82d01ebc78109888954d9807d320e3c27896fd
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
#include "common_dbc.h"
|
|
|
|
namespace {
|
|
|
|
{% for address, msg_name, msg_size, sigs in msgs %}
|
|
const Signal sigs_{{address}}[] = {
|
|
{% for sig in sigs %}
|
|
{
|
|
{% if sig.is_little_endian %}
|
|
{% set b1 = sig.start_bit %}
|
|
{% else %}
|
|
{% set b1 = (sig.start_bit//8)*8 + (-sig.start_bit-1) % 8 %}
|
|
{% endif %}
|
|
.name = "{{sig.name}}",
|
|
.b1 = {{b1}},
|
|
.b2 = {{sig.size}},
|
|
.bo = {{64 - (b1 + sig.size)}},
|
|
.is_signed = {{"true" if sig.is_signed else "false"}},
|
|
.factor = {{sig.factor}},
|
|
.offset = {{sig.offset}},
|
|
.is_little_endian = {{"true" if sig.is_little_endian else "false"}},
|
|
{% if checksum_type == "honda" and sig.name == "CHECKSUM" %}
|
|
.type = SignalType::HONDA_CHECKSUM,
|
|
{% elif checksum_type == "honda" and sig.name == "COUNTER" %}
|
|
.type = SignalType::HONDA_COUNTER,
|
|
{% elif checksum_type == "toyota" and sig.name == "CHECKSUM" %}
|
|
.type = SignalType::TOYOTA_CHECKSUM,
|
|
{% elif checksum_type == "volkswagen" and sig.name == "CHECKSUM" %}
|
|
.type = SignalType::VOLKSWAGEN_CHECKSUM,
|
|
{% elif checksum_type == "volkswagen" and sig.name == "COUNTER" %}
|
|
.type = SignalType::VOLKSWAGEN_COUNTER,
|
|
{% elif address in [512, 513] and sig.name == "CHECKSUM_PEDAL" %}
|
|
.type = SignalType::PEDAL_CHECKSUM,
|
|
{% elif address in [512, 513] and sig.name == "COUNTER_PEDAL" %}
|
|
.type = SignalType::PEDAL_COUNTER,
|
|
{% else %}
|
|
.type = SignalType::DEFAULT,
|
|
{% endif %}
|
|
},
|
|
{% endfor %}
|
|
};
|
|
{% endfor %}
|
|
|
|
const Msg msgs[] = {
|
|
{% for address, msg_name, msg_size, sigs in msgs %}
|
|
{% set address_hex = "0x%X" % address %}
|
|
{
|
|
.name = "{{msg_name}}",
|
|
.address = {{address_hex}},
|
|
.size = {{msg_size}},
|
|
.num_sigs = ARRAYSIZE(sigs_{{address}}),
|
|
.sigs = sigs_{{address}},
|
|
},
|
|
{% endfor %}
|
|
};
|
|
|
|
const Val vals[] = {
|
|
{% for address, sig in def_vals %}
|
|
{% for sg_name, def_val in sig %}
|
|
{% set address_hex = "0x%X" % address %}
|
|
{
|
|
.name = "{{sg_name}}",
|
|
.address = {{address_hex}},
|
|
.def_val = {{def_val}},
|
|
.sigs = sigs_{{address}},
|
|
},
|
|
{% endfor %}
|
|
{% endfor %}
|
|
};
|
|
|
|
}
|
|
|
|
const DBC {{dbc.name}} = {
|
|
.name = "{{dbc.name}}",
|
|
.num_msgs = ARRAYSIZE(msgs),
|
|
.msgs = msgs,
|
|
.vals = vals,
|
|
.num_vals = ARRAYSIZE(vals),
|
|
};
|
|
|
|
dbc_init({{dbc.name}})
|