can't do this either, boardd might read Enabled after removing, but before setting new Request param

pull/27656/head
Shane Smiskol 2 years ago
parent b01f91ab26
commit 89e7d21f4c
  1. 17
      selfdrive/boardd/boardd.cc
  2. 15
      selfdrive/car/fw_versions.py

@ -113,11 +113,11 @@ bool safety_setter_thread(std::vector<Panda *> pandas) {
return false;
}
// set to ELM327 with OBD multiplexing for fingerprinting
p.putBool("ObdMultiplexingEnabled", true);
// set to ELM327 without OBD multiplexing for fingerprinting
p.putBool("ObdMultiplexingEnabled", false);
for (int i = 0; i < pandas.size(); i++) {
// const uint16_t safety_param = (i > 0) ? 1U : 0U;
pandas[i]->set_safety_model(cereal::CarParams::SafetyModel::ELM327, 0U);
pandas[i]->set_safety_model(cereal::CarParams::SafetyModel::ELM327, 1U);
}
// openpilot can switch between multiplexing modes for different FW queries,
@ -127,14 +127,15 @@ bool safety_setter_thread(std::vector<Panda *> pandas) {
return false;
}
// bool obd_multiplexing_requested = p.getBool("ObdMultiplexingRequested");
std::string obd_multiplexing_requested = p.get("ObdMultiplexingRequested");
if (!obd_multiplexing_requested.isEmpty()) {
const uint16_t safety_param = obd_multiplexing_requested == "1" ? 0U : 1U;
bool obd_multiplexing_requested = p.getBool("ObdMultiplexingRequested");
// std::string obd_multiplexing_requested = p.get("ObdMultiplexingRequested");
// if (!obd_multiplexing_requested.isEmpty()) {
if (obd_multiplexing_requested != p.getBool("ObdMultiplexingEnabled")) {
const uint16_t safety_param = obd_multiplexing_requested ? 0U : 1U;
for (int i = 0; i < pandas.size(); i++) {
pandas[i]->set_safety_model(cereal::CarParams::SafetyModel::ELM327, safety_param);
}
p.remove("ObdMultiplexingRequested", obd_multiplexing_requested);
// p.remove("ObdMultiplexingRequested", obd_multiplexing_requested);
p.putBool("ObdMultiplexingEnabled", obd_multiplexing_requested);
}

@ -233,13 +233,14 @@ def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, num_pand
return all_car_fw
def set_obd_multiplexing(params, obd_multiplexing):
cloudlog.warning(f"Setting OBD multiplexing: {obd_multiplexing}")
# Remove response param that boardd writes to block on it
params.remove("ObdMultiplexingEnabled")
params.put_bool("ObdMultiplexingRequested", obd_multiplexing)
params.get_bool("ObdMultiplexingEnabled", block=True)
cloudlog.warning(f"OBD multiplexing set successfully")
def set_obd_multiplexing(params: Params, obd_multiplexing: bool):
if params.get_bool("ObdMultiplexingEnabled") != obd_multiplexing:
cloudlog.warning(f"Setting OBD multiplexing to {obd_multiplexing}")
# Remove response param that boardd writes to block on it
params.remove("ObdMultiplexingEnabled")
params.put_bool("ObdMultiplexingRequested", obd_multiplexing)
params.get_bool("ObdMultiplexingEnabled", block=True)
cloudlog.warning(f"OBD multiplexing set successfully")
def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, num_pandas=1, obd_multiplexed=True, debug=False, progress=False):

Loading…
Cancel
Save