It looks like the method xadow::getChrgState() never returns CHARGING. There are three return statements: 2x NOCHARGE, 1x CHARGDONE, but no CHARGING.
unsigned char xadow::getChrgState()
{
unsigned char Temp = CHRGpin & CHRGbit;
if(!Temp)
{
return NOCHARGE;
}
Temp = DONEpin & DONEbit;
if(!Temp)
{
return CHARGDONE;
}
return NOCHARGE;
}
It looks like the method xadow::getChrgState() never returns CHARGING. There are three return statements: 2x NOCHARGE, 1x CHARGDONE, but no CHARGING.