diff --git a/selfdrive/hardware/tici/hardware.py b/selfdrive/hardware/tici/hardware.py index 0ae58ce549..72741e5a99 100644 --- a/selfdrive/hardware/tici/hardware.py +++ b/selfdrive/hardware/tici/hardware.py @@ -185,5 +185,8 @@ class Tici(HardwareBase): return ThermalConfig(cpu=((1, 2, 3, 4, 5, 6, 7, 8), 1000), gpu=((48,49), 1000), mem=(15, 1000), bat=(None, 1), ambient=(65, 1000)) def set_screen_brightness(self, percentage): - with open("/sys/class/backlight/panel0-backlight/brightness", "w") as f: - f.write(str(percentage * 10.23)) + try: + with open("/sys/class/backlight/panel0-backlight/brightness", "w") as f: + f.write(str(percentage * 10.23)) + except Exception: + pass diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 3c82c8e6cf..df3e8e4e9d 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -2,6 +2,8 @@ #include #include #include +#include + #include #include @@ -164,7 +166,7 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) { Params().write_db_value("IsDriverViewEnabled", "0", 1); return; } - + glWindow->wake(); // Settings button click @@ -191,10 +193,14 @@ static void handle_display_state(UIState* s, bool user_input) { } static void set_backlight(int brightness) { - std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); - if (brightness_control.is_open()) { - brightness_control << brightness << "\n"; - brightness_control.close(); + try { + std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); + if (brightness_control.is_open()) { + brightness_control << brightness << "\n"; + brightness_control.close(); + } + } catch (std::exception& e) { + qDebug() << "Error setting brightness"; } }