IQ.Pilot Release Commit @ b581b58

This commit is contained in:
IQ.Lvbs CI [bot]
2026-07-21 17:51:52 -05:00
parent 78fc163202
commit ccb06b3624
125 changed files with 1991 additions and 6182 deletions

View File

@@ -20,9 +20,6 @@ else:
if os.getenv("DEBUG"):
common_flags += ["-DDEBUG"]
def objcopy(source, target, env, for_signature):
return '$OBJCOPY -O binary %s %s' % (source[0], target[0])
def get_version(builder, build_type):
try:
git = subprocess.check_output(["git", "rev-parse", "--short=8", "HEAD"], encoding='utf8').strip()
@@ -92,12 +89,20 @@ def build_project(project_name, project, main, extra_flags):
LINKFLAGS=flags,
CPPPATH=[Dir("./"), "./board/stm32f4/inc", "./board/stm32h7/inc", iqdbc.INCLUDE_PATH],
ASCOM="$AS $ASFLAGS -o $TARGET -c $SOURCES",
BUILDERS={
'Objcopy': Builder(generator=objcopy, suffix='.bin', src_suffix='.elf')
},
tools=["default", "compilation_db"],
)
# short colored build output shared with the top-level build (if present)
_pretty = Dir('#site_scons/site_tools').File('pretty.py')
if _pretty.exists():
env.Tool('pretty', toolpath=[_pretty.dir.abspath])
if not hasattr(env, 'PrettyAction'):
env.AddMethod(lambda e, cmd, label, **kw: Action(cmd), 'PrettyAction')
env.Append(BUILDERS={
'Objcopy': Builder(action=env.PrettyAction('$OBJCOPY -O binary $SOURCE $TARGET', 'OBJCOPY'),
suffix='.bin', src_suffix='.elf')
})
startup = env.Object(project["STARTUP_FILE"])
# Build bootstub
@@ -118,7 +123,8 @@ def build_project(project_name, project, main, extra_flags):
], LINKFLAGS=[f"-Wl,--section-start,.isr_vector={project['APP_START_ADDRESS']}"] + flags)
main_bin = env.Objcopy(f"{project_dir}/main.bin", main_elf)
sign_py = File(f"./crypto/sign.py").srcnode().relpath
env.Command(f"./board/obj/{project_name}.bin.signed", main_bin, f"SETLEN=1 {sign_py} $SOURCE $TARGET {cert_fn}")
env.Command(f"./board/obj/{project_name}.bin.signed", main_bin,
env.PrettyAction(f"SETLEN=1 {sign_py} $SOURCE $TARGET {cert_fn}", 'SIGN', logfile='/dev/null'))

View File

@@ -138,9 +138,11 @@ bus_config_t bus_config[PANDA_CAN_CNT] = {
void can_init_all(void) {
for (uint8_t i=0U; i < PANDA_CAN_CNT; i++) {
bus_config[i].canfd_enabled = false;
// Preserve can_data_speed (default 20000U = 2Mbps) through safety model changes.
// Auto-detection in can_rx() sets canfd_enabled=true when the first FD frame arrives;
// keeping data speed nonzero lets the FDCAN peripheral handle FD frames immediately.
// NOTE: do NOT reset can_data_speed here. Matching stock panda, can_init_all() only clears
// canfd_enabled (re-discovered on RX via canfd_auto). The old "#ifndef CANFD: can_data_speed = 0U"
// fired on every board because CANFD is never defined, zeroing the FD data-phase bitrate on every
// set_safety_model() -> CAN-FD frames then failed with form/stuff errors and never re-enabled,
// breaking all CAN-FD cars (e.g. Kia EV6) after fingerprinting. can_data_speed is only used by fdcan.
can_clear(can_queues[i]);
(void)can_init(i);
}
@@ -169,6 +171,7 @@ void ignition_can_hook(CANPacket_t *msg) {
static int tesla_gear = TESLA_DI_GEAR_P;
static int toyota_gear = TOYOTA_GEAR_P;
static int toyota_hybrid_gear = TOYOTA_HYBRID_GEAR_P;
static bool toyota_hybrid_gear_seen = false;
// GM exception
if ((msg->addr == 0x1F1U) && (len == 8)) {
@@ -218,8 +221,10 @@ void ignition_can_hook(CANPacket_t *msg) {
ignition_can_cnt = 0U;
}
// Toyota/Lexus exception
if ((msg->addr == 0x3BCU) && (len == 8)) {
// Toyota/Lexus exception. SecOC hybrids (e.g. Sienna 4th gen) report gear on
// GEAR_PACKET_HYBRID (0x127); their GEAR_PACKET (0x3BC) does not read Park, so once
// the hybrid gear packet is seen, don't let 0x3BC override it (Park -> ignition off).
if ((msg->addr == 0x3BCU) && (len == 8) && !toyota_hybrid_gear_seen) {
int gear = msg->data[1] & 0x3FU;
if ((gear == 0) || (gear == 1) || (gear == 8) || (gear == 16) || (gear == 32)) {
toyota_gear = gear;
@@ -231,6 +236,7 @@ void ignition_can_hook(CANPacket_t *msg) {
if ((msg->addr == 0x127U) && (len == 8)) {
int gear = (msg->data[5] >> 4U) & 0xFU;
if (gear <= 4) {
toyota_hybrid_gear_seen = true;
toyota_hybrid_gear = gear;
ignition_can = toyota_hybrid_gear != TOYOTA_HYBRID_GEAR_P;
ignition_can_cnt = 0U;
@@ -239,16 +245,6 @@ void ignition_can_hook(CANPacket_t *msg) {
}
// Volkswagen MEB / MQBevo exception (Klemmen_Status_01)
// On gateway harness cars this message is on bus 1 (powertrain CAN), not bus 0.
if ((msg->bus == 0U) || (msg->bus == 1U)) {
int len = GET_LEN(msg);
if ((msg->addr == 0x3C0U) && (len == 4)) {
ignition_can = ((msg->data[2] >> 1U) & 1U) != 0U;
ignition_can_cnt = 0U;
}
}
}
bool can_tx_check_min_slots_free(uint32_t min) {

View File

@@ -13,7 +13,7 @@ classifiers = [
]
dependencies = [
"libusb1",
"iqdbc @ git+https://gitlvb.teallvbs.xyz/teal/iqdbc.git@master#egg=iqdbc",
"iqdbc @ git+https://git.konn3kt.com/teal/iqdbc.git@master#egg=iqdbc",
]
[project.optional-dependencies]

View File

@@ -26,6 +26,11 @@ env = Environment(
if system == "Darwin":
env.PrependENVPath('PATH', '/opt/homebrew/bin')
# short colored build output, if the top-level pretty tool is present (main-repo build)
_pretty = Dir('#site_scons/site_tools').File('pretty.py')
if _pretty.exists():
env.Tool('pretty', toolpath=[_pretty.dir.abspath])
if GetOption('ubsan'):
flags = [
"-fsanitize=undefined",