Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C2 detection #23439

Merged
merged 4 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ int main(int argc, char *argv[]) {
Panda *peripheral_panda = pandas[0];
std::vector<std::thread> threads;

Params().put("LastPeripheralPandaType", std::to_string((int) peripheral_panda->get_hw_type()));

threads.emplace_back(panda_state_thread, &pm, pandas, getenv("STARTED") != nullptr);
threads.emplace_back(peripheral_control_thread, peripheral_panda);
threads.emplace_back(pigeon_thread, peripheral_panda);
Expand Down
1 change: 1 addition & 0 deletions selfdrive/common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"JoystickDebugMode", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF},
{"LastAthenaPingTime", CLEAR_ON_MANAGER_START},
{"LastGPSPosition", PERSISTENT},
{"LastPeripheralPandaType", PERSISTENT},
{"LastPowerDropDetected", CLEAR_ON_MANAGER_START},
{"LastUpdateException", PERSISTENT},
{"LastUpdateTime", PERSISTENT},
Expand Down
11 changes: 11 additions & 0 deletions selfdrive/hardware/eon/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
from cereal import log
from selfdrive.hardware.base import HardwareBase, ThermalConfig

try:
from common.params import Params
except Exception:
# openpilot is not built yet
Params = None

NetworkType = log.DeviceState.NetworkType
NetworkStrength = log.DeviceState.NetworkStrength

Expand Down Expand Up @@ -70,6 +76,11 @@ def get_os_version(self):
return f.read().strip()

def get_device_type(self):
try:
if int(Params().get("LastPeripheralPandaType")) == log.PandaState.PandaType.uno:
return "two"
except Exception:
pass
return "eon"

def get_sound_card_online(self):
Expand Down