diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config/samsungyh820.h | 6 | ||||
-rw-r--r-- | firmware/target/arm/pp/adc-pp5020.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/samsung/yh820/powermgmt-yh820.c | 18 |
3 files changed, 12 insertions, 14 deletions
diff --git a/firmware/export/config/samsungyh820.h b/firmware/export/config/samsungyh820.h index 516b010e96..08bba1a910 100644 --- a/firmware/export/config/samsungyh820.h +++ b/firmware/export/config/samsungyh820.h @@ -125,9 +125,9 @@ #define AB_REPEAT_ENABLE -#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ -#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ -#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_DEFAULT 650 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 50 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ diff --git a/firmware/target/arm/pp/adc-pp5020.c b/firmware/target/arm/pp/adc-pp5020.c index 2d75a7e25f..ce50f4b5c2 100644 --- a/firmware/target/arm/pp/adc-pp5020.c +++ b/firmware/target/arm/pp/adc-pp5020.c @@ -63,7 +63,7 @@ unsigned short adc_scan(int channel) adcdata[channel] = (adc_data_1<<2 | adc_data_2); -#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)) +#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || defined(SAMSUNG_YH820)) /* ADC values read low if PLL is enabled */ if(PLL_CONTROL & 0x80000000){ adcdata[channel] += 0x14; diff --git a/firmware/target/arm/samsung/yh820/powermgmt-yh820.c b/firmware/target/arm/samsung/yh820/powermgmt-yh820.c index 180194c704..8f0847bd20 100644 --- a/firmware/target/arm/samsung/yh820/powermgmt-yh820.c +++ b/firmware/target/arm/samsung/yh820/powermgmt-yh820.c @@ -24,36 +24,34 @@ #include "adc.h" #include "powermgmt.h" -/* TODO: Not yet calibrated */ - const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { - 3695 + 3400 }; const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = { - 3627 + 3199 }; /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +/* NOTE: readout clips at around 4000mV */ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = { - { 3695, 3714, 3772, 3791, 3811, 3850, 3908, 3985, 4024, 4111, 4198 } + { 3199, 3492, 3543, 3601, 3626, 3651, 3702, 3769, 3794, 3865, 3995 } }; /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +/* NOTE: these values may be rather inaccurate. Readout clips at around 4000mV */ const unsigned short percent_to_volt_charge[11] = { - 3850, 3888, 3927, 3966, 4024, 4063, 4111, 4150, 4198, 4237, 4286 + 3750, 3860, 3880, 3900, 3930, 3994, 4080, 4135, 4200, 4200, 4200 }; -#define BATTERY_SCALE_FACTOR 4650 -/* full-scale ADC readout (2^10) in millivolt */ +#define BATTERY_SCALE_FACTOR 5000 /* Returns battery voltage from ADC [millivolts] */ int _battery_voltage(void) { - /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ - return 4100; + return ((adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10) - 1000; } |