Compare commits
No commits in common. "4ef6e7448be004d0a0cddadb77f436e21843d057" and "07d6aa5e3e5ce6e8d9dcf82febe3e4d298f01eda" have entirely different histories.
4ef6e7448b
...
07d6aa5e3e
|
@ -344,7 +344,7 @@ void display_standingDisarmedDisplay(ESCSerialComm& escFront, ESCSerialComm& esc
|
||||||
display.setCursor(6*10,0);
|
display.setCursor(6*10,0);
|
||||||
dtostrf((escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0,1,1,buf);
|
dtostrf((escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0,1,1,buf);
|
||||||
display.print((String)buf);
|
display.print((String)buf);
|
||||||
display.print(F("V"));
|
display.print(F('V'));
|
||||||
display.println();
|
display.println();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -607,38 +607,27 @@ void calculateSetSpeed(unsigned long timediff){
|
||||||
|
|
||||||
float steeringdifferential_speed=0.3; //Speed for turning the steering wheel by differtially driving the front wheels
|
float steeringdifferential_speed=0.3; //Speed for turning the steering wheel by differtially driving the front wheels
|
||||||
|
|
||||||
|
static bool reverse_enabled2=true; //pohibit instant reverse driving when releasing steering wheel buttons when brake is still pressed. wait for throttle and brake to release once
|
||||||
|
if (!reverse_enabled2 && throttle_pos<=0 && brake_pos<=0){
|
||||||
|
reverse_enabled2=true;
|
||||||
|
}
|
||||||
|
|
||||||
if (reverse_enabled) { //backwards driving not prohibited
|
if (reverse_enabled) { //backwards driving not prohibited
|
||||||
static bool tanksteering_prohibit_left=false;
|
|
||||||
static bool tanksteering_prohibit_right=false;
|
|
||||||
static bool prohibit_reverse=false;
|
|
||||||
|
|
||||||
if (control_buttonA && !control_buttonB) { //Right button (A) only
|
if (control_buttonA && !control_buttonB) { //Right button (A) only
|
||||||
tanksteering_prohibit_left=true;
|
|
||||||
prohibit_reverse=true;
|
|
||||||
}else if(control_buttonB && !control_buttonA) {//Left button (B) only
|
|
||||||
tanksteering_prohibit_right=true;
|
|
||||||
prohibit_reverse=true;
|
|
||||||
}else if(!control_buttonA && !control_buttonB){ //no button pressed
|
|
||||||
tanksteering_prohibit_left=true;
|
|
||||||
tanksteering_prohibit_right=true;
|
|
||||||
if (throttle_pos<=0 && brake_pos<=0) {//levers released
|
|
||||||
tanksteering_prohibit_left=false;
|
|
||||||
tanksteering_prohibit_right=false;
|
|
||||||
prohibit_reverse=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tanksteering_prohibit_right && tanksteering_prohibit_left && prohibit_reverse) { //Right Tanksteering
|
|
||||||
cmd_send_toMotor_FL+=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_FL+=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_FR-=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_FR-=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_RL+=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_RL+=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_RR-=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_RR-=brake_pos*steeringdifferential_speed;
|
||||||
}else if(tanksteering_prohibit_right && !tanksteering_prohibit_left && prohibit_reverse) { //Left Tanksteering
|
reverse_enabled2=false;
|
||||||
|
|
||||||
|
}else if(control_buttonB && !control_buttonA) { //Left button (B) only
|
||||||
cmd_send_toMotor_FL-=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_FL-=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_FR+=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_FR+=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_RL-=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_RL-=brake_pos*steeringdifferential_speed;
|
||||||
cmd_send_toMotor_RR+=brake_pos*steeringdifferential_speed;
|
cmd_send_toMotor_RR+=brake_pos*steeringdifferential_speed;
|
||||||
}else if(tanksteering_prohibit_right && tanksteering_prohibit_left && !prohibit_reverse){ //no button on steering wheel pressed, drive backwards
|
reverse_enabled2=false;
|
||||||
|
|
||||||
|
}else if(reverse_enabled2){ //no button on steering wheel pressed, drive backwards
|
||||||
_cmd_send_toMotor-=brake_pos*reverse_speed;
|
_cmd_send_toMotor-=brake_pos*reverse_speed;
|
||||||
|
|
||||||
cmd_send_toMotor_FL=_cmd_send_toMotor;
|
cmd_send_toMotor_FL=_cmd_send_toMotor;
|
||||||
|
|
Loading…
Reference in New Issue