stawel / cheali-charger

cheap lipo charger
824 stars 275 forks source link

HW failure message at fast current decreasing #262

Open Iggnus opened 6 years ago

Iggnus commented 6 years ago

Hi Pawel Can you check that please? - LED mode, currents higher 2000mA Push and hold [down] key.. at currents under ~900mA you will get failure ( happens at IF i_limit < AnalogInputs::getIout() )

BTW, Do we really need to perform this comparison? (ordered current getIout(), not a really flowing one)

P.S. Can you also bump up EEPROM version? (Firmware from March '17 and May are not fully compatible and asks for recalibration..)

Iggnus commented 5 years ago

BTW, Do we really need to perform this comparison? (averaged current getIout(), not a really flowing one) (because of its huge delay) Its same for Strategy::maxI and really ordered SMPS::getIout()

My temporary solution:

AnalogInputs::ValueType i_limit = SMPS::getIout(); AnalogInputs::ValueType i_value = AnalogInputs::calibrateValue(AnalogInputs::Ismps, AnalogInputs::getADCValue(AnalogInputs::Ismps)); if (i_limit > Strategy::maxI) SMPS::trySetIout(Strategy::maxI);

i_limit ++; i_limit *= 3; i_limit /= 2;

if ( i_value > i_limit ) { ...