  
      LOGW("connected to board");
  
      std::vector<std::thread> threads;
      threads.emplace_back(panda_state_thread, &pm, panda, getenv("STARTED") != nullptr);
      threads.emplace_back(can_send_thread, panda, getenv("FAKESEND") != nullptr);
      threads.emplace_back(can_recv_thread, panda);
      threads.emplace_back(hardware_control_thread, panda);
      threads.emplace_back(pigeon_thread, panda);
  
 
</s> remove     threads.emplace_back(hardware_control_thread, panda);
    threads.emplace_back(pigeon_thread, panda);
 </s> add  </s> remove #endif
 </s> add   } else {
    ps.setVoltage(pandaState.voltage);
    ps.setCurrent(pandaState.current);
  }

  uint16_t fan_speed_rpm = panda->get_fan_speed();
  ps.setUsbPowerMode(cereal::PeripheralState::UsbPowerMode(pandaState.usb_power_mode));
  ps.setFanSpeedRpm(fan_speed_rpm);

  pm->send("peripheralState", msg);
}

void panda_state_thread(PubMaster *pm, Panda * peripheral_panda, Panda *panda, bool spoofing_started) {
  Params params;
  bool ignition_last = false;

  LOGD("start panda state thread");

  // run at 2hz
  while (!do_exit && panda->connected) {
    send_peripheral_state(pm, peripheral_panda);
    ignition = send_panda_state(pm, panda, spoofing_started); </s> remove     if (ignition) {
      no_ignition_cnt = 0;
    } else {
      no_ignition_cnt += 1;
    }
 </s> add   // set safety mode to NO_OUTPUT when car is off. ELM327 is an alternative if we want to leverage athenad/connect
  if (!ignition && (pandaState.safety_model != (uint8_t)(cereal::CarParams::SafetyModel::NO_OUTPUT))) {
    panda->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT);
  }
#endif </s> remove     ignition = ((pandaState.ignition_line != 0) || (pandaState.ignition_can != 0));
 </s> add #ifndef __x86_64__
  bool power_save_desired = !ignition;
  if (pandaState.power_save_enabled != power_save_desired) {
    panda->set_power_saving(power_save_desired);
  }
    threads.emplace_back(panda_state_thread, &pm, peripheral_panda, panda, getenv("STARTED") != nullptr);
    threads.emplace_back(peripheral_control_thread, peripheral_panda);
    threads.emplace_back(pigeon_thread, peripheral_panda);

  
      LOGW("connected to board");
  
      std::vector<std::thread> threads;
    threads.emplace_back(panda_state_thread, &pm, peripheral_panda, panda, getenv("STARTED") != nullptr);
    threads.emplace_back(peripheral_control_thread, peripheral_panda);
    threads.emplace_back(pigeon_thread, peripheral_panda);

      threads.emplace_back(can_send_thread, panda, getenv("FAKESEND") != nullptr);
      threads.emplace_back(can_recv_thread, panda);
      threads.emplace_back(hardware_control_thread, panda);
      threads.emplace_back(pigeon_thread, panda);
  
keep keep keep keep replace keep keep keep keep keep
 Split pandaState into peripheralState and pandaState (#22385)

* publish peripheralState from boardd

* refactor consumers

* rename thread

* peripheralState has panda type too

* add to process replay

* fix device build

* properly remove hardware unsupported alert

* latest peripheralState

* remove pandaState from thermal_monitor

* put that back

* add back harness check

* fix cloudlog

* needs pandaState

* Update selfdrive/thermald/tests/test_power_monitoring.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* dont conflate

* Update selfdrive/thermald/tests/test_power_monitoring.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* pigeon is peripheral

* cleanup

* less global

* comment

* move rtc to peripheral_control_thread

* better diff?

* whitespace

* get msg

* bump cereal

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
selfdrive/boardd/boardd.cc