File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,13 @@ class HardwareTici : public HardwareNone {
26
26
}
27
27
28
28
static cereal::InitData::DeviceType get_device_type () {
29
- return (get_name () == " tizi" ) ? cereal::InitData::DeviceType::TIZI : (get_name () == " mici" ? cereal::InitData::DeviceType::MICI : cereal::InitData::DeviceType::TICI);
29
+ static const std::map<std::string, cereal::InitData::DeviceType> device_map = {
30
+ {" tici" , cereal::InitData::DeviceType::TICI},
31
+ {" tizi" , cereal::InitData::DeviceType::TIZI},
32
+ {" mici" , cereal::InitData::DeviceType::MICI}
33
+ };
34
+ auto it = device_map.find (get_name ());
35
+ return it != device_map.end () ? it->second : cereal::InitData::DeviceType::UNKNOWN;
30
36
}
31
37
32
38
static int get_voltage () { return std::atoi (util::read_file (" /sys/class/hwmon/hwmon1/in1_input" ).c_str ()); }
You can’t perform that action at this time.
0 commit comments