pigeon_thread: ensure the pigeon->init() will not be called twice (#19963)

* ensure init is not called twice

* add space
pull/19738/head
Dean Lee 4 years ago committed by GitHub
parent b0c8ce4863
commit 3fde3a5f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      selfdrive/boardd/boardd.cc

@ -463,7 +463,7 @@ static void pigeon_publish_raw(PubMaster &pm, const std::string &dat) {
}
void pigeon_thread() {
if (!panda->is_pigeon){ return; };
if (!panda->is_pigeon) { return; };
// ubloxRaw = 8042
PubMaster pm({"ubloxRaw"});
@ -476,12 +476,13 @@ void pigeon_thread() {
#endif
while (!do_exit && panda->connected) {
bool need_reset = false;
std::string recv = pigeon->receive();
if (recv.length() > 0) {
if (recv[0] == (char)0x00){
if (ignition) {
LOGW("received invalid ublox message while onroad, resetting panda GPS");
pigeon->init();
need_reset = true;
}
} else {
pigeon_publish_raw(pm, recv);
@ -490,7 +491,7 @@ void pigeon_thread() {
// init pigeon on rising ignition edge
// since it was turned off in low power mode
if(ignition && !ignition_last) {
if((ignition && !ignition_last) || need_reset) {
pigeon->init();
}

Loading…
Cancel
Save