From 5803fa30741ed0d99ca24d6872eaa2091b5cce63 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 30 Jan 2023 23:22:06 -0800 Subject: [PATCH] ign in a loop --- selfdrive/boardd/boardd.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 5ef49d4b22..83871f6d6f 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -462,14 +462,20 @@ void panda_state_thread(PubMaster *pm, std::vector pandas, bool spoofin std::future safety_future; LOGD("start panda state thread"); + int i = 0; + int on_t = 15; + int off_t = 5; // run at 2hz while (!do_exit && check_all_connected(pandas)) { + i += 1; uint64_t start_time = nanos_since_boot(); + bool _spoofing_started = i % ((on_t + off_t) * 2) >= off_t * 2 + // send out peripheralState send_peripheral_state(pm, peripheral_panda); - auto ignition_opt = send_panda_states(pm, pandas, spoofing_started); + auto ignition_opt = send_panda_states(pm, pandas, _spoofing_started); if (!ignition_opt) { continue;