clean code up

This commit is contained in:
ary 2023-10-10 08:36:12 -04:00
parent 098088c1eb
commit 8a00af52a2
5 changed files with 24 additions and 15 deletions

View File

@ -213,7 +213,7 @@ class Drive {
* Sets the chassis to controller joysticks using tank control. Run is usercontrol.
* This passes the controller through the curve functions, but is disabled by default. Use toggle_controller_curve_modifier() to enable it.
*/
void tank();
void tank_control();
/**
* Sets the chassis to controller joysticks using standard arcade control. Run is usercontrol.

View File

@ -9,6 +9,7 @@
namespace superstruct {
//configs
void chassisInit();
void opControlInit();
void configureExitConditions();
void configureConstants();
void autonomousResets();
@ -37,5 +38,6 @@ namespace superstruct {
void togglePto();
void runCata();
void cataControl();
void wingsControl();
}

View File

@ -166,7 +166,7 @@ void Drive::joy_thresh_opcontrol(int l_stick, int r_stick) {
}
// Tank control
void Drive::tank() {
void Drive::tank_control() {
is_tank = true;
reset_drive_sensors_opcontrol();

View File

@ -93,22 +93,12 @@ void autonomous() {
* task, not resume it from where it left off.
*/
void opcontrol() {
motorsCoast();
disableActiveBrake();
opControlInit();
while (true) {
chassis.tank();
chassis.tank_control();
superstruct::cataControl();
if (globals::master.get_digital_new_press(DIGITAL_L2)) {
left_wing_piston.set_value(1);
right_wing_piston.set_value(1);
}
if (globals::master.get_digital_new_press(DIGITAL_L1)) {
left_wing_piston.set_value(0);
right_wing_piston.set_value(0);
}
superstruct::wingsControl();
pros::delay(ary::util::DELAY_TIME);
}

View File

@ -29,6 +29,11 @@ namespace superstruct {
chassis.set_joystick_turnscale(1.0);
}
void opControlInit() {
motorsCoast();
disableActiveBrake();
}
void configureExitConditions() {
chassis.set_exit_condition(chassis.turn_exit, 100, 3, 500, 7, 500, 500);
chassis.set_exit_condition(chassis.swing_exit, 100, 3, 500, 7, 500, 500);
@ -157,4 +162,16 @@ namespace superstruct {
runCata(0);
}
}
void wingsControl() {
if (globals::master.get_digital_new_press(DIGITAL_L2)) {
left_wing_piston.set_value(1);
right_wing_piston.set_value(1);
}
if (globals::master.get_digital_new_press(DIGITAL_L1)) {
left_wing_piston.set_value(0);
right_wing_piston.set_value(0);
}
}
}