diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config.h | 8 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 4 | ||||
-rw-r--r-- | firmware/powermgmt.c | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index bb3f405d6a..277a1d8632 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -709,6 +709,14 @@ Lyre prototype 1 */ | |||
709 | #define BATTERY_CAPACITY_DEFAULT 0 | 709 | #define BATTERY_CAPACITY_DEFAULT 0 |
710 | #endif | 710 | #endif |
711 | 711 | ||
712 | #ifndef BATTERY_CAPACITY_MIN | ||
713 | #define BATTERY_CAPACITY_MIN BATTERY_CAPACITY_DEFAULT | ||
714 | #endif | ||
715 | |||
716 | #ifndef BATTERY_CAPACITY_MAX | ||
717 | #define BATTERY_CAPACITY_MAX BATTERY_CAPACITY_DEFAULT | ||
718 | #endif | ||
719 | |||
712 | #ifndef BATTERY_CAPACITY_INC | 720 | #ifndef BATTERY_CAPACITY_INC |
713 | #define BATTERY_CAPACITY_INC 0 | 721 | #define BATTERY_CAPACITY_INC 0 |
714 | #endif | 722 | #endif |
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index f45690573a..329e64d653 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h | |||
@@ -157,8 +157,10 @@ void battery_read_info(int *voltage, int *level); | |||
157 | bool battery_level_safe(void); | 157 | bool battery_level_safe(void); |
158 | 158 | ||
159 | void set_poweroff_timeout(int timeout); | 159 | void set_poweroff_timeout(int timeout); |
160 | #if BATTERY_CAPACITY_INC > 0 | ||
160 | void set_battery_capacity(int capacity); /* set local battery capacity value */ | 161 | void set_battery_capacity(int capacity); /* set local battery capacity value */ |
161 | int get_battery_capacity(void); /* get local battery capacity value */ | 162 | #endif |
163 | int get_battery_capacity(void); /* get local battery capacity value */ | ||
162 | void set_battery_type(int type); /* set local battery type */ | 164 | void set_battery_type(int type); /* set local battery type */ |
163 | 165 | ||
164 | void set_sleeptimer_duration(int minutes); | 166 | void set_sleeptimer_duration(int minutes); |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 8c807e5382..8e47b19721 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -114,7 +114,11 @@ int _battery_time(void) { return powermgmt_est_runningtime_min; } | |||
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | /* default value, mAh */ | 116 | /* default value, mAh */ |
117 | #if BATTERY_CAPACITY_INC > 0 | ||
117 | static int battery_capacity = BATTERY_CAPACITY_DEFAULT; | 118 | static int battery_capacity = BATTERY_CAPACITY_DEFAULT; |
119 | #else | ||
120 | # define battery_capacity BATTERY_CAPACITY_DEFAULT | ||
121 | #endif | ||
118 | 122 | ||
119 | #if BATTERY_TYPES_COUNT > 1 | 123 | #if BATTERY_TYPES_COUNT > 1 |
120 | static int battery_type = 0; | 124 | static int battery_type = 0; |
@@ -170,7 +174,7 @@ void set_battery_type(int type) | |||
170 | } | 174 | } |
171 | #endif | 175 | #endif |
172 | 176 | ||
173 | #ifdef BATTERY_CAPACITY_MIN | 177 | #if BATTERY_CAPACITY_INC > 0 |
174 | void set_battery_capacity(int capacity) | 178 | void set_battery_capacity(int capacity) |
175 | { | 179 | { |
176 | if (capacity > BATTERY_CAPACITY_MAX) | 180 | if (capacity > BATTERY_CAPACITY_MAX) |