diff --git a/selfdrive/ui/sunnypilot/ui.cc b/selfdrive/ui/sunnypilot/ui.cc index 592e20b387..7460a7acf7 100644 --- a/selfdrive/ui/sunnypilot/ui.cc +++ b/selfdrive/ui/sunnypilot/ui.cc @@ -293,21 +293,7 @@ DeviceSP::DeviceSP(QObject *parent) : Device(parent){ //todo: revisit this void DeviceSP::updateBrightness(const UIStateSP &s) { - float clipped_brightness = offroad_brightness; - if (s.scene.started && s.scene.light_sensor > 0) { - clipped_brightness = s.scene.light_sensor; - - // CIE 1931 - https://www.photonstophotos.net/GeneralTopics/Exposure/Psychometric_Lightness_and_Gamma.htm - if (clipped_brightness <= 8) { - clipped_brightness = (clipped_brightness / 903.3); - } else { - clipped_brightness = std::pow((clipped_brightness + 16.0) / 116.0, 3.0); - } - - // Scale back to 10% to 100% - clipped_brightness = std::clamp(100.0f * clipped_brightness, 10.0f, 100.0f); - } - + Device::updateBrightness(s); int brightness = brightness_filter.update(clipped_brightness); if (!awake) { brightness = 0; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 43bec276ae..5d6b6c5722 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -339,7 +339,8 @@ void Device::updateBrightness(const UIState &s) { // Scale back to 10% to 100% clipped_brightness = std::clamp(100.0f * clipped_brightness, 10.0f, 100.0f); } - + RETURN_IF_SUNNYPILOT + int brightness = brightness_filter.update(clipped_brightness); if (!awake) { brightness = 0;