|
|
@ -43,6 +43,7 @@ volatile sig_atomic_t do_exit = 0; |
|
|
|
bool spoofing_started = false; |
|
|
|
bool spoofing_started = false; |
|
|
|
bool fake_send = false; |
|
|
|
bool fake_send = false; |
|
|
|
bool connected_once = false; |
|
|
|
bool connected_once = false; |
|
|
|
|
|
|
|
bool ignition = false; |
|
|
|
|
|
|
|
|
|
|
|
struct tm get_time(){ |
|
|
|
struct tm get_time(){ |
|
|
|
time_t rawtime; |
|
|
|
time_t rawtime; |
|
|
@ -190,11 +191,9 @@ void can_recv(PubMaster &pm) { |
|
|
|
// create message
|
|
|
|
// create message
|
|
|
|
MessageBuilder msg; |
|
|
|
MessageBuilder msg; |
|
|
|
auto event = msg.initEvent(); |
|
|
|
auto event = msg.initEvent(); |
|
|
|
int recv = panda->can_receive(event); |
|
|
|
panda->can_receive(event); |
|
|
|
if (recv){ |
|
|
|
|
|
|
|
pm.send("can", msg); |
|
|
|
pm.send("can", msg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void can_send_thread() { |
|
|
|
void can_send_thread() { |
|
|
|
LOGD("start send thread"); |
|
|
|
LOGD("start send thread"); |
|
|
@ -254,7 +253,9 @@ void can_recv_thread() { |
|
|
|
useconds_t sleep = remaining / 1000; |
|
|
|
useconds_t sleep = remaining / 1000; |
|
|
|
usleep(sleep); |
|
|
|
usleep(sleep); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (ignition){ |
|
|
|
LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining); |
|
|
|
LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining); |
|
|
|
|
|
|
|
} |
|
|
|
next_frame_time = cur_time; |
|
|
|
next_frame_time = cur_time; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -295,7 +296,7 @@ void can_health_thread() { |
|
|
|
panda->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT); |
|
|
|
panda->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool ignition = ((health.ignition_line != 0) || (health.ignition_can != 0)); |
|
|
|
ignition = ((health.ignition_line != 0) || (health.ignition_can != 0)); |
|
|
|
|
|
|
|
|
|
|
|
if (ignition) { |
|
|
|
if (ignition) { |
|
|
|
no_ignition_cnt = 0; |
|
|
|
no_ignition_cnt = 0; |
|
|
|