summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c6
-rw-r--r--firmware/powermgmt.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 7dcecb1e68..febcb78a5a 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -73,9 +73,9 @@ int battery_capacity = 1500; /* only a default value */
73 73
74void set_battery_capacity(int capacity) 74void set_battery_capacity(int capacity)
75{ 75{
76 int values[8] = {1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200}; 76 battery_capacity = capacity;
77 77 if ((battery_capacity > BATTERY_CAPACITY_MAX) || (battery_capacity < 1500))
78 battery_capacity = values[capacity]; 78 battery_capacity = 1500;
79} 79}
80 80
81#ifdef HAVE_CHARGE_CTRL 81#ifdef HAVE_CHARGE_CTRL
diff --git a/firmware/powermgmt.h b/firmware/powermgmt.h
index b7f8b01978..ea6319c02e 100644
--- a/firmware/powermgmt.h
+++ b/firmware/powermgmt.h
@@ -27,6 +27,7 @@
27#define BATTERY_LEVEL_FULL 585 /* 5.85V */ 27#define BATTERY_LEVEL_FULL 585 /* 5.85V */
28 28
29#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY) 29#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
30#define BATTERY_CAPACITY_MAX 2400 /* max. capacity that can be selected in settings menu, min. is always 1500 */
30 31
31#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */ 32#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
32#define POWER_AVG_N 4 /* how many samples to take for each measurement */ 33#define POWER_AVG_N 4 /* how many samples to take for each measurement */