Compare commits
No commits in common. "6cffcfd6c756f3a801e4eb189ae8107bc9f1ca4f" and "14ac367a5d17ca641faf9f07a46d030f5dc516dd" have entirely different histories.
6cffcfd6c7
...
14ac367a5d
Binary file not shown.
|
@ -490,24 +490,28 @@ void readADC() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void failChecks() {
|
void failChecks() {
|
||||||
static bool laststate_Front_getControllerConnected;
|
/*
|
||||||
if ( !escFront.getControllerConnected() && laststate_Front_getControllerConnected) { //controller got disconnected and was connected before
|
if ( loopmillis > motorparamsFront.millis+FEEDBACKRECEIVETIMEOUT ) { //controller disconnected
|
||||||
laststate_Front_getControllerConnected=false;
|
if (controllerFront_connected) { //just got disconnected
|
||||||
writeLogComment(loopmillis, "Controller Front feedback timeout");
|
controllerFront_connected=false;
|
||||||
}else if( escFront.getControllerConnected() && !laststate_Front_getControllerConnected) { //controller was disconnected and is now connected
|
writeLogComment(Serial1,loopmillis, "Controller Front feedback timeout");
|
||||||
laststate_Front_getControllerConnected=true;
|
//Serial.println("Controller Front feedback timeout");
|
||||||
writeLogComment(loopmillis, "Controller Front connected");
|
}
|
||||||
}
|
}else if(!controllerFront_connected && loopmillis > FEEDBACKRECEIVETIMEOUT) { //not timeouted but was before
|
||||||
|
controllerFront_connected=true;
|
||||||
static bool laststate_Rear_getControllerConnected;
|
writeLogComment(Serial1,loopmillis, "Controller Front connected");
|
||||||
if ( !escRear.getControllerConnected() && laststate_Rear_getControllerConnected) { //controller got disconnected and was connected before
|
|
||||||
laststate_Rear_getControllerConnected=false;
|
|
||||||
writeLogComment(loopmillis, "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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( loopmillis > motorparamsRear.millis+FEEDBACKRECEIVETIMEOUT ) { //controller disconnected
|
||||||
|
if (controllerRear_connected) { //just got disconnected
|
||||||
|
controllerRear_connected=false;
|
||||||
|
writeLogComment(Serial1,loopmillis, "Controller Rear feedback timeout");
|
||||||
|
//Serial.println("Controller Rear feedback timeout");
|
||||||
|
}
|
||||||
|
}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();
|
||||||
|
|
||||||
|
@ -783,6 +787,20 @@ 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue