summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight-sw-fading.c22
-rw-r--r--firmware/export/config/agptekrocker.h3
-rw-r--r--firmware/export/config/xduoox20.h3
-rw-r--r--firmware/export/config/xduoox3ii.h3
4 files changed, 28 insertions, 3 deletions
diff --git a/firmware/backlight-sw-fading.c b/firmware/backlight-sw-fading.c
index c336d40458..ecd225667f 100644
--- a/firmware/backlight-sw-fading.c
+++ b/firmware/backlight-sw-fading.c
@@ -27,6 +27,10 @@
27#include "backlight.h" 27#include "backlight.h"
28#include "backlight-sw-fading.h" 28#include "backlight-sw-fading.h"
29 29
30#ifndef BRIGHTNESS_STEP
31#define BRIGHTNESS_STEP 1
32#endif
33
30/* To adapt a target do: 34/* To adapt a target do:
31 * - make sure backlight_hw_on doesn't set the brightness to something other than 35 * - make sure backlight_hw_on doesn't set the brightness to something other than
32 * the previous value (lowest brightness in most cases) 36 * the previous value (lowest brightness in most cases)
@@ -46,7 +50,14 @@ static bool _backlight_fade_up(void)
46{ 50{
47 if (LIKELY(current_brightness < backlight_brightness)) 51 if (LIKELY(current_brightness < backlight_brightness))
48 { 52 {
53#if BRIGHTNESS_STEP == 1
49 backlight_hw_brightness(++current_brightness); 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 return(current_brightness >= backlight_brightness); 62 return(current_brightness >= backlight_brightness);
52} 63}
@@ -56,13 +67,24 @@ static bool _backlight_fade_down(void)
56{ 67{
57 if (LIKELY(current_brightness > MIN_BRIGHTNESS_SETTING)) 68 if (LIKELY(current_brightness > MIN_BRIGHTNESS_SETTING))
58 { 69 {
70#if BRIGHTNESS_STEP == 1
59 backlight_hw_brightness(--current_brightness); 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 return false; 78 return false;
61 } 79 }
62 else 80 else
63 { 81 {
64 /* decrement once more, since backlight is off */ 82 /* decrement once more, since backlight is off */
83#if BRIGHTNESS_STEP == 1
65 current_brightness--; 84 current_brightness--;
85#else
86 current_brightness=MIN_BRIGHTNESS_SETTING -1;
87#endif
66 backlight_hw_off(); 88 backlight_hw_off();
67 return true; 89 return true;
68 } 90 }
diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h
index 90fd2267fe..c688513137 100644
--- a/firmware/export/config/agptekrocker.h
+++ b/firmware/export/config/agptekrocker.h
@@ -51,10 +51,11 @@
51#define HAVE_BACKLIGHT_BRIGHTNESS 51#define HAVE_BACKLIGHT_BRIGHTNESS
52 52
53/* Main LCD backlight brightness range and defaults: the backlight driver 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#define MIN_BRIGHTNESS_SETTING 1 56#define MIN_BRIGHTNESS_SETTING 1
57#define MAX_BRIGHTNESS_SETTING 255 57#define MAX_BRIGHTNESS_SETTING 255
58#define BRIGHTNESS_STEP 5
58#define DEFAULT_BRIGHTNESS_SETTING 70 59#define DEFAULT_BRIGHTNESS_SETTING 70
59 60
60/* Which backlight fading type? */ 61/* Which backlight fading type? */
diff --git a/firmware/export/config/xduoox20.h b/firmware/export/config/xduoox20.h
index b90ebceb04..4a5b63bf38 100644
--- a/firmware/export/config/xduoox20.h
+++ b/firmware/export/config/xduoox20.h
@@ -48,10 +48,11 @@
48#define HAVE_BACKLIGHT_BRIGHTNESS 48#define HAVE_BACKLIGHT_BRIGHTNESS
49 49
50/* Main LCD backlight brightness range and defaults: the backlight driver 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#define MIN_BRIGHTNESS_SETTING 1 53#define MIN_BRIGHTNESS_SETTING 1
54#define MAX_BRIGHTNESS_SETTING 255 54#define MAX_BRIGHTNESS_SETTING 255
55#define BRIGHTNESS_STEP 5
55#define DEFAULT_BRIGHTNESS_SETTING 70 56#define DEFAULT_BRIGHTNESS_SETTING 70
56 57
57/* Which backlight fading type? */ 58/* Which backlight fading type? */
diff --git a/firmware/export/config/xduoox3ii.h b/firmware/export/config/xduoox3ii.h
index 9ad7b5884b..e2066e453c 100644
--- a/firmware/export/config/xduoox3ii.h
+++ b/firmware/export/config/xduoox3ii.h
@@ -48,10 +48,11 @@
48#define HAVE_BACKLIGHT_BRIGHTNESS 48#define HAVE_BACKLIGHT_BRIGHTNESS
49 49
50/* Main LCD backlight brightness range and defaults: the backlight driver 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#define MIN_BRIGHTNESS_SETTING 1 53#define MIN_BRIGHTNESS_SETTING 1
54#define MAX_BRIGHTNESS_SETTING 255 54#define MAX_BRIGHTNESS_SETTING 255
55#define BRIGHTNESS_STEP 5
55#define DEFAULT_BRIGHTNESS_SETTING 70 56#define DEFAULT_BRIGHTNESS_SETTING 70
56 57
57/* Which backlight fading type? */ 58/* Which backlight fading type? */