Compare commits

..

2 Commits

Author SHA1 Message Date
interfisch 6cffcfd6c7 update cad file 2023-09-08 09:11:42 +02:00
interfisch 7a0d459641 write controller connect and disconnect to log 2023-09-08 09:10:08 +02:00
2 changed files with 16 additions and 34 deletions

Binary file not shown.

View File

@ -490,28 +490,24 @@ void readADC() {
} }
void failChecks() { void failChecks() {
/* static bool laststate_Front_getControllerConnected;
if ( loopmillis > motorparamsFront.millis+FEEDBACKRECEIVETIMEOUT ) { //controller disconnected if ( !escFront.getControllerConnected() && laststate_Front_getControllerConnected) { //controller got disconnected and was connected before
if (controllerFront_connected) { //just got disconnected laststate_Front_getControllerConnected=false;
controllerFront_connected=false; writeLogComment(loopmillis, "Controller Front feedback timeout");
writeLogComment(Serial1,loopmillis, "Controller Front feedback timeout"); }else if( escFront.getControllerConnected() && !laststate_Front_getControllerConnected) { //controller was disconnected and is now connected
//Serial.println("Controller Front feedback timeout"); laststate_Front_getControllerConnected=true;
} writeLogComment(loopmillis, "Controller Front connected");
}else if(!controllerFront_connected && loopmillis > FEEDBACKRECEIVETIMEOUT) { //not timeouted but was before
controllerFront_connected=true;
writeLogComment(Serial1,loopmillis, "Controller Front connected");
} }
if ( loopmillis > motorparamsRear.millis+FEEDBACKRECEIVETIMEOUT ) { //controller disconnected static bool laststate_Rear_getControllerConnected;
if (controllerRear_connected) { //just got disconnected if ( !escRear.getControllerConnected() && laststate_Rear_getControllerConnected) { //controller got disconnected and was connected before
controllerRear_connected=false; laststate_Rear_getControllerConnected=false;
writeLogComment(Serial1,loopmillis, "Controller Rear feedback timeout"); writeLogComment(loopmillis, "Controller Rear feedback timeout");
//Serial.println("Controller Rear feedback timeout"); }else if( escRear.getControllerConnected() && !laststate_Rear_getControllerConnected) { //controller was disconnected and is now connected
laststate_Rear_getControllerConnected=true;
writeLogComment(loopmillis, "Controller Rear connected");
} }
}else if(!controllerRear_connected && loopmillis > FEEDBACKRECEIVETIMEOUT) { //not timeouted but was before
controllerRear_connected=true;
writeLogComment(Serial1,loopmillis, "Controller Rear connected");
}*/
controllers_connected=escFront.getControllerConnected() & escRear.getControllerConnected(); controllers_connected=escFront.getControllerConnected() & escRear.getControllerConnected();
@ -787,20 +783,6 @@ void readButtons() {
} }
/* TODO: if works, remove this
if (button_start_state) { //pressed
if ( (loopmillis> button_start_lastchange + LONG_PRESS_ARMING_TIME)) { //pressed long
if (throttle_pos<=0 && brake_pos<=0 && controllers_connected && !armed) { //brake or thottle not pressed, controllers connected
armed=true; //arm if button pressed long enough
writeLogComment(loopmillis, "Armed by button");
}
}else if (armed){ //not pressed long enough and is armed
armed=false; //disarm
writeLogComment(loopmillis, "Disarmed by button");
}
}
*/
} }