From 4d6584a315f172b62463ad64393624f81d61066a Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sun, 31 Jan 2021 07:02:03 +0800 Subject: [PATCH] boardd: remove global variables spoofing_started&fake_send (#19966) --- selfdrive/boardd/boardd.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index e000a764..74fe5cef 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -39,8 +39,6 @@ Panda * panda = NULL; std::atomic safety_setter_thread_running(false); std::atomic ignition(false); -bool spoofing_started = false; -bool fake_send = false; bool connected_once = false; ExitHandler do_exit; @@ -194,7 +192,7 @@ void can_recv(PubMaster &pm) { pm.send("can", bytes.begin(), bytes.size()); } -void can_send_thread() { +void can_send_thread(bool fake_send) { LOGD("start send thread"); Context * context = Context::create(); @@ -261,7 +259,7 @@ void can_recv_thread() { } } -void can_health_thread() { +void can_health_thread(bool spoofing_started) { LOGD("start health thread"); PubMaster pm({"health"}); @@ -517,25 +515,16 @@ int main() { err = set_core_affinity(3); LOG("set affinity returns %d", err); - // check the environment - if (getenv("STARTED")) { - spoofing_started = true; - } - - if (getenv("FAKESEND")) { - fake_send = true; - } - panda_set_power(true); while (!do_exit){ std::vector threads; - threads.push_back(std::thread(can_health_thread)); + threads.push_back(std::thread(can_health_thread, getenv("STARTED") != nullptr)); // connect to the board usb_retry_connect(); - threads.push_back(std::thread(can_send_thread)); + threads.push_back(std::thread(can_send_thread, getenv("FAKESEND") != nullptr)); threads.push_back(std::thread(can_recv_thread)); threads.push_back(std::thread(hardware_control_thread)); threads.push_back(std::thread(pigeon_thread));