From 92beda6d15e1fc96e9e435a013d4706177e999ec Mon Sep 17 00:00:00 2001 From: Robbe Derks Date: Thu, 3 Dec 2020 17:02:18 +0100 Subject: [PATCH] don't re-init pigeon while offroad --- selfdrive/boardd/boardd.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 1033c082567ba97..21abaa8e88707bf 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -474,6 +474,7 @@ void pigeon_thread() { // ubloxRaw = 8042 PubMaster pm({"ubloxRaw"}); + bool ignition_last = false; #ifdef QCOM2 Pigeon * pigeon = Pigeon::connect("/dev/ttyHS0"); @@ -481,19 +482,31 @@ void pigeon_thread() { 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); }