Tesla - Wake on CAN

This commit is contained in:
2026-09-03 14:48:51 +02:00
parent 7745f48100
commit d99789b487
3 changed files with 18 additions and 1 deletions

View File

@@ -11,6 +11,10 @@ can_health_t can_health[PANDA_CAN_CNT] = {{0}, {0}, {0}};
bool ignition_can = false;
uint32_t ignition_can_cnt = 0U;
// Wake (bootkick) the device from CAN messages, without engaging ignition
bool wake_on_can = false;
uint32_t wake_on_can_cnt = 0U;
// set only once a Toyota SecOC hybrid gear source is positively identified: those cars keep
// the harness ignition line live in Park, so the reported line has to follow the gear instead
bool ignition_can_gates_line = false;
@@ -229,6 +233,10 @@ void ignition_can_hook(CANPacket_t *msg) {
bool tesla_in_park = !tesla_gear_seen || (tesla_gear == TESLA_DI_GEAR_P);
ignition_can = (power_state == 0x3) && !tesla_in_park; // VEHICLE_POWER_STATE_DRIVE=3
ignition_can_cnt = 0U;
// Also bootkick the device on any non-OFF LV power state (e.g. Tesla
// app wake / preconditioning), so sunnypilot is loaded before driving
wake_on_can = power_state != 0x0; // not VEHICLE_POWER_STATE_OFF
wake_on_can_cnt = 0U;
}
prev_counter_tesla = counter;
}