This commit is contained in:
Olaf Rempel 2007-10-05 23:18:51 +02:00
parent 18cb2f29c7
commit 82fd0d1138
1 changed files with 5 additions and 11 deletions

View File

@ -195,6 +195,7 @@ ISR(ADC_vect)
ADMUX = CH1;
}
/* start ADC again */
ADCSRA |= (1<<ADSC);
}
@ -218,7 +219,7 @@ ISR(TIMER0_OVF_vect)
/*
* charge with constant voltage of 12.45V
* and a current limit of 1.6V
* and a current limit of 1.6A
*/
if (mode == MOD_CHARGING) {
if (voltage < 12425 && current < 15500)
@ -228,30 +229,23 @@ ISR(TIMER0_OVF_vect)
if (voltage > 12450 || current > 16000)
if (pwm > 0x00)
pwm--;
} else {
pwm = 0;
}
if (pwm > 0) {
OCR1A = pwm;
TCCR1A |= (1<<COM1A1);
} else {
pwm = 0;
TCCR1A &= ~(1<<COM1A1);
}
switch (mode) {
case MOD_WAITING:
/*
* start charging when a voltage > 9V is detected (lipo connected)
*/
/* start charging when a voltage > 9V is detected (lipo connected) */
if (voltage > 9000)
mode = MOD_CHARGING;
break;
case MOD_CHARGING:
/*
* end charging if voltage > 12.42V and current < 200mA
*/
/* end charging if voltage > 12.42V and current < 200mA */
if (voltage > 12425 && current < 2000)
mode = MOD_READY;
break;