boardd always send can packet (#2307)
* boardd always send message * Only log missed cycles when ignition is on * Just clip, no completely different code pathspull/2297/head
parent
671183184b
commit
cfd16faad2
|
@ -43,6 +43,7 @@ volatile sig_atomic_t do_exit = 0;
|
|||
bool spoofing_started = false;
|
||||
bool fake_send = false;
|
||||
bool connected_once = false;
|
||||
bool ignition = false;
|
||||
|
||||
struct tm get_time(){
|
||||
time_t rawtime;
|
||||
|
@ -190,10 +191,8 @@ void can_recv(PubMaster &pm) {
|
|||
// create message
|
||||
MessageBuilder msg;
|
||||
auto event = msg.initEvent();
|
||||
int recv = panda->can_receive(event);
|
||||
if (recv){
|
||||
pm.send("can", msg);
|
||||
}
|
||||
panda->can_receive(event);
|
||||
pm.send("can", msg);
|
||||
}
|
||||
|
||||
void can_send_thread() {
|
||||
|
@ -254,7 +253,9 @@ void can_recv_thread() {
|
|||
useconds_t sleep = remaining / 1000;
|
||||
usleep(sleep);
|
||||
} else {
|
||||
LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining);
|
||||
if (ignition){
|
||||
LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining);
|
||||
}
|
||||
next_frame_time = cur_time;
|
||||
}
|
||||
|
||||
|
@ -295,7 +296,7 @@ void can_health_thread() {
|
|||
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) {
|
||||
no_ignition_cnt = 0;
|
||||
|
|
|
@ -321,10 +321,10 @@ int Panda::can_receive(cereal::Event::Builder &event){
|
|||
uint32_t data[RECV_SIZE/4];
|
||||
int recv = usb_bulk_read(0x81, (unsigned char*)data, RECV_SIZE);
|
||||
|
||||
// return if length is 0
|
||||
if (recv <= 0) {
|
||||
return 0;
|
||||
} else if (recv == RECV_SIZE) {
|
||||
// Not sure if this can happen
|
||||
if (recv < 0) recv = 0;
|
||||
|
||||
if (recv == RECV_SIZE) {
|
||||
LOGW("Receive buffer full");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue