This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
millisec_poly = micros(); //замер времени | |
if (charger_plugged == 1) { // зарядник подключен | |
//зарядная кривая | |
if ((charger_state_changed == 1) && (round(-486.8010*pow(Ubatt,4)+6961.1683*pow(Ubatt,3)-37045.1501*pow(Ubatt,2)+87023.3144*Ubatt-76186.5712) <= batt_percent_poly)) { // в случае переключения ждем пока процент вырастит, а потом меняем | |
charger_state_changed = 1; | |
if (millis() < 5000) { //обрабатываем запуск при подключенной зарядке. Без этого условия при запуске с подкл. зарядником batt_percent_poly вычисляться не будет и процент зависнет. | |
charger_state_changed = 0; | |
} | |
} else { | |
charger_state_changed = 0; |