mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 15:32:07 +08:00
Don't re-init pigeon while offroad (#2687)
* don't re-init pigeon while offroad * we don't need this
This commit is contained in:
@@ -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,27 @@ void pigeon_thread() {
|
||||
Pigeon * pigeon = Pigeon::connect(panda);
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user