mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-21 04:42:33 +08:00
ui: fix brightness when there's no camera (#32413)
This commit is contained in:
+3
-1
@@ -205,6 +205,8 @@ static void update_state(UIState *s) {
|
||||
auto cam_state = sm["wideRoadCameraState"].getWideRoadCameraState();
|
||||
float scale = (cam_state.getSensor() == cereal::FrameData::ImageSensor::AR0231) ? 6.0f : 1.0f;
|
||||
scene.light_sensor = std::max(100.0f - scale * cam_state.getExposureValPercent(), 0.0f);
|
||||
} else if (!sm.allAliveAndValid({"wideRoadCameraState"})) {
|
||||
scene.light_sensor = -1;
|
||||
}
|
||||
scene.started = sm["deviceState"].getDeviceState().getStarted() && scene.ignition;
|
||||
|
||||
@@ -320,7 +322,7 @@ void Device::resetInteractiveTimeout(int timeout) {
|
||||
|
||||
void Device::updateBrightness(const UIState &s) {
|
||||
float clipped_brightness = offroad_brightness;
|
||||
if (s.scene.started) {
|
||||
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
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ typedef struct UIScene {
|
||||
|
||||
cereal::LongitudinalPersonality personality;
|
||||
|
||||
float light_sensor;
|
||||
float light_sensor = -1;
|
||||
bool started, ignition, is_metric, map_on_left, longitudinal_control;
|
||||
bool world_objects_visible = false;
|
||||
uint64_t started_frame;
|
||||
|
||||
Reference in New Issue
Block a user