Skip to content

Commit

Permalink
don't re-init pigeon while offroad
Browse files Browse the repository at this point in the history
  • Loading branch information
robbederks committed Dec 3, 2020
1 parent 4836617 commit 92beda6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,26 +474,39 @@ void pigeon_thread() {

// ubloxRaw = 8042
PubMaster pm({"ubloxRaw"});
bool ignition_last = false;

#ifdef QCOM2
Pigeon * pigeon = Pigeon::connect("/dev/ttyHS0");
#else
Pigeon * pigeon = Pigeon::connect(panda);
#endif

pigeon->init();
if (ignition) {
pigeon->init();
}

while (!do_exit && panda->connected) {
std::string recv = pigeon->receive();
if (recv.length() > 0) {
if (recv[0] == (char)0x00){
LOGW("received invalid ublox message, resetting panda GPS");
pigeon->init();
if (ignition) {
LOGW("received invalid ublox message while onroad, resetting panda GPS");
pigeon->init();
}
} else {
pigeon_publish_raw(pm, recv);
}
}

// init pigeon on rising ignition edge
// since it was turned off in low power mode
if(ignition && !ignition_last) {
pigeon->init();
}

ignition_last = ignition;

// 10ms - 100 Hz
usleep(10*1000);
}
Expand Down

0 comments on commit 92beda6

Please sign in to comment.