|
|
|
@ -4,6 +4,7 @@ |
|
|
|
|
#include <fstream> |
|
|
|
|
#include <map> |
|
|
|
|
#include <string> |
|
|
|
|
#include <algorithm> // for std::clamp |
|
|
|
|
|
|
|
|
|
#include "common/params.h" |
|
|
|
|
#include "common/util.h" |
|
|
|
@ -68,6 +69,28 @@ public: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void set_ir_power(int percent) { |
|
|
|
|
auto device = get_device_type(); |
|
|
|
|
if (device == cereal::InitData::DeviceType::TICI || |
|
|
|
|
device == cereal::InitData::DeviceType::TIZI) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
percent = std::clamp(percent, 0, 100); |
|
|
|
|
|
|
|
|
|
std::ofstream torch_brightness("/sys/class/leds/led:torch_2/brightness"); |
|
|
|
|
if (torch_brightness.is_open()) { |
|
|
|
|
torch_brightness << percent << "\n"; |
|
|
|
|
torch_brightness.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::ofstream switch_brightness("/sys/class/leds/led:switch_2/brightness"); |
|
|
|
|
if (switch_brightness.is_open()) { |
|
|
|
|
switch_brightness << percent << "\n"; |
|
|
|
|
switch_brightness.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static std::map<std::string, std::string> get_init_logs() { |
|
|
|
|
std::map<std::string, std::string> ret = { |
|
|
|
|
{"/BUILD", util::read_file("/BUILD")}, |
|
|
|
|