A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

For backlights that have a wide control, support skipping steps.

the rocker, x3ii, and x20 now take advantage of this, and fades
are far faster now.

Change-Id: Iceb1a5a6c1d1389c3fdb859b32016b5114a80a22

+28 -3
+22
firmware/backlight-sw-fading.c
··· 27 27 #include "backlight.h" 28 28 #include "backlight-sw-fading.h" 29 29 30 + #ifndef BRIGHTNESS_STEP 31 + #define BRIGHTNESS_STEP 1 32 + #endif 33 + 30 34 /* To adapt a target do: 31 35 * - make sure backlight_hw_on doesn't set the brightness to something other than 32 36 * the previous value (lowest brightness in most cases) ··· 46 50 { 47 51 if (LIKELY(current_brightness < backlight_brightness)) 48 52 { 53 + #if BRIGHTNESS_STEP == 1 49 54 backlight_hw_brightness(++current_brightness); 55 + #else 56 + current_brightness += BRIGHTNESS_STEP; 57 + if (current_brightness > MAX_BRIGHTNESS_SETTING) 58 + current_brightness = MAX_BRIGHTNESS_SETTING; 59 + backlight_hw_brightness(current_brightness); 60 + #endif 50 61 } 51 62 return(current_brightness >= backlight_brightness); 52 63 } ··· 56 67 { 57 68 if (LIKELY(current_brightness > MIN_BRIGHTNESS_SETTING)) 58 69 { 70 + #if BRIGHTNESS_STEP == 1 59 71 backlight_hw_brightness(--current_brightness); 72 + #else 73 + current_brightness -= BRIGHTNESS_STEP; 74 + if (current_brightness < MIN_BRIGHTNESS_SETTING) 75 + current_brightness = MIN_BRIGHTNESS_SETTING; 76 + backlight_hw_brightness(current_brightness); 77 + #endif 60 78 return false; 61 79 } 62 80 else 63 81 { 64 82 /* decrement once more, since backlight is off */ 83 + #if BRIGHTNESS_STEP == 1 65 84 current_brightness--; 85 + #else 86 + current_brightness=MIN_BRIGHTNESS_SETTING -1; 87 + #endif 66 88 backlight_hw_off(); 67 89 return true; 68 90 }
+2 -1
firmware/export/config/agptekrocker.h
··· 51 51 #define HAVE_BACKLIGHT_BRIGHTNESS 52 52 53 53 /* Main LCD backlight brightness range and defaults: the backlight driver 54 - * has levels from 0 to 2555. But 0 is off so start at 1. 54 + * has levels from 0 to 255. But 0 is off so start at 1. 55 55 */ 56 56 #define MIN_BRIGHTNESS_SETTING 1 57 57 #define MAX_BRIGHTNESS_SETTING 255 58 + #define BRIGHTNESS_STEP 5 58 59 #define DEFAULT_BRIGHTNESS_SETTING 70 59 60 60 61 /* Which backlight fading type? */
+2 -1
firmware/export/config/xduoox20.h
··· 48 48 #define HAVE_BACKLIGHT_BRIGHTNESS 49 49 50 50 /* Main LCD backlight brightness range and defaults: the backlight driver 51 - * has levels from 0 to 2555. But 0 is off so start at 1. 51 + * has levels from 0 to 255. But 0 is off so start at 1. 52 52 */ 53 53 #define MIN_BRIGHTNESS_SETTING 1 54 54 #define MAX_BRIGHTNESS_SETTING 255 55 + #define BRIGHTNESS_STEP 5 55 56 #define DEFAULT_BRIGHTNESS_SETTING 70 56 57 57 58 /* Which backlight fading type? */
+2 -1
firmware/export/config/xduoox3ii.h
··· 48 48 #define HAVE_BACKLIGHT_BRIGHTNESS 49 49 50 50 /* Main LCD backlight brightness range and defaults: the backlight driver 51 - * has levels from 0 to 2555. But 0 is off so start at 1. 51 + * has levels from 0 to 255. But 0 is off so start at 1. 52 52 */ 53 53 #define MIN_BRIGHTNESS_SETTING 1 54 54 #define MAX_BRIGHTNESS_SETTING 255 55 + #define BRIGHTNESS_STEP 5 55 56 #define DEFAULT_BRIGHTNESS_SETTING 70 56 57 57 58 /* Which backlight fading type? */