fix connected flag update

This commit is contained in:
interfisch 2022-04-10 20:18:57 +02:00
parent 2bb9f3d672
commit 214fecdce4
1 changed files with 13 additions and 0 deletions

View File

@ -35,6 +35,19 @@ bool ESCSerialComm::update(long millis) //returns true if something was sent or
if (flag_received) {
updateMotorparams();
}
if ( loopmillis > Motorparams.millis+FEEDBACKRECEIVETIMEOUT ) { //controller disconnected
if (controller_connected) { //just got disconnected
controller_connected=false;
Serial.println("Controller Front feedback timeout");
}
}else if(!controller_connected && loopmillis > FEEDBACKRECEIVETIMEOUT) { //not timeouted but was before
controller_connected=true;
Serial.println("Controller Front connected");
}
if (loopmillis - last_send > SENDPERIOD) { //Calculate motor stuff and send to motor controllers
last_send=loopmillis;