Skip to content

Commit

Permalink
tici: fix device types (commaai#34269)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh authored Dec 17, 2024
1 parent 3da346e commit e317485
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/hardware/tici/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ class HardwareTici : public HardwareNone {
}

static cereal::InitData::DeviceType get_device_type() {
return (get_name() == "tizi") ? cereal::InitData::DeviceType::TIZI : (get_name() == "mici" ? cereal::InitData::DeviceType::MICI : cereal::InitData::DeviceType::TICI);
static const std::map<std::string, cereal::InitData::DeviceType> device_map = {
{"tici", cereal::InitData::DeviceType::TICI},
{"tizi", cereal::InitData::DeviceType::TIZI},
{"mici", cereal::InitData::DeviceType::MICI}
};
auto it = device_map.find(get_name());
return it != device_map.end() ? it->second : cereal::InitData::DeviceType::UNKNOWN;
}

static int get_voltage() { return std::atoi(util::read_file("/sys/class/hwmon/hwmon1/in1_input").c_str()); }
Expand Down

0 comments on commit e317485

Please sign in to comment.