From fc8bebd55f7d52ae84c60bcc8b2b6fc490045e99 Mon Sep 17 00:00:00 2001 From: Jess Zarchi Date: Tue, 3 Dec 2024 18:32:36 -0800 Subject: [PATCH] Fix linter errors --- src/EZ-Template/PID.cpp | 4 +-- src/EZ-Template/auton.cpp | 2 +- src/EZ-Template/auton_selector.cpp | 2 +- src/EZ-Template/drive/drive.cpp | 2 +- src/EZ-Template/drive/pid_tuner.cpp | 2 +- src/EZ-Template/drive/pto.cpp | 1 - .../drive/set_pid/set_drive_pid.cpp | 5 ++-- .../drive/set_pid/set_odom_pid.cpp | 3 +-- src/EZ-Template/drive/set_pid/set_pid.cpp | 3 +-- .../drive/set_pid/set_swing_pid.cpp | 3 +-- .../drive/set_pid/set_turn_pid.cpp | 3 +-- src/EZ-Template/drive/user_input.cpp | 27 ++++++++++--------- src/EZ-Template/sdcard.cpp | 1 + src/EZ-Template/util.cpp | 7 ++--- 14 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/EZ-Template/PID.cpp b/src/EZ-Template/PID.cpp index 94eb5c65..2b3981f4 100644 --- a/src/EZ-Template/PID.cpp +++ b/src/EZ-Template/PID.cpp @@ -4,8 +4,8 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "main.h" -#include "util.hpp" +#include "EZ-Template/api.hpp" +#include "api.h" using namespace ez; diff --git a/src/EZ-Template/auton.cpp b/src/EZ-Template/auton.cpp index c0a70f3e..75b50166 100644 --- a/src/EZ-Template/auton.cpp +++ b/src/EZ-Template/auton.cpp @@ -4,7 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "main.h" +#include "EZ-Template/api.hpp" Auton::Auton() { Name = ""; diff --git a/src/EZ-Template/auton_selector.cpp b/src/EZ-Template/auton_selector.cpp index 7c74b320..ea0bc0c3 100644 --- a/src/EZ-Template/auton_selector.cpp +++ b/src/EZ-Template/auton_selector.cpp @@ -4,7 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "main.h" +#include "EZ-Template/api.hpp" AutonSelector::AutonSelector() { auton_count = 0; diff --git a/src/EZ-Template/drive/drive.cpp b/src/EZ-Template/drive/drive.cpp index 3cdcfa20..84ee51a9 100644 --- a/src/EZ-Template/drive/drive.cpp +++ b/src/EZ-Template/drive/drive.cpp @@ -8,7 +8,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. #include -#include "main.h" +#include "EZ-Template/sdcard.hpp" #include "okapi/api/units/QAngle.hpp" #include "pros/llemu.hpp" #include "pros/screen.hpp" diff --git a/src/EZ-Template/drive/pid_tuner.cpp b/src/EZ-Template/drive/pid_tuner.cpp index 65ef15f7..b54b329c 100644 --- a/src/EZ-Template/drive/pid_tuner.cpp +++ b/src/EZ-Template/drive/pid_tuner.cpp @@ -5,7 +5,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "EZ-Template/api.hpp" -#include "EZ-Template/sdcard.hpp" +#include "liblvgl/llemu.hpp" #include "pros/llemu.hpp" #include "pros/misc.h" diff --git a/src/EZ-Template/drive/pto.cpp b/src/EZ-Template/drive/pto.cpp index 6aa24fdc..07361d07 100644 --- a/src/EZ-Template/drive/pto.cpp +++ b/src/EZ-Template/drive/pto.cpp @@ -8,7 +8,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include "drive.hpp" -#include "main.h" bool Drive::pto_check(pros::Motor check_if_pto) { auto does_exist = std::find(pto_active.begin(), pto_active.end(), check_if_pto.get_port()); diff --git a/src/EZ-Template/drive/set_pid/set_drive_pid.cpp b/src/EZ-Template/drive/set_pid/set_drive_pid.cpp index e21a782e..42b553df 100644 --- a/src/EZ-Template/drive/set_pid/set_drive_pid.cpp +++ b/src/EZ-Template/drive/set_pid/set_drive_pid.cpp @@ -4,8 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "EZ-Template/util.hpp" -#include "main.h" +#include "EZ-Template/api.hpp" #include "okapi/api/units/QAngle.hpp" ///// @@ -139,7 +138,7 @@ void Drive::pid_drive_set(double target, int speed, bool slew_on, bool toggle_he // Prioritize custom fwd/rev constants. Otherwise, use the same for fwd and rev if (fwd_rev_drivePID.constants_set_check() && !new_drive_pid->constants_set_check()) new_drive_pid = &fwd_rev_drivePID; - + PID::Constants pid_drive_consts = new_drive_pid->constants_get(); leftPID.constants_set(pid_drive_consts.kp, pid_drive_consts.ki, pid_drive_consts.kd, pid_drive_consts.start_i); rightPID.constants_set(pid_drive_consts.kp, pid_drive_consts.ki, pid_drive_consts.kd, pid_drive_consts.start_i); diff --git a/src/EZ-Template/drive/set_pid/set_odom_pid.cpp b/src/EZ-Template/drive/set_pid/set_odom_pid.cpp index 1b03c3bb..1fff0cfc 100644 --- a/src/EZ-Template/drive/set_pid/set_odom_pid.cpp +++ b/src/EZ-Template/drive/set_pid/set_odom_pid.cpp @@ -4,8 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "EZ-Template/util.hpp" -#include "main.h" +#include "EZ-Template/api.hpp" #include "okapi/api/units/QAngle.hpp" ///// diff --git a/src/EZ-Template/drive/set_pid/set_pid.cpp b/src/EZ-Template/drive/set_pid/set_pid.cpp index 3be8bc1c..f72c615b 100644 --- a/src/EZ-Template/drive/set_pid/set_pid.cpp +++ b/src/EZ-Template/drive/set_pid/set_pid.cpp @@ -4,8 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "EZ-Template/util.hpp" -#include "main.h" +#include "EZ-Template/api.hpp" #include "okapi/api/units/QAngle.hpp" // Updates max speed diff --git a/src/EZ-Template/drive/set_pid/set_swing_pid.cpp b/src/EZ-Template/drive/set_pid/set_swing_pid.cpp index d89e0b5f..a5826d52 100644 --- a/src/EZ-Template/drive/set_pid/set_swing_pid.cpp +++ b/src/EZ-Template/drive/set_pid/set_swing_pid.cpp @@ -4,8 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "EZ-Template/util.hpp" -#include "main.h" +#include "EZ-Template/api.hpp" #include "okapi/api/units/QAngle.hpp" ///// diff --git a/src/EZ-Template/drive/set_pid/set_turn_pid.cpp b/src/EZ-Template/drive/set_pid/set_turn_pid.cpp index 394ccf0e..8a7a222a 100644 --- a/src/EZ-Template/drive/set_pid/set_turn_pid.cpp +++ b/src/EZ-Template/drive/set_pid/set_turn_pid.cpp @@ -4,8 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "EZ-Template/util.hpp" -#include "main.h" +#include "EZ-Template/api.hpp" #include "okapi/api/units/QAngle.hpp" ///// diff --git a/src/EZ-Template/drive/user_input.cpp b/src/EZ-Template/drive/user_input.cpp index 00664882..3539b1a8 100644 --- a/src/EZ-Template/drive/user_input.cpp +++ b/src/EZ-Template/drive/user_input.cpp @@ -4,7 +4,8 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "main.h" +#include "drive.hpp" +#include "pros/misc.h" void Drive::opcontrol_arcade_scaling(bool enable) { arcade_vector_scaling = enable; } bool Drive::opcontrol_arcade_scaling_enabled() { return arcade_vector_scaling; } @@ -292,12 +293,12 @@ void Drive::opcontrol_tank() { // Toggle for controller curve opcontrol_curve_buttons_iterate(); - auto analog_left_value = master.get_analog(ANALOG_LEFT_Y); - auto analog_right_value = master.get_analog(ANALOG_RIGHT_Y); + auto analog_left_value = master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y); + auto analog_right_value = master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y); // Put the joysticks through the curve function - int l_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_LEFT_Y))); - int r_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_RIGHT_Y))); + int l_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y))); + int r_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y))); // Set robot to l_stick and r_stick, check joystick threshold, set active brake opcontrol_joystick_threshold_iterate(l_stick, r_stick); @@ -315,12 +316,12 @@ void Drive::opcontrol_arcade_standard(e_type stick_type) { // Check arcade type (split vs single, normal vs flipped) if (stick_type == SPLIT) { // Put the joysticks through the curve function - fwd_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_LEFT_Y))); - turn_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(ANALOG_RIGHT_X))); + fwd_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y))); + turn_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X))); } else if (stick_type == SINGLE) { // Put the joysticks through the curve function - fwd_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_LEFT_Y))); - turn_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(ANALOG_LEFT_X))); + fwd_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y))); + turn_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X))); } // Set robot to l_stick and r_stick, check joystick threshold, set active brake @@ -339,12 +340,12 @@ void Drive::opcontrol_arcade_flipped(e_type stick_type) { // Check arcade type (split vs single, normal vs flipped) if (stick_type == SPLIT) { // Put the joysticks through the curve function - fwd_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(ANALOG_RIGHT_Y))); - turn_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_LEFT_X))); + fwd_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y))); + turn_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X))); } else if (stick_type == SINGLE) { // Put the joysticks through the curve function - fwd_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(ANALOG_RIGHT_Y))); - turn_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(ANALOG_RIGHT_X))); + fwd_stick = opcontrol_curve_right(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y))); + turn_stick = opcontrol_curve_left(clipped_joystick(master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X))); } // Set robot to l_stick and r_stick, check joystick threshold, set active brake diff --git a/src/EZ-Template/sdcard.cpp b/src/EZ-Template/sdcard.cpp index ade1187e..63435cf8 100644 --- a/src/EZ-Template/sdcard.cpp +++ b/src/EZ-Template/sdcard.cpp @@ -9,6 +9,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include "auton_selector.hpp" +#include "liblvgl/llemu.hpp" #include "pros/llemu.hpp" #include "util.hpp" diff --git a/src/EZ-Template/util.cpp b/src/EZ-Template/util.cpp index 18ffb0d4..e24ed83f 100644 --- a/src/EZ-Template/util.cpp +++ b/src/EZ-Template/util.cpp @@ -4,9 +4,10 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "util.hpp" - -#include "main.h" +#include "EZ-Template/api.hpp" +#include "liblvgl/llemu.hpp" +#include "pros/llemu.hpp" +#include "pros/misc.h" pros::Controller master(pros::E_CONTROLLER_MASTER);