add FSM to disable SOC on charger unplug

adjusted SOC levels to be better, still not perfect
changed self-detect to work better (?)
fixed bug in SOC hysteresis