Skip to content

Commit 2ae1b77

Browse files
committed
Revert "fw/services/light: linearly ramp dynamic backlight intensity"
This reverts commit c425825. Signed-off-by: Joshua Jun <lets@throw.rocks>
1 parent e235267 commit 2ae1b77

1 file changed

Lines changed: 5 additions & 23 deletions

File tree

src/fw/services/light/service.c

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -148,33 +148,15 @@ static uint8_t prv_backlight_get_intensity(void) {
148148
}
149149

150150
#if defined(CONFIG_DYNAMIC_BACKLIGHT) && !defined(RECOVERY_FW)
151-
// Dynamic backlight: linear ramp from dim_intensity at dynamic_min_threshold
152-
// up to 100% at ambient_light_dark_threshold, then clamped to user_max. This
153-
// keeps the slope independent of the user's brightness preference, so a user
154-
// who caps their max at e.g. 60% still hits that cap partway up the ALS range
155-
// rather than only at the brightest end. prv_light_allowed() rejects wakes
156-
// above dark_threshold; paths that bypass it (app-driven force-on,
157-
// ambient-sensor pref off) sensibly land at user_max here.
151+
// Dynamic backlight: dim in utter darkness, otherwise user max. The
152+
// bright-outdoor case is already filtered upstream by prv_light_allowed()
153+
// for ambient-sensor-enabled wakes; the few paths that bypass that gate
154+
// (app-driven force-on, ambient-sensor pref off) sensibly land at max here.
158155
if (backlight_is_dynamic_intensity_enabled()) {
159156
const uint8_t dim_intensity = 10;
160-
const uint8_t user_max = backlight_get_intensity();
161-
const uint32_t als = prv_get_als_level();
162-
const uint32_t dim_threshold = backlight_get_dynamic_min_threshold();
163-
const uint32_t max_threshold = ambient_light_get_dark_threshold();
164-
165-
if (user_max <= dim_intensity || max_threshold <= dim_threshold) {
166-
return user_max;
167-
}
168-
if (als <= dim_threshold) {
157+
if (prv_get_als_level() <= backlight_get_dynamic_min_threshold()) {
169158
return dim_intensity;
170159
}
171-
if (als >= max_threshold) {
172-
return user_max;
173-
}
174-
const uint32_t ramped =
175-
dim_intensity +
176-
((100 - dim_intensity) * (als - dim_threshold)) / (max_threshold - dim_threshold);
177-
return (ramped > user_max) ? user_max : (uint8_t)ramped;
178160
}
179161
#endif
180162

0 commit comments

Comments
 (0)