C2 detection (#23439)

* two detection

* fix CI

* catch all

* gotta catch em all
pull/23480/head
Robbe Derks 2022-01-10 13:13:52 +01:00 committed by GitHub
parent 67af095692
commit 842ba8e5e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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},

View File

@ -10,6 +10,12 @@ from typing import List, Union
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
@ -70,6 +76,11 @@ class Android(HardwareBase):
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):