diff options
Diffstat (limited to 'firmware/target/hosted/ypr0')
-rw-r--r-- | firmware/target/hosted/ypr0/powermgmt-ypr0.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/ypr0/powermgmt-ypr0.c index 3a97331083..0c162a619d 100644 --- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c +++ b/firmware/target/hosted/ypr0/powermgmt-ypr0.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
30 | { | 30 | { |
31 | 3500 | 31 | 3470 |
32 | }; | 32 | }; |
33 | 33 | ||
34 | /* the OF shuts down at this voltage */ | 34 | /* the OF shuts down at this voltage */ |
@@ -41,7 +41,7 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | |||
41 | /* FIXME: This is guessed. Make proper curve using battery_bench */ | 41 | /* FIXME: This is guessed. Make proper curve using battery_bench */ |
42 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | 42 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = |
43 | { | 43 | { |
44 | { 3450, 3692, 3740, 3772, 3798, 3828, 3876, 3943, 4013, 4094, 4194 } | 44 | { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 } |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #if CONFIG_CHARGING | 47 | #if CONFIG_CHARGING |
@@ -49,7 +49,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | |||
49 | /* FIXME: This is guessed. Make proper curve using battery_bench */ | 49 | /* FIXME: This is guessed. Make proper curve using battery_bench */ |
50 | const unsigned short const percent_to_volt_charge[11] = | 50 | const unsigned short const percent_to_volt_charge[11] = |
51 | { | 51 | { |
52 | 3600, 3802, 3856, 3888, 3905, 3931, 3973, 4025, 4084, 4161, 4219 | 52 | 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 |
53 | }; | 53 | }; |
54 | 54 | ||
55 | unsigned int power_input_status(void) | 55 | unsigned int power_input_status(void) |
@@ -77,11 +77,7 @@ unsigned int battery_adc_voltage(void) | |||
77 | 77 | ||
78 | bool charging_state(void) | 78 | bool charging_state(void) |
79 | { | 79 | { |
80 | /* cannot make this static (initializer not constant error), but gcc | 80 | const unsigned short charged_thres = 4170; |
81 | * seems to calculate at compile time anyway */ | ||
82 | const unsigned short charged_thres = | ||
83 | ((percent_to_volt_charge[9] + percent_to_volt_charge[10]) / 2); | ||
84 | |||
85 | bool ret = (power_input_status() == POWER_INPUT_MAIN_CHARGER); | 81 | bool ret = (power_input_status() == POWER_INPUT_MAIN_CHARGER); |
86 | /* dont indicate for > ~95% */ | 82 | /* dont indicate for > ~95% */ |
87 | return ret && (battery_adc_voltage() <= charged_thres); | 83 | return ret && (battery_adc_voltage() <= charged_thres); |