diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fbf415e9..f6302bfb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,6 +28,8 @@ jobs: onlyAddExtraIndex: true - bash: pip install pros-cli displayName: Install CLI + - bash: python check_example_code.py + displayName: Check example code in headers - bash: | make template mkdir -p artifacts diff --git a/check_example_code.py b/check_example_code.py new file mode 100644 index 00000000..e80bee37 --- /dev/null +++ b/check_example_code.py @@ -0,0 +1,120 @@ +import asyncio +import os +import re +import subprocess +import sys +import tempfile + +include_directory = "include/pros" +precompiled_include_directory = "" +error_count = 0 +gcc_semaphore = asyncio.Semaphore(value=os.cpu_count()) + +def print_and_exit(message): + print(f"Failed to check example code in pros headers:\n{message}", file=sys.stderr) + sys.exit(1) + +def precompile_header(): + flags = [ + "-x", "c++-header", + "include/main.h", + "-std=c++23", + "-I", "include", + "-D", "_PROS_KERNEL_SUPPRESS_LLEMU_WARNING", + "-Wfatal-errors", + "-o", os.path.join(precompiled_include_directory, "main.h.gch") + ] + subprocess.run(["arm-none-eabi-gcc", *flags], check=True) + +async def compile_code(code_text, filename, is_cpp): + """ + Compiles the given code, discarding the output file. + + Args: + code_text (str): The C/C++ source code to compile. + is_cpp (bool): Whether the code is C++ or not. + + Returns: + success (bool): Whether the compilation succeeded or not. + """ + flags = [ + "-x", "c++" if is_cpp else "c", + "-std=c++23" if is_cpp else "-std=c2x", + # Only need precompiled headers for C++ + *(("-I", precompiled_include_directory) if is_cpp else ()), + "-I", "include", + # Prevent spurious warnings + "-D", "_PROS_KERNEL_SUPPRESS_LLEMU_WARNING", + # Stop compilation on first error + "-Wfatal-errors", + # Read input from stdin + "-", + # Generate assembly (avoids linker errors) + "-S", + # Discard the output file + "-o", os.devnull + ] + async with gcc_semaphore: + process = await asyncio.create_subprocess_exec( + "arm-none-eabi-gcc", + *flags, + stdin=asyncio.subprocess.PIPE, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE + ) + stdout, stderr = await process.communicate(input=code_text.encode("utf-8")) + success = (process.returncode == 0) + + if not success: + global error_count + error_count += 1 + print(f"=== example code from {filename} failed to compile ===") + print(code_text) + print("=== compiler output below: ===") + print(stderr.decode()) + print("========") + + return success + +def example_code_generator(): + try: + files = os.listdir(include_directory) + except: + print_and_exit(f"Error accessing directory '{include_directory}': {e}") + try: + for filename in files: + file_path = os.path.join(include_directory, filename) + if os.path.isfile(file_path): + try: + with open(file_path, "r") as f: + header_text = f.read() + is_cpp = filename.endswith(".hpp") + # This pattern matches all lines between the \code and \endcode markers + pattern = r"(^.+\\code\n)((.*\n)+?)(^.+\\endcode)" + for match in re.finditer(pattern, header_text, re.MULTILINE): + code_block = match.group(2) + lines = code_block.splitlines() + # Remove the leading * from each line + cleaned_lines = [re.sub(r"^\s*\* ?", "", line) for line in lines] + include_apix = "#include \"pros/apix.h\"" if filename == "apix.h" else "" + code_snippet = f"#include \"main.h\"\n{include_apix}\n"+"\n".join(cleaned_lines) + yield code_snippet, filename, is_cpp + except Exception as e: + print_and_exit(f"Error reading file '{filename}': {e}") + except Exception as e: + print_and_exit(f"Error accessing directory '{include_directory}': {e}") + +async def main(): + with tempfile.TemporaryDirectory() as tmpdirname: + global precompiled_include_directory + precompiled_include_directory = tmpdirname + precompile_header() + async with asyncio.TaskGroup() as tg: + tasks = [tg.create_task(compile_code(*item)) for item in example_code_generator()] + results = [task.result() for task in tasks] + global error_count + if error_count > 0: + print_and_exit(f"{error_count} compile errors encountered") + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/include/api.h b/include/api.h index 5ba908b3..f4c712cb 100644 --- a/include/api.h +++ b/include/api.h @@ -56,6 +56,7 @@ #include "pros/rotation.h" #include "pros/rtos.h" #include "pros/screen.h" +#include "pros/serial.h" #include "pros/vision.h" #ifdef __cplusplus @@ -75,6 +76,7 @@ #include "pros/rotation.hpp" #include "pros/rtos.hpp" #include "pros/screen.hpp" +#include "pros/serial.hpp" #include "pros/vision.hpp" #endif diff --git a/include/pros/abstract_motor.hpp b/include/pros/abstract_motor.hpp index fd8e8034..2c3489ba 100644 --- a/include/pros/abstract_motor.hpp +++ b/include/pros/abstract_motor.hpp @@ -41,6 +41,9 @@ enum class MotorBrake { invalid = INT32_MAX ///< Invalid brake mode }; +// TODO: implement +std::ostream& operator<<(std::ostream& os, MotorBrake brake_mode); + /** * \enum MotorEncoderUnits * Indicates the units used by the motor encoders. @@ -53,6 +56,9 @@ enum class MotorEncoderUnits { invalid = INT32_MAX ///< Invalid motor encoder units }; +// TODO: implement +std::ostream& operator<<(std::ostream& os, MotorEncoderUnits brake_mode); + // Alias for MotorEncoderUnits using MotorUnits = MotorEncoderUnits; @@ -69,6 +75,9 @@ enum class MotorGears { invalid = INT32_MAX ///< Error return code }; +// TODO: implement +std::ostream& operator<<(std::ostream& os, MotorGears brake_mode); + /** * \enum MotorType * Indicates the type of a motor @@ -79,6 +88,8 @@ enum class MotorType { invalid = INT32_MAX ///< Error return code }; +// TODO: implement +std::ostream& operator<<(std::ostream& os, MotorType brake_mode); // Provide Aliases for MotorGears using MotorGearset = MotorGears; @@ -172,8 +183,8 @@ class AbstractMotor { * * This velocity corresponds to different actual speeds depending on the * gearset used for the motor. This results in a range of +-100 for - * E_MOTOR_GEARSET_36, +-200 for E_MOTOR_GEARSET_18, and +-600 for - * E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent + * pros::E_MOTOR_GEARSET_36, +-200 for pros::E_MOTOR_GEARSET_18, and +-600 for + * pros::E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent * speed, as opposed to setting the motor's voltage. * * This function uses the following values of errno when an error state is @@ -770,7 +781,7 @@ class AbstractMotor { * By default index is 0, and will return an error for an out of bounds index * * \return One of MotorBrake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor, or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. */ virtual MotorBrake get_brake_mode(const std::uint8_t index = 0) const = 0; @@ -786,7 +797,7 @@ class AbstractMotor { * By default index is 0, and will return an error for an out of bounds index * * \return A vector containing MotorBrake(s), according to what was set for the - * motor(s), or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor(s), or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. */ virtual std::vector get_brake_mode_all(void) const = 0; @@ -838,7 +849,7 @@ class AbstractMotor { * By default index is 0, and will return an error for an out of bounds index * * \return One of MotorUnits according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor or pros::E_MOTOR_ENCODER_INVALID if the operation failed. */ virtual MotorUnits get_encoder_units(const std::uint8_t index = 0) const = 0; @@ -854,7 +865,7 @@ class AbstractMotor { * By default index is 0, and will return an error for an out of bounds index * * \return A vector of MotorUnits according to what is set for the - * motor(s) or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor(s) or pros::E_MOTOR_ENCODER_INVALID if the operation failed. */ virtual std::vector get_encoder_units_all(void) const = 0; diff --git a/include/pros/adi.h b/include/pros/adi.h index 0b45e57d..8be95575 100644 --- a/include/pros/adi.h +++ b/include/pros/adi.h @@ -196,7 +196,7 @@ adi_port_config_e_t adi_port_get_config(uint8_t port); * * void opcontrol() { * adi_port_set_config(ANALOG_SENSOR_PORT, E_ADI_ANALOG_IN); - * printf("Port Value: %d\n", adi_get_value(ANALOG_SENSOR_PORT)); + * printf("Port Value: %d\n", adi_port_get_value(ANALOG_SENSOR_PORT)); * } * \endcode */ @@ -253,7 +253,7 @@ int32_t adi_port_set_config(uint8_t port, adi_port_config_e_t type); * * void initialize() { * adi_port_set_config(DIGITAL_SENSOR_PORT, E_ADI_DIGITAL_OUT); - * adi_set_value(DIGITAL_SENSOR_PORT, HIGH); + * adi_port_set_value(DIGITAL_SENSOR_PORT, HIGH); * } * \endcode */ @@ -495,7 +495,7 @@ int32_t adi_digital_get_new_press(uint8_t port); * * \b Example * \code - * #define DIGITAL_SENSOR_PORT + * #define DIGITAL_SENSOR_PORT 1 * * void opcontrol() { * bool state = LOW; @@ -1114,9 +1114,9 @@ adi_potentiometer_t adi_potentiometer_type_init(uint8_t port, adi_potentiometer_ * #define POTENTIOMETER_PORT 1 * * void opcontrol() { - * adi_potentiometer_t potentiometer = adi_potentiometer_t(POTENTIOMETER_PORT); + * adi_potentiometer_t potentiometer = POTENTIOMETER_PORT; * while (true) { - * // Print the potnetiometer's angle + * // Print the potentiometer's angle * printf("Angle: %lf\n", adi_potentiometer_get_angle(potentiometer)); * delay(5); * } @@ -1192,7 +1192,7 @@ adi_led_t adi_led_init(uint8_t port); * delay(5); * * // Clear the led strip - * adi_led_clear(led); + * adi_led_clear_all(led, buffer, 10); * delay(5); * } * } diff --git a/include/pros/adi.hpp b/include/pros/adi.hpp index f01615d7..6020144f 100644 --- a/include/pros/adi.hpp +++ b/include/pros/adi.hpp @@ -72,13 +72,13 @@ class Port { * pros::ADIPotentiometer potentiometer (POTENTIOMETER_PORT, POTENTIOMETER_TYPE); * while (true) { * // Get the potentiometer angle - * std::cout << "Angle: " << potnetiometer.get_angle(); + * std::cout << "Angle: " << potentiometer.get_angle(); * pros::delay(10); * } * } * \endcode */ - explicit Port(std::uint8_t adi_port, adi_port_config_e_t type = E_ADI_TYPE_UNDEFINED); + explicit Port(std::uint8_t adi_port, adi_port_config_e_t type = pros::E_ADI_TYPE_UNDEFINED); /** * Configures an ADI port on an adi expander to act as a given sensor type. @@ -100,13 +100,13 @@ class Port { * #define EXT_ADI_SMART_PORT 1 * * void initialize() { - * pros::adi::Port sensor ({EXT_ADI_SMART_PORT, ANALOG_SENSOR_PORT}, E_ADI_ANALOG_IN); - * // Displays the value of E_ADI_ANALOG_IN + * pros::adi::Port sensor ({EXT_ADI_SMART_PORT, ANALOG_SENSOR_PORT}, pros::E_ADI_ANALOG_IN); + * // Displays the value of pros::E_ADI_ANALOG_IN * std::cout << "Port Type: " << sensor.get_config(); * } * \endcode */ - explicit Port(ext_adi_port_pair_t port_pair, adi_port_config_e_t type = E_ADI_TYPE_UNDEFINED); + explicit Port(ext_adi_port_pair_t port_pair, adi_port_config_e_t type = pros::E_ADI_TYPE_UNDEFINED); /** * Gets the configuration for the given ADI port. @@ -117,9 +117,9 @@ class Port { * \code * #define ANALOG_SENSOR_PORT 1 * void initialize() { - * adi_port_set_config(ANALOG_SENSOR_PORT, E_ADI_ANALOG_IN); - * // Displays the value of E_ADI_ANALOG_IN - * printf("Port Type: %d\n", adi_port_get_config(ANALOG_SENSOR_PORT)); + * pros::c::adi_port_set_config(ANALOG_SENSOR_PORT, pros::E_ADI_ANALOG_IN); + * // Displays the value of pros::E_ADI_ANALOG_IN + * printf("Port Type: %d\n", pros::c::adi_port_get_config(ANALOG_SENSOR_PORT)); * } * \endcode */ @@ -135,7 +135,7 @@ class Port { * #define ANALOG_SENSOR_PORT 1 * * void opcontrol() { - * pros::adi::Port sensor (ANALOG_SENSOR_PORT, E_ADI_ANALOG_IN); + * pros::adi::Port sensor (ANALOG_SENSOR_PORT, pros::E_ADI_ANALOG_IN); * std::cout << "Port Value: " << sensor.get_value(); * } * \endcode @@ -156,10 +156,10 @@ class Port { * #define ANALOG_SENSOR_PORT 1 * * void initialize() { - * pros::adi::Port sensor (ANALOG_SENSOR_PORT, E_ADI_DIGITAL_IN); + * pros::adi::Port sensor (ANALOG_SENSOR_PORT, pros::E_ADI_DIGITAL_IN); * // Do things as a digital sensor * // Digital is unplugged and an analog is plugged in - * sensor.set_config(E_ADI_ANALOG_IN); + * sensor.set_config(pros::E_ADI_ANALOG_IN); * } * \endcode */ @@ -182,8 +182,8 @@ class Port { * #define DIGITAL_SENSOR_PORT 1 * * void initialize() { - * pros::adi::Port sensor (DIGITAL_SENSOR_PORT, E_ADI_DIGITAL_OUT); - * sensor.set_value(DIGITAL_SENSOR_PORT, HIGH); + * pros::adi::Port sensor (DIGITAL_SENSOR_PORT, pros::E_ADI_DIGITAL_OUT); + * sensor.set_value(HIGH); * } * \endcode */ @@ -272,7 +272,7 @@ class AnalogIn : protected Port { * * \b Example * \code - * #define EXT_ADI_SENSOR_PORT 1 + * #define EXT_ADI_SMART_PORT 1 * #define ADI_PORT 'a' * * void opcontrol() { @@ -316,7 +316,7 @@ class AnalogIn : protected Port { * * void initialize() { * pros::adi::AnalogIn sensor (ANALOG_SENSOR_PORT); - * sensor.calibrate(ANALOG_SENSOR_PORT); + * sensor.calibrate(); * std::cout << "Calibrated Reading:" << sensor.get_value_calibrated(); * // All readings from then on will be calibrated * } @@ -345,7 +345,7 @@ class AnalogIn : protected Port { * * void initialize() { * pros::adi::AnalogIn sensor (ANALOG_SENSOR_PORT); - * sensor.calibrate(ANALOG_SENSOR_PORT); + * sensor.calibrate(); * std::cout << "Calibrated Reading:" << sensor.get_value_calibrated(); * // All readings from then on will be calibrated * } @@ -379,7 +379,7 @@ class AnalogIn : protected Port { * * void initialize() { * pros::adi::AnalogIn sensor (ANALOG_SENSOR_PORT); - * sensor.calibrate(ANALOG_SENSOR_PORT); + * sensor.calibrate(); * std::cout << "Calibrated Reading:" << sensor.get_value_calibrated(); * // All readings from then on will be calibrated * } @@ -456,10 +456,10 @@ class AnalogOut : private Port { * #define ANALOG_SENSOR_PORT 1 * * void opcontrol() { - * pros::AnalogOut sensor (ANALOG_SENSOR_PORT); + * pros::adi::AnalogOut sensor (ANALOG_SENSOR_PORT); * // Use the sensor * } - * @endcode + * \endcode */ explicit AnalogOut(std::uint8_t adi_port); @@ -481,7 +481,7 @@ class AnalogOut : private Port { * #define ADI_PORT 'a' * * void opcontrol() { - * pros::AnalogOut sensor ({EXT_ADI_SMART_PORT, ADI_PORT}); + * pros::adi::AnalogOut sensor ({EXT_ADI_SMART_PORT, ADI_PORT}); * // Use the sensor * } * \endcode @@ -507,7 +507,7 @@ class AnalogOut : private Port { * #define ANALOG_SENSOR_PORT 1 * * void opcontrol() { - * pros::AnalogOut sensor (ANALOG_SENSOR_PORT); + * pros::adi::AnalogOut sensor (ANALOG_SENSOR_PORT); * sensor.set_value(4095); // Set the port to 5V * } * \endcode @@ -661,7 +661,7 @@ class DigitalIn : private Port { * #define DIGITAL_SENSOR_PORT 1 * * void opcontrol() { - * pros::adi::DigitalIn sensor (ANALOG_SENSOR_PORT); + * pros::adi::DigitalIn sensor (DIGITAL_SENSOR_PORT); * // Use the sensor * } * \endcode @@ -798,7 +798,7 @@ class Motor : private Port { * pros::adi::Motor motor (MOTOR_PORT); * motor.set_value(127); // Go full speed forward * std::cout << "Commanded Motor Power: " << motor.get_value(); // Will display 127 - * delay(1000); + * pros::delay(1000); * motor.set_value(0); // Stop the motor * } * \endcode @@ -826,7 +826,7 @@ class Motor : private Port { * pros::adi::Motor motor ({EXT_ADI_SMART_PORT, ADI_MOTOR_PORT}); * motor.set_value(127); // Go full speed forward * std::cout << "Commanded Motor Power: " << motor.get_value(); // Will display 127 - * delay(1000); + * pros::delay(1000); * motor.set_value(0); // Stop the motor * } * \endcode @@ -851,7 +851,7 @@ class Motor : private Port { * pros::adi::Motor motor (MOTOR_PORT); * motor.set_value(127); // Go full speed forward * std::cout << "Commanded Motor Power: " << motor.get_value(); // Will display 127 - * delay(1000); + * pros::delay(1000); * motor.stop(); // Stop the motor * } * \endcode @@ -880,7 +880,7 @@ class Motor : private Port { * pros::adi::Motor motor (MOTOR_PORT); * motor.set_value(127); // Go full speed forward * std::cout << "Commanded Motor Power: " << motor.get_value(); // Will display 127 - * delay(1000); + * pros::delay(1000); * motor.set_value(0); // Stop the motor * } * \endcode @@ -904,7 +904,7 @@ class Motor : private Port { * pros::adi::Motor motor (MOTOR_PORT); * motor.set_value(127); // Go full speed forward * std::cout << "Commanded Motor Power: " << motor.get_value(); // Will display 127 - * delay(1000); + * pros::delay(1000); * motor.set_value(0); // Stop the motor * } * \endcode @@ -999,7 +999,7 @@ class Encoder : private Port { * * void opcontrol() { * pros::adi::Encoder sensor (PORT_TOP, PORT_BOTTOM, false); - * delay(1000); // Move the encoder around in this time + * pros::delay(1000); // Move the encoder around in this time * sensor.reset(); // The encoder is now zero again * } * \endcode @@ -1108,7 +1108,7 @@ class Ultrasonic : private Port { * #define SMART_PORT 1 * * void opcontrol() { - * pros::adi::Ultrasonic sensor ( {{ SMART_PORT, PORT_PING, PORT_ECHO }} ); + * pros::adi::Ultrasonic sensor ( { SMART_PORT, PORT_PING, PORT_ECHO } ); * while (true) { * // Print the distance read by the ultrasonic * std::cout << "Distance: " << sensor.get_value(); @@ -1342,7 +1342,7 @@ class Potentiometer : public AnalogIn { * } * \endcode */ - explicit Potentiometer(std::uint8_t adi_port, adi_potentiometer_type_e_t potentiometer_type = E_ADI_POT_EDR); + explicit Potentiometer(std::uint8_t adi_port, adi_potentiometer_type_e_t potentiometer_type = pros::E_ADI_POT_EDR); /** * Configures an ADI port on an adi_expander to act as a Potentiometer. @@ -1373,7 +1373,7 @@ class Potentiometer : public AnalogIn { * } * \endcode */ - explicit Potentiometer(ext_adi_port_pair_t port_pair, adi_potentiometer_type_e_t potentiometer_type = E_ADI_POT_EDR); + explicit Potentiometer(ext_adi_port_pair_t port_pair, adi_potentiometer_type_e_t potentiometer_type = pros::E_ADI_POT_EDR); /** * Gets the current potentiometer angle in tenths of a degree. @@ -1394,7 +1394,7 @@ class Potentiometer : public AnalogIn { * #define SMART_PORT 1 * * void opcontrol() { - * pros::adi::Potentiometer potentiometer ({{ SMART_PORT , ADI_POTENTIOMETER_PORT }}); + * pros::adi::Potentiometer potentiometer ({ SMART_PORT , ADI_POTENTIOMETER_PORT }); * while (true) { * // Get the potentiometer angle * std::cout << "Angle: " << potentiometer.get_angle(); @@ -1495,7 +1495,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set entire LED strip to red * led.set_all(0xFF0000); @@ -1528,7 +1528,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led ({SMART_PORT, LED_PORT}, LED_LENGTH); + * pros::adi::Led led ({SMART_PORT, LED_PORT}, LED_LENGTH); * while (true) { * // Set entire LED strip to red * led.set_all(0xFF0000); @@ -1552,7 +1552,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the first 3 pixels to red, green, and blue * led.set_pixel(0xFF0000, 0); @@ -1566,6 +1566,7 @@ class Led : protected Port { * pros::delay(20); * } * } + * \endcode */ std::uint32_t& operator[](size_t i); @@ -1586,7 +1587,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the first 3 pixels to red, green, and blue * led.set_pixel(0xFF0000, 0); @@ -1621,7 +1622,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the first 3 pixels to red, green, and blue * led.set_pixel(0xFF0000, 0); @@ -1657,7 +1658,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the entire led strip to blue * led.set_all(0x0000FF); @@ -1686,7 +1687,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the first pixel to blue * led.set_pixel(0x0000FF, 0); @@ -1714,7 +1715,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Set the first pixel to blue * led.set_pixel(0x0000FF, 0); @@ -1745,7 +1746,7 @@ class Led : protected Port { * #define LED_LENGTH 3 * * void opcontrol() { - * pros::Led led (LED_PORT, LED_LENGTH); + * pros::adi::Led led (LED_PORT, LED_LENGTH); * while (true) { * // Get the length of the led strip * int length = led.length(); @@ -1810,13 +1811,13 @@ class Pneumatics : public DigitalOut { * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_R1)) { * left_piston.extend(); * } - * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_2)) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) { * left_piston.retract(); * } * * pros::delay(10); * } - * + * } * \endcode */ explicit Pneumatics(std::uint8_t adi_port, bool start_extended, bool extended_is_low = false); @@ -1844,8 +1845,7 @@ class Pneumatics : public DigitalOut { * \code * void opcontrol() { * pros::adi::Pneumatics left_piston({1, 'a'}, false); // Starts retracted, extends when the ADI port is high - * pros::adi::Pneumatics right_piston({1, 'b'}, false, true); // Starts retracted, extends when the ADI port is - *low + * pros::adi::Pneumatics right_piston({1, 'b'}, false, true); // Starts retracted, extends when the ADI port is low * * pros::Controller master(pros::E_CONTROLLER_MASTER); * @@ -1886,13 +1886,13 @@ class Pneumatics : public DigitalOut { * * while (true) { * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { - * left_piston.extend(); + * piston.extend(); * } * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_B)) { - * left_piston.retract(); + * piston.retract(); * } - * if(mastetr.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { - * left_piston.toggle(); + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { + * piston.toggle(); * } * * pros::delay(10); @@ -1917,13 +1917,13 @@ class Pneumatics : public DigitalOut { * * while (true) { * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { - * left_piston.extend(); + * piston.extend(); * } * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_B)) { - * left_piston.retract(); + * piston.retract(); * } - * if(mastetr.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { - * left_piston.toggle(); + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { + * piston.toggle(); * } * * pros::delay(10); @@ -1952,13 +1952,13 @@ class Pneumatics : public DigitalOut { * * while (true) { * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { - * left_piston.extend(); + * piston.extend(); * } * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_B)) { - * left_piston.retract(); + * piston.retract(); * } - * if(mastetr.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { - * left_piston.toggle(); + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { + * piston.toggle(); * } * * pros::delay(10); @@ -1978,7 +1978,7 @@ class Pneumatics : public DigitalOut { * #define ADI_PNEUMATICS_PORT 'a' * * void opcontrol() { - * pros::adi::Pneumatics pneumatics (ADI_PNEUMATICS_PORT); + * pros::adi::Pneumatics pneumatics(ADI_PNEUMATICS_PORT, false); * while (true) { * // Check if the piston is extended * if (pneumatics.is_extended()) { diff --git a/include/pros/ai_vision.h b/include/pros/ai_vision.h index 5deea418..beeff784 100644 --- a/include/pros/ai_vision.h +++ b/include/pros/ai_vision.h @@ -266,7 +266,7 @@ int32_t aivision_set_enabled_detection_types(uint8_t port, uint8_t bits, uint8_t * #define AIVISION_PORT 1 * void initialize() { * // start or continue looking for AI model objects - * aivision_enable_detection_types(AIVISION_PORT, aivision_mode_type_e_t::E_AIVISION_MODE_OBJECTS); + * aivision_enable_detection_types(AIVISION_PORT, E_AIVISION_MODE_OBJECTS); * } * \endcode * @@ -291,7 +291,7 @@ int32_t aivision_enable_detection_types(uint8_t port, uint8_t types_mask); * #define AIVISION_PORT 1 * void initialize() { * // stop looking for AI model objects (competition elements, for example) - * aivision_disable_detection_types(AIVISION_PORT, aivision_mode_type_e_t::E_AIVISION_MODE_OBJECTS); + * aivision_disable_detection_types(AIVISION_PORT, E_AIVISION_MODE_OBJECTS); * } * \endcode * diff --git a/include/pros/ai_vision.hpp b/include/pros/ai_vision.hpp index 30863d55..f645dcfc 100644 --- a/include/pros/ai_vision.hpp +++ b/include/pros/ai_vision.hpp @@ -107,8 +107,7 @@ class AIVision : public Device { * \b Example * \code * void opcontrol() { - * std::vector aivision_all = pros::AIVision::get_all_devices(); // All AI vision sensors that are - * connected + * std::vector aivision_all = pros::AIVision::get_all_devices(); // All AI vision sensors that are connected * } * \endcode */ @@ -124,13 +123,13 @@ class AIVision : public Device { * void opcontrol() { * pros::AIVision aivision(1); * pros::AIVision::Object object = aivision.get_object(0); - * if (AIVision::is_type(AivisionDetectType::color, object)) { + * if (object.is_type(pros::AivisionDetectType::color, object)) { * printf("is color\n"); - * } else if (AIVision::is_type(AivisionDetectType::object, object)) { + * } else if (object.is_type(pros::AivisionDetectType::object, object)) { * printf("is object\n"); - * } else if (AIVision::is_type(AivisionDetectType::code, object)) { + * } else if (object.is_type(pros::AivisionDetectType::code, object)) { * printf("is code\n"); - * } else if (AIVision::is_type(AivisionDetectType::tag, object)) { + * } else if (object.is_type(pros::AivisionDetectType::tag, object)) { * printf("is tag\n"); * } else { * printf("unknown\n"); @@ -183,7 +182,7 @@ class AIVision : public Device { * void initialize() { * pros::AIVision aivision(AIVISION_PORT); * int32_t enabled_types = aivision.get_enabled_detection_types(); - * printf("is tag: %d\n", enabled_types | AivisionModeType::tags); + * printf("is tag: %d\n", enabled_types | pros::AivisionModeType::tags); * } * \endcode */ @@ -208,7 +207,7 @@ class AIVision : public Device { * pros::AIVision aivision(AIVISION_PORT); * // start or continue looking for AI model objects * // enable aivision to look for tags and objects - * aivision.enable_detection_types(AivisionModeType::tags | AivisionModeType::objects); + * aivision.enable_detection_types(pros::AivisionModeType::tags | pros::AivisionModeType::objects); * } * \endcode * @@ -237,7 +236,7 @@ class AIVision : public Device { * pros::AIVision aivision(AIVISION_PORT); * // start or continue looking for AI model objects * // enable aivision to look for tags and objects - * aivision.enable_detection_types(AivisionModeType::tags, AivisionModeType::objects); + * aivision.enable_detection_types(pros::AivisionModeType::tags, pros::AivisionModeType::objects); * } * \endcode * @@ -270,7 +269,7 @@ class AIVision : public Device { * pros::AIVision aivision(AIVISION_PORT); * // stop looking for AI model objects (competition elements, for example) * // disable aivision to look for tags and objects - * aivision.disable_detection_types(AivisionModeType::tags | AivisionModeType::objects); + * aivision.disable_detection_types(pros::AivisionModeType::tags | pros::AivisionModeType::objects); * } * \endcode * @@ -298,7 +297,7 @@ class AIVision : public Device { * pros::AIVision aivision(AIVISION_PORT); * // stop looking for AI model objects (competition elements, for example) * // disable aivision to look for tags and objects - * aivision.disable_detection_types(AivisionModeType::tags | AivisionModeType::objects); + * aivision.disable_detection_types(pros::AivisionModeType::tags | pros::AivisionModeType::objects); * } * \endcode * @@ -328,11 +327,11 @@ class AIVision : public Device { * void initialize() { * pros::AIVision aivision(AIVISION_PORT); * // set the only tag family to look for to 21H7 - * aivision.set_tag_family(AivisionTagFamily::tag_21H7); + * aivision.set_tag_family(pros::AivisionTagFamily::tag_21H7); * // add 16H5 to the list of enabled tag families - * aivision.set_tag_family(AivisionTagFamily::tag_16H5); + * aivision.set_tag_family(pros::AivisionTagFamily::tag_16H5); * // set the only tag family to look for to 25H9 - * aivision.set_tag_family(AivisionTagFamily::tag_25H9, true); + * aivision.set_tag_family(pros::AivisionTagFamily::tag_25H9, true); * } * \endcode * @@ -357,7 +356,7 @@ class AIVision : public Device { * #define AIVISION_PORT 1 * void opcontrol() { * pros::AIVision aivision(AIVISION_PORT); - * AIVision::Color color = {1, 207, 19, 25, 10.00, 0.20}; + * pros::AIVision::Color color = {1, 207, 19, 25, 10.00, 0.20}; * aivision.set_color(color); * } * \endcode @@ -382,7 +381,7 @@ class AIVision : public Device { * #define AIVISION_PORT 1 * void opcontrol() { * pros::AIVision aivision(AIVISION_PORT); - * AIVision::Code color = aivision.get_color(0); + * pros::AIVision::Code color = aivision.get_color(0); * printf("id: %d, red: %d, green: %d, blue: %d, hue_range: %f, saturation_range: %f\n", * color.id, color.red, color.green, color.blue, color.hue_range, color.saturation_range); * } @@ -408,7 +407,7 @@ class AIVision : public Device { * #define AIVISION_PORT 1 * void opcontrol() { * pros::AIVision aivision(AIVISION_PORT); - * AIVision::Code code = {1, 207, 19, 25, 10.00, 0.20}; + * pros::AIVision::Code code = {1, 207, 19, 25, 10, 0}; * aivision.set_code(code); * } * @@ -434,10 +433,9 @@ class AIVision : public Device { * #define AIVISION_PORT 1 * void opcontrol() { * pros::AIVision aivision(AIVISION_PORT); - * AIVision::Code code = aivision.get_code(0); + * pros::AIVision::Code code = aivision.get_code(0); * printf("id: %d, length: %d, c1: %d, c2: %d, c3: %d, c4: %d, c5: %d\n", * code.id, code.length, code.c1, code.c2, code.c3, code.c4, code.c5); - * ) * } * * \endcode diff --git a/include/pros/apix.h b/include/pros/apix.h index dc6c5b00..89ce0e80 100644 --- a/include/pros/apix.h +++ b/include/pros/apix.h @@ -386,6 +386,7 @@ queue_t queue_create(uint32_t length, uint32_t item_size); * queue_append(queue, item, 1000); * printf("queue length: %d", queue_get_length(queue)); * } + * \endcode */ bool queue_prepend(queue_t queue, const void* item, uint32_t timeout); @@ -720,6 +721,7 @@ void enable_banner(bool enabled); * void opcontrol(void) { * serctl(SERCTL_SET_BAUDRATE, (void*) 9600); * } + * \endcode */ int32_t serctl(const uint32_t action, void* const extra_arg); diff --git a/include/pros/device.hpp b/include/pros/device.hpp index 560e03fd..e4f294d3 100644 --- a/include/pros/device.hpp +++ b/include/pros/device.hpp @@ -68,7 +68,7 @@ class Device { * #define DEVICE_PORT 1 * * void opcontrol() { - * Device device(DEVICE_PORT); + * pros::Device device(DEVICE_PORT); * } * \endcode */ @@ -84,9 +84,9 @@ class Device { * void opcontrol() { * #define DEVICE_PORT 1 * while (true) { - * Device device(DEVICE_PORT); + * pros::Device device(DEVICE_PORT); * printf("device plugged type: {port: %d}\n", device.get_port()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -103,10 +103,10 @@ class Device { * #define DEVICE_PORT 1 * * void opcontrol() { - * Device device(DEVICE_PORT); + * pros::Device device(DEVICE_PORT); * while (true) { * printf("device plugged type: {is_installed: %d}\n", device.is_installed()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -127,11 +127,11 @@ class Device { * #define DEVICE_PORT 1 * * void opcontrol() { - Device device(DEVICE_PORT); + * pros::Device device(DEVICE_PORT); * while (true) { - * DeviceType dt = device.get_plugged_type(); + * pros::DeviceType dt = device.get_plugged_type(); * printf("device plugged type: {plugged type: %d}\n", dt); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -156,9 +156,9 @@ class Device { * * void opcontrol() { * while (true) { - * DeviceType dt = pros::Device::get_plugged_type(DEVICE_PORT); + * pros::DeviceType dt = pros::Device::get_plugged_type(DEVICE_PORT); * printf("device plugged type: {plugged type: %d}\n", dt); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -175,7 +175,7 @@ class Device { * \b Example * \code * void opcontrol() { - * std::vector motor_devices = pros::Device::get_all_devices(pros::DeviceType::motor); // All Device objects are motors + * std::vector motor_devices = pros::Device::get_all_devices(pros::DeviceType::motor); // All Device objects are motors * } * \endcode */ diff --git a/include/pros/distance.hpp b/include/pros/distance.hpp index 17df3d1e..f861c965 100644 --- a/include/pros/distance.hpp +++ b/include/pros/distance.hpp @@ -52,7 +52,7 @@ class Distance : public Device { * #define DISTANCE_PORT 1 * * void opcontrol() { - * Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * } * \endcode */ @@ -75,10 +75,10 @@ class Distance : public Device { * #define DISTANCE_PORT 1 * * void opcontrol() { - Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * while (true) { * printf("Distance: %d\n", distance.get()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -102,10 +102,10 @@ class Distance : public Device { * #define DISTANCE_PORT 1 * * void opcontrol() { - Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * while (true) { * printf("Distance: %d\n", distance.get_distance()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -120,8 +120,7 @@ class Distance : public Device { * \b Example * \code * void opcontrol() { - * std::vector distance_all = pros::Distance::get_all_devices(); // All distance sensors that are - * connected + * std::vector distance_all = pros::Distance::get_all_devices(); // All distance sensors that are connected * } * \endcode */ @@ -147,10 +146,10 @@ class Distance : public Device { * #define DISTANCE_PORT 1 * * void opcontrol() { - Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * while (true) { * printf("Distance confidence: %d\n", distance.get_confidence()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -177,10 +176,10 @@ class Distance : public Device { * #define DISTANCE_PORT 1 * * void opcontrol() { - Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * while (true) { * printf("Distance object size: %d\n", distance.get_object_size()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -202,10 +201,10 @@ class Distance : public Device { * \code * * void opcontrol() { - * Distance distance(DISTANCE_PORT); + * pros::Distance distance(DISTANCE_PORT); * while (true) { * printf("Distance object velocity: %f\n", distance.get_object_velocity()); - * delay(20); + * pros::delay(20); * } * } * \endcode diff --git a/include/pros/ext_adi.h b/include/pros/ext_adi.h index 18fde003..c853a482 100644 --- a/include/pros/ext_adi.h +++ b/include/pros/ext_adi.h @@ -108,7 +108,7 @@ adi_port_config_e_t ext_adi_port_get_config(uint8_t smart_port, uint8_t adi_port * * void opcontrol() { * ext_adi_port_set_config(ADI_EXPANDER_PORT, ANALOG_SENSOR_PORT, E_ADI_ANALOG_IN); - * printf("Port Value: %d\n", ext_adi_get_value(ADI_EXPANDER_PORT, ANALOG_SENSOR_PORT)); + * printf("Port Value: %d\n", ext_adi_port_get_value(ADI_EXPANDER_PORT, ANALOG_SENSOR_PORT)); * } * \endcode */ @@ -175,7 +175,7 @@ int32_t ext_adi_port_set_config(uint8_t smart_port, uint8_t adi_port, adi_port_c * * void initialize() { * ext_adi_port_set_config(ADI_EXPANDER_PORT, DIGITAL_SENSOR_PORT, E_ADI_DIGITAL_OUT); - * ext_adi_set_value(ADI_EXPANDER_PORT, DIGITAL_SENSOR_PORT, HIGH); + * ext_adi_port_set_value(ADI_EXPANDER_PORT, DIGITAL_SENSOR_PORT, HIGH); * } * \endcode */ @@ -374,7 +374,7 @@ int32_t ext_adi_analog_read_calibrated_HR(uint8_t smart_port, uint8_t adi_port); * * void opcontrol() { * while (true) { - * printf(“Sensor Value: %dn”, + * printf("Sensor Value: %dn", * ext_adi_digital_read(ADI_EXPANDER_PORT, DIGITAL_SENSOR_PORT)); * delay(5); * } @@ -552,13 +552,13 @@ int32_t ext_adi_motor_set(uint8_t smart_port, uint8_t adi_port, int8_t speed); * \b Example * \code * - * #define ADI_EXPANDER_PORT 20 # - * define MOTOR_PORT 1 + * #define ADI_EXPANDER_PORT 20 + * #define MOTOR_PORT 1 * * void opcontrol() { * ext_adi_motor_set(ADI_EXPANDER_PORT, * MOTOR_PORT, 127); // Go full speed forward - * printf(“Commanded Motor Power: %dn”, + * printf("Commanded Motor Power: %dn", * ext_adi_motor_get(ADI_EXPANDER_PORT, MOTOR_PORT)); // Will display 127 * delay(1000); * ext_adi_motor_set(ADI_EXPANDER_PORT, MOTOR_PORT, 0); // Stop the motor @@ -628,13 +628,14 @@ typedef int32_t ext_adi_encoder_t; * \code * * #define ADI_EXPANDER_PORT 20 - * #define PORT_TOP 1 #define PORT_BOTTOM 2 + * #define PORT_TOP 1 + * #define PORT_BOTTOM 2 * * void opcontrol() { * ext_adi_encoder_t enc = ext_adi_encoder_init(ADI_EXPANDER_PORT, * PORT_TOP, PORT_BOTTOM, false); * while (true) { - * printf(“Encoder Value: %dn”, + * printf("Encoder Value: %dn", * ext_adi_encoder_get(enc)); * delay(5); * } diff --git a/include/pros/gps.h b/include/pros/gps.h index 5cc5eef3..277e162c 100644 --- a/include/pros/gps.h +++ b/include/pros/gps.h @@ -648,7 +648,7 @@ double gps_get_heading_raw(uint8_t port); * gps_gyro_s_t gyro; * * while (true) { - * gyro = gps_get_gyro(GPS_PORT); + * gyro = gps_get_gyro_rate(GPS_PORT); * printf("Gyro: %f %f %f\n", gyro.x, gyro.y, gyro.z); * delay(20); * } @@ -679,7 +679,7 @@ gps_gyro_s_t gps_get_gyro_rate(uint8_t port); * double gyro_x; * * while (true) { - * gyro_x = gps_get_gyro_x(GPS_PORT); + * gyro_x = gps_get_gyro_rate_x(GPS_PORT); * printf("gyro_x: %f\n", gyro_x); * delay(20); * } @@ -710,7 +710,7 @@ double gps_get_gyro_rate_x(uint8_t port); * double gyro_y; * * while (true) { - * gyro_y = gps_get_gyro_y(GPS_PORT); + * gyro_y = gps_get_gyro_rate_y(GPS_PORT); * printf("gyro_y: %f\n", gyro_y); * delay(20); * } @@ -741,7 +741,7 @@ double gps_get_gyro_rate_y(uint8_t port); * double gyro_z; * * while (true) { - * gyro_z = gps_get_gyro_z(GPS_PORT); + * gyro_z = gps_get_gyro_rate_z(GPS_PORT); * printf("gyro_z: %f\n", gyro_z); * delay(20); * } diff --git a/include/pros/gps.hpp b/include/pros/gps.hpp index b9fc7b5a..a3b56d92 100644 --- a/include/pros/gps.hpp +++ b/include/pros/gps.hpp @@ -179,11 +179,11 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT, 1.1, 1.2, 180, .4, .4); + * pros::Gps gps(GPS_PORT, 1.1, 1.2, 180, .4, .4); * // this is equivalent to the above line * gps.initialize_full(1.1, 1.2, 180, .4, .4); * while (true) { - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -212,11 +212,11 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT, 1.1, 1.2, 180, .4, .4); + * pros::Gps gps(GPS_PORT, 1.1, 1.2, 180, .4, .4); * // this is equivalent to the above line * gps.set_offset(.4, .4); * while (true) { - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -232,7 +232,7 @@ class Gps : public Device { * \b Example * \code * void opcontrol() { - * std::vector gps_all = pros::Gps::get_all_devices(); // All GPS sensors that are connected + * std::vector gps_all = pros::Gps::get_all_devices(); // All GPS sensors that are connected * } * \endcode */ @@ -257,12 +257,12 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * gps_position_s_t pos; - * Gps gps(GPS_PORT); + * pros::gps_position_s_t pos; + * pros::Gps gps(GPS_PORT); * while (true) { - * pos = gps.get_offset(); - * screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); - * delay(20); + * pros::gps_position_s_t pos = gps.get_offset(); + * pros::c::screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); + * pros::delay(20); * } * } * \endcode @@ -292,12 +292,12 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * gps.set_position(1.3, 1.4, 180); * while (true) { * printf("X: %f, Y: %f, Heading: %f\n", gps.get_position().x, - * gps.get_position().y, gps.get_position().heading); - * delay(20); + * gps.get_position().y, gps.get_heading()); + * pros::delay(20); * } * } * \endcode @@ -323,12 +323,12 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * gps.set_data_rate(10); * while (true) { * printf("X: %f, Y: %f, Heading: %f\n", gps.get_position().x, - * gps.get_position().y, gps.get_position().heading); - * delay(10); + * gps.get_position().y, gps.get_heading()); + * pros::delay(10); * } * } * \endcode @@ -352,7 +352,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * double error = gps.get_error(); * printf("Error: %f\n", error); * pros::delay(20); @@ -380,13 +380,13 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); - * gps_status_s_t status; + * pros::Gps gps(GPS_PORT); + * pros::gps_status_s_t status; * while (true) { * status = gps.get_position_and_orientation(); * printf("X: %f, Y: %f, Roll: %f, Pitch: %f, Yaw: %f\n", * status.x, status.y, status.roll, status.pitch, status.yaw); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -411,12 +411,12 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); - * gps_position_s_t position; + * pros::Gps gps(GPS_PORT); + * pros::gps_position_s_t position; * while (true) { * position = gps.get_position(); * printf("X: %f, Y: %f\n", position.x, position.y); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -440,7 +440,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double pos_x = gps.get_position_x(); * printf("X: %f\n", pos_x); @@ -468,7 +468,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double pos_y = gps.get_position_y(); * printf("Y: %f\n", pos_y); @@ -497,13 +497,13 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); - * gps_orientation_s_t orientation; + * pros::Gps gps(GPS_PORT); + * pros::gps_orientation_s_t orientation; * while (true) { * orientation = gps.get_orientation(); * printf("pitch: %f, roll: %f, yaw: %f\n", orientation.pitch, * orientation.roll, orientation.yaw); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -527,7 +527,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double pitch = gps.get_pitch(); * printf("pitch: %f\n", pitch); @@ -555,7 +555,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double roll = gps.get_roll(); * printf("roll: %f\n", roll); @@ -583,7 +583,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double yaw = gps.get_yaw(); * printf("yaw: %f\n", yaw); @@ -612,7 +612,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double heading = gps.get_heading(); * printf("Heading: %f\n", heading); @@ -640,7 +640,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double heading = gps.get_heading_raw(); * printf("Heading: %f\n", heading); @@ -668,10 +668,10 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { - * double gyro_z = gps.get_gyro_z(); - * printf("gyro_z: %f\n", gyro_z); + * pros::gps_gyro_s_t gyro = gps.get_gyro_rate(); + * printf("gyro: (%f, %f, %f)\n", gyro.x, gyro.y, gyro.z); * pros::delay(20); * } * } @@ -696,9 +696,9 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { - * double gyro_x = gps.get_gyro_x(); + * double gyro_x = gps.get_gyro_rate_x(); * printf("gyro_x: %f\n", gyro_x); * pros::delay(20); * } @@ -724,9 +724,9 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { - * double gyro_y = gps.get_gyro_y(); + * double gyro_y = gps.get_gyro_rate_y(); * printf("gyro_y: %f\n", gyro_y); * pros::delay(20); * } @@ -752,9 +752,9 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { - * double gyro_z = gps.get_gyro_z(); + * double gyro_z = gps.get_gyro_rate_z(); * printf("gyro_z: %f\n", gyro_z); * pros::delay(20); * } @@ -794,7 +794,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double accel_x = gps.get_accel_x(); * printf("accel_x: %f\n", accel_x); @@ -822,7 +822,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double accel_y = gps.get_accel_y(); * printf("accel_y: %f\n", accel_y); @@ -850,7 +850,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * double accel_z = gps.get_accel_z(); * printf("accel_z: %f\n", accel_z); @@ -872,7 +872,7 @@ class Gps : public Device { * #define GPS_PORT 1 * * void opcontrol() { - * Gps gps(GPS_PORT); + * pros::Gps gps(GPS_PORT); * while(true) { * std::cout << gps << std::endl; * pros::delay(20); @@ -912,14 +912,14 @@ namespace literals { * * \b Example * \code - * using namespace literals; + * using namespace pros::literals; * * void opcontrol() { * pros::Gps gps = 1_gps; * while (true) { - * pos = gps.get_position(); - * screen_print(TEXT_MEDIUM, 1, "X Position: %4d, Y Position: %4d", pos.x, pos.y); - * delay(20); + * pros::gps_position_s_t pos = gps.get_position(); + * pros::c::screen_print(TEXT_MEDIUM, 1, "X Position: %4d, Y Position: %4d", pos.x, pos.y); + * pros::delay(20); * } * } * \endcode diff --git a/include/pros/imu.h b/include/pros/imu.h index 00ed1647..54c998fa 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -439,7 +439,7 @@ imu_status_e_t imu_get_status(uint8_t port); * * void opcontrol() { * while (true) { - * int32_t val = imu_set_euler(IMU_PORT, {45, 60, 90}); + * int32_t val = imu_set_euler(IMU_PORT, (euler_s_t){45, 60, 90}); * printf("IMU : {gyro vals: %d}\n", val); * delay(20); * } @@ -558,7 +558,7 @@ double imu_get_yaw(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_heading(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -588,7 +588,7 @@ int32_t imu_tare_heading(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_rotation(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -611,12 +611,13 @@ int32_t imu_tare_rotation(uint8_t port); * * \b Example * \code - * #define IMU_PORT 1void opcontrol() { + * #define IMU_PORT 1 + * void opcontrol() { * while (true) { * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_pitch(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -646,7 +647,7 @@ int32_t imu_tare_pitch(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_roll(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -676,7 +677,7 @@ int32_t imu_tare_roll(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_yaw(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -706,7 +707,7 @@ int32_t imu_tare_yaw(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare_euler(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -736,7 +737,7 @@ int32_t imu_tare_euler(uint8_t port); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_tare(IMU_PORT); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -774,9 +775,9 @@ int32_t imu_tare(uint8_t port); * void opcontrol() { * while (true) { * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ - * imu_set_euler(IMU_PORT, {45,45,45}); + * imu_set_euler(IMU_PORT, (euler_s_t){45,45,45}); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -808,7 +809,7 @@ int32_t imu_set_euler(uint8_t port, euler_s_t target); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_set_rotation(IMU_PORT, 45); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -841,7 +842,7 @@ int32_t imu_set_rotation(uint8_t port, double target); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_set_heading(IMU_PORT, 45); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -874,7 +875,7 @@ int32_t imu_set_heading(uint8_t port, double target); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_set_pitch(IMU_PORT, 45); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -907,7 +908,7 @@ int32_t imu_set_pitch(uint8_t port, double target); * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * imu_set_roll(IMU_PORT, 45); * } - * pros::delay(20); + * delay(20); * } * } * \endcode @@ -933,13 +934,13 @@ int32_t imu_set_roll(uint8_t port, double target); * * \b Example * \code - * #define IMU_PORT 1void opcontrol() { - * - * while (true) { - * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ - * imu_set_yaw(IMU_PORT, 45); - * } - * pros::delay(20); + * #define IMU_PORT 1 + * void opcontrol() { + * while (true) { + * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)) { + * imu_set_yaw(IMU_PORT, 45); + * } + * delay(20); * } * } * \endcode diff --git a/include/pros/imu.hpp b/include/pros/imu.hpp index 4163d857..b9b09f91 100644 --- a/include/pros/imu.hpp +++ b/include/pros/imu.hpp @@ -115,7 +115,7 @@ class Imu : public Device { * Calibration takes approximately 2 seconds and blocks during this period if * the blocking param is true, with a timeout for this operation being set a 3 * seconds as a safety margin. This function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * status flag is set properly to pros::E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. * * This function uses the following values of errno when an error state is @@ -176,7 +176,7 @@ class Imu : public Device { * while (true) { * // Set the refresh rate to 5ms * std::int32_t status = imu.set_data_rate(5); - * delay(20); + * pros::delay(20); * * // Check if the operation was successful * if (status == PROS_ERR) { @@ -199,7 +199,7 @@ class Imu : public Device { * \b Example * \code * void opcontrol() { - * std::vector imu_all = pros::Imu::get_all_devices(); // All IMU sensors that are connected + * std::vector imu_all = pros::Imu::get_all_devices(); // All IMU sensors that are connected * } * \endcode */ @@ -235,7 +235,7 @@ class Imu : public Device { * while (true) { * // Get the total number of degrees the sensor has spun * printf("Total rotation: %f\n", imu.get_rotation()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -271,7 +271,7 @@ class Imu : public Device { * while (true) { * // Get the sensor's heading * printf("Heading: %f\n", imu.get_heading()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -303,8 +303,8 @@ class Imu : public Device { * while (true) { * // Get the sensor's quaternion * pros::quaternion_s_t quat = imu.get_quaternion(); - * cout << "Quaternion: " << quat.w << ", " << quat.x << ", " << quat.y << ", " << quat.z << endl; - * delay(20); + * std::cout << "Quaternion: " << quat.w << ", " << quat.x << ", " << quat.y << ", " << quat.z << std::endl; + * pros::delay(20); * } * } * \endcode @@ -336,8 +336,8 @@ class Imu : public Device { * while (true) { * // Get the sensor's Euler angles * pros::euler_s_t euler = imu.get_euler(); - * cout << "Euler: " << euler.roll << ", " << euler.pitch << ", " << euler.yaw << endl; - * delay(20); + * std::cout << "Euler: " << euler.roll << ", " << euler.pitch << ", " << euler.yaw << std::endl; + * pros::delay(20); * } * } * \endcode @@ -368,7 +368,7 @@ class Imu : public Device { * while (true) { * // Get the sensor's pitch * printf("Pitch: %f\n", imu.get_pitch()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -398,7 +398,7 @@ class Imu : public Device { * while (true) { * // Get the sensor's roll * printf("Roll: %f\n", imu.get_roll()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -428,7 +428,7 @@ class Imu : public Device { * while (true) { * // Get the sensor's yaw * printf("Yaw: %f\n", imu.get_yaw()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -459,8 +459,8 @@ class Imu : public Device { * while (true) { * // Get the sensor's raw gyroscope values * pros::imu_gyro_s_t gyro = imu.get_gyro_rate(); - * cout << "Gyro: " << gyro.x << ", " << gyro.y << ", " << gyro.z << endl; - * delay(20); + * std::cout << "Gyro: " << gyro.x << ", " << gyro.y << ", " << gyro.z << std::endl; + * pros::delay(20); * } * } * \endcode @@ -491,13 +491,13 @@ class Imu : public Device { * while (true) { * // Set the sensor's rotation value to 10 * imu.set_rotation(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * * // Reset the sensor's rotation value to 0 * imu.tare_rotation(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -528,13 +528,13 @@ class Imu : public Device { * while (true) { * // Set the sensor's heading value to 10 * imu.set_heading(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * * // Reset the sensor's heading value to 0 * imu.tare_heading(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -565,13 +565,13 @@ class Imu : public Device { * while (true) { * // Set the sensor's pitch value to 10 * imu.set_pitch(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * * // Reset the sensor's pitch value to 0 * imu.tare_pitch(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -602,13 +602,13 @@ class Imu : public Device { * while (true) { * // Set the sensor's yaw value to 10 * imu.set_yaw(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * * // Reset the sensor's yaw value to 0 * imu.tare_yaw(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -639,13 +639,13 @@ class Imu : public Device { * while (true) { * // Set the sensor's roll value to 10 * imu.set_roll(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * * // Reset the sensor's roll value to 0 * imu.tare_roll(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -676,7 +676,7 @@ class Imu : public Device { * while (true) { * // Reset all values of the sensor to 0 * imu.tare(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -707,7 +707,7 @@ class Imu : public Device { * while (true) { * // Reset all euler values of the sensor to 0 * imu.tare_euler(); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -741,7 +741,7 @@ class Imu : public Device { * while (true) { * // Set the sensor's heading value to 10 * imu.set_heading(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -776,7 +776,7 @@ class Imu : public Device { * while (true) { * // Set the sensor's rotation value to 10 * imu.set_rotation(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -812,7 +812,7 @@ class Imu : public Device { * while (true) { * // Set the sensor's yaw value to 10 * imu.set_yaw(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -847,7 +847,7 @@ class Imu : public Device { * while (true) { * // Set the sensor's pitch value to 10 * imu.set_pitch(10); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -883,7 +883,7 @@ class Imu : public Device { * while (true) { * // Set the sensor's roll value to 100 * imu.set_roll(100); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -918,8 +918,8 @@ class Imu : public Device { * * while (true) { * // Set the sensor's euler values to 50 - * imu.set_euler(50); - * delay(20); + * imu.set_euler({50, 50, 50}); + * pros::delay(20); * * // Do something with sensor * } @@ -953,7 +953,7 @@ class Imu : public Device { * // Get the sensor's raw accelerometer values * pros::imu_accel_s_t accel = imu.get_accel(); * printf("x: %f, y: %f, z: %f\n", accel.x, accel.y, accel.z); - * delay(20); + * pros::delay(20); * * // Do something with sensor * } @@ -986,8 +986,8 @@ class Imu : public Device { * while (true) { * // Get the sensor's status * pros::ImuStatus status = imu.get_status(); - * cout << "Status: " << status << endl; - * delay(20); + * std::cout << "Status: " << status << std::endl; + * pros::delay(20); * * // Do something with sensor * } @@ -1012,7 +1012,7 @@ class Imu : public Device { * while (true) { * // Calibrate the sensor * imu.reset(); - * delay(20); + * pros::delay(20); * * // Check if the sensor is calibrating * if (imu.is_calibrating()) { diff --git a/include/pros/link.hpp b/include/pros/link.hpp index 995d433b..4d7f9369 100644 --- a/include/pros/link.hpp +++ b/include/pros/link.hpp @@ -80,9 +80,11 @@ class Link : public Device { * * \b Example: * \code - * pros::Link link(1, "my_link", pros::E_LINK_TX); - * if (link.connected()) { - * // do something + * void initialize() { + * pros::Link link(1, "my_link", pros::E_LINK_TX); + * if (link.connected()) { + * // do something + * } * } * \endcode */ @@ -104,7 +106,7 @@ class Link : public Device { * \code * void opcontrol() { * pros::Link link(1, "my_link", pros::E_LINK_TX); - * printf("Bytes available to read: %d", link.receivable_size()); + * printf("Bytes available to read: %d", link.raw_receivable_size()); * } * \endcode */ @@ -126,8 +128,9 @@ class Link : public Device { * \code * void opcontrol() { * pros::Link link(1, "my_link", pros::E_LINK_TX); - * printf("Bytes available to transmit: %d", link.transmittable_size()); + * printf("Bytes available to transmit: %d", link.raw_transmittable_size()); * } + * \endcode */ std::uint32_t raw_transmittable_size(); diff --git a/include/pros/misc.h b/include/pros/misc.h index 8123fbfd..c754174a 100644 --- a/include/pros/misc.h +++ b/include/pros/misc.h @@ -88,7 +88,7 @@ uint8_t competition_get_status(void); * } * * void initialize() { - * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIO_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); + * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIORITY_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); * } * \endcode */ @@ -125,7 +125,7 @@ uint8_t competition_is_connected(void); * } * * void initialize() { - * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIO_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); + * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIORITY_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); * } * \endcode */ @@ -155,6 +155,7 @@ uint8_t competition_is_field(void); * // connected to VEXnet Competition Switch * } * } + * \endcode */ uint8_t competition_is_switch(void); @@ -429,10 +430,10 @@ int32_t controller_get_battery_level(controller_id_e_t id); * void opcontrol() { * while (true) { * if (controller_get_digital(E_CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_A)) { - * motor_set(1, 100); + * motor_move(1, 100); * } * else { - * motor_set(1, 0); + * motor_move(1, 0); * } * delay(2); * } @@ -510,9 +511,8 @@ int32_t controller_get_digital_new_press(controller_id_e_t id, controller_digita * \b Example * \code * void opcontrol() { - * pros::Controller master(pros::E_CONTROLLER_MASTER); * while (true) { - * if (master.get_digital_new_release(pros::E_CONTROLLER_DIGITAL_A)) { + * if (controller_get_digital_new_release(E_CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_A)) { * // Toggle pneumatics or other similar actions * } * @@ -830,14 +830,14 @@ int32_t usd_is_installed(void); * \code * void opcontrol() { * char* test = (char*) malloc(128); - * pros::c::usd_list_files("/", test, 128); - * pros::delay(200); - * printf("%s\n", test); //Prints the file names in the root directory seperated by newlines - * pros::delay(100); - * pros::c::usd_list_files("/test", test, 128); - * pros::delay(200); - * printf("%s\n", test); //Prints the names of files in the folder named test seperated by newlines - * pros::delay(100); + * usd_list_files("/", test, 128); + * delay(200); + * printf("%s\n", test); // Prints the file names in the root directory seperated by newlines + * delay(100); + * usd_list_files("/test", test, 128); + * delay(200); + * printf("%s\n", test); // Prints the names of files in the folder named test seperated by newlines + * delay(100); * } * \endcode */ diff --git a/include/pros/misc.hpp b/include/pros/misc.hpp index b0a115e4..316eb6a8 100644 --- a/include/pros/misc.hpp +++ b/include/pros/misc.hpp @@ -90,8 +90,8 @@ class Controller { * void opcontrol() { * pros::Controller master(pros::E_CONTROLLER_MASTER); * while (true) { - * motor_move(1, master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); - * delay(2); + * pros::c::motor_move(1, master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * pros::delay(2); * } * } * \endcode @@ -160,12 +160,12 @@ class Controller { * pros::Controller master(pros::E_CONTROLLER_MASTER); * while (true) { * if (master.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { - * motor_set(1, 100); + * pros::c::motor_move(1, 100); * } * else { - * motor_set(1, 0); + * pros::c::motor_move(1, 0); * } - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -204,7 +204,7 @@ class Controller { * // Toggle pneumatics or other similar actions * } * - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -243,7 +243,7 @@ class Controller { * // Toggle pneumatics or other similar actions * } * - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -295,7 +295,7 @@ class Controller { * master.print(0, 0, "Counter: %d", count); * } * count++; - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -337,7 +337,7 @@ class Controller { * master.set_text(0, 0, "Example text"); * } * count++; - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -367,7 +367,7 @@ class Controller { * void opcontrol() { * pros::Controller master(pros::E_CONTROLLER_MASTER); * master.set_text(0, 0, "Example"); - * delay(100); + * pros::delay(100); * master.clear_line(0); * } * \endcode @@ -404,7 +404,7 @@ class Controller { * master.rumble(". - . -"); * } * count++; - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -431,7 +431,7 @@ class Controller { * void opcontrol() { * pros::Controller master(pros::E_CONTROLLER_MASTER); * master.set_text(0, 0, "Example"); - * delay(100); + * pros::delay(100); * master.clear(); * } * \endcode @@ -461,7 +461,7 @@ namespace battery { * \b Example * \code * void initialize() { - * printf("Battery Level: %.2f\n", get_capacity()); + * printf("Battery Level: %.2f\n", pros::battery::get_capacity()); * } * \endcode */ @@ -479,7 +479,7 @@ double get_capacity(void); * \b Example * \code * void initialize() { - * printf("Battery Current: %d\n", get_current()); + * printf("Battery Current: %d\n", pros::battery::get_current()); * } * \endcode */ @@ -497,7 +497,7 @@ int32_t get_current(void); * \b Example * \code * void initialize() { - * printf("Battery's Temperature: %.2f\n", get_temperature()); + * printf("Battery's Temperature: %.2f\n", pros::battery::get_temperature()); * } * \endcode */ @@ -515,7 +515,7 @@ double get_temperature(void); * \b Example * \code * void initialize() { - * printf("Battery's Voltage: %d\n", get_voltage()); + * printf("Battery's Voltage: %d\n", pros::battery::get_voltage()); * } * \endcode */ @@ -532,16 +532,17 @@ namespace competition { * * \b Example * \code - * void status_display_task(){ - * if(!is_connected()) { - * pros::lcd::print(0, "V5 Brain is not connected!"); - * } - * if(is_autonomous()) { - * pros::lcd::print(0, "V5 Brain is in autonomous mode!"); - * } - * if(!is_disabled()) { - * pros::lcd::print(0, "V5 Brain is disabled!"); - * } + * void status_display_task() { + * if(!pros::competition::is_connected()) { + * pros::lcd::print(0, "V5 Brain is not connected!"); + * } + * if(pros::competition::is_autonomous()) { + * pros::lcd::print(0, "V5 Brain is in autonomous mode!"); + * } + * if(pros::competition::is_disabled()) { + * pros::lcd::print(0, "V5 Brain is disabled!"); + * } + * } * \endcode */ std::uint8_t get_status(void); @@ -561,7 +562,7 @@ namespace usd { * \b Example * \code * void opcontrol() { - * printf("%i", is_installed()); + * printf("%i", pros::usd::is_installed()); * } * \endcode */ @@ -600,7 +601,7 @@ std::int32_t is_installed(void); * pros::delay(200); * printf("%s\n", test); //Prints the file names in the root directory seperated by newlines * pros::delay(100); - * pros::list_files("/test", test, 128); + * pros::usd::list_files("/test", test, 128); * pros::delay(200); * printf("%s\n", test); //Prints the names of files in the folder named test seperated by newlines * pros::delay(100); diff --git a/include/pros/motor_group.hpp b/include/pros/motor_group.hpp index c9a4a1a0..9bb3ba8d 100644 --- a/include/pros/motor_group.hpp +++ b/include/pros/motor_group.hpp @@ -65,8 +65,8 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 - * MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); + * pros::MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 + * pros::MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units * } * \endcode @@ -103,10 +103,10 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with - * with both motors using the green gearset and degrees as the encoder units - * MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); - * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units + * pros::MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with + * // both motors using the green gearset and degrees as the encoder units + * pros::MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); + * // Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units * } * \endcode */ @@ -133,10 +133,10 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with - * with both motors using the green gearset and degrees as the encoder units - * AbstractMotor abs_mtr_group = first_mg; - * MotorGroup new_mg = (MotorGroup) abs_mtr_group; + * pros::MotorGroup first_mg({1, -2}); // Creates a motor on port 1 and a reversed motor on port 2 with + * // both motors using the green gearset and degrees as the encoder units + * pros::AbstractMotor& abs_mtr_group = first_mg; + * pros::MotorGroup new_mg(abs_mtr_group); * } * \endcode */ @@ -168,10 +168,10 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void opcontrol() { - * pros::MotorGroup MotorGroup ({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::MotorGroup mg ({1,3}); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg.move(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * pros::delay(2); * } * } @@ -272,8 +272,8 @@ class MotorGroup : public virtual AbstractMotor { * * This velocity corresponds to different actual speeds depending on the * gearset used for the motor. This results in a range of +-100 for - * E_MOTOR_GEARSET_36, +-200 for E_MOTOR_GEARSET_18, and +-600 for - * E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent + * pros::E_MOTOR_GEARSET_36, +-200 for pros::E_MOTOR_GEARSET_18, and +-600 for + * pros::E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent * speed, as opposed to setting the motor's voltage. * * This function uses the following values of errno when an error state is @@ -316,6 +316,7 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void autonomous() { + * pros::MotorGroup mg({1,3}); * mg.move_voltage(12000); * pros::delay(1000); // Move at max voltage for 1 second * mg.move_voltage(0); @@ -344,10 +345,10 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void autonomous() { - * Motor motor(1); + * pros::MotorGroup mg({1,3}); * mg.move_voltage(12000); * pros::delay(1000); // Move at max voltage for 1 second - * motor.brake(); + * mg.brake(); * } * \endcode */ @@ -454,9 +455,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg ({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * mg.move_velocity(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // get the target velocity from motor at index 1. (port 3) * std::cout << "Motor Velocity: " << mg.get_target_velocity(1); * pros::delay(2); @@ -481,10 +482,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg ({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); - * std::cout << "Motor Velocity: " << mg.get_target_velocity_all(); + * mg.move_velocity(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Velocity: " << mg.get_target_velocity_all()[0]; * pros::delay(2); * } * } @@ -520,7 +521,7 @@ class MotorGroup : public virtual AbstractMotor { * void opcontrol() { * pros::MotorGroup mg({1,3}); * while (true) { - * mg = controller_get_analog(E_CONTROLLER_MASTER, E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(pros::c::controller_get_analog(pros::E_CONTROLLER_MASTER, pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // get the actual velocity from motor at index 1. (port 3) * printf("Actual velocity: %lf\n", mg.get_actual_velocity(1)); * pros::delay(2); @@ -547,7 +548,7 @@ class MotorGroup : public virtual AbstractMotor { * void opcontrol() { * pros::MotorGroup mg({1,3}); * while (true) { - * mg = controller_get_analog(E_CONTROLLER_MASTER, E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(pros::c::controller_get_analog(pros::E_CONTROLLER_MASTER, pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // get the target velocity from motor at index 1. (port 3) * printf("Actual velocity: %lf\n", mg.get_actual_velocity(1)); * pros::delay(2); @@ -578,9 +579,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * //Print the current draw for the motor at index 1. (port 3) * std::cout << "Motor Current Draw: " << mg.get_current_draw(1); * pros::delay(2); @@ -606,10 +607,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Current Draw: " << mg.get_current_draw_all(); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Current Draw: " << mg.get_current_draw_all()[0]; * pros::delay(2); * } * } @@ -638,9 +639,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * //Print the motor direction for the motor at index 1. (port 3) * std::cout << "Motor Direction: " << mg.get_direction(); * pros::delay(2); @@ -665,9 +666,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Direction: " << mg.get_direction_all()[0]; * pros::delay(2); * } @@ -702,9 +703,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * //Prints the efficiency of the motor at index 1 (port 3) * std::cout << "Motor Efficiency: " << mg.get_efficiency(1); * pros::delay(2); @@ -733,9 +734,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Efficiency: " << mg.get_efficiency_all()[0]; * pros::delay(2); * } @@ -766,9 +767,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << mg.get_faults(); * pros::delay(2); * } @@ -794,10 +795,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Faults: " << mg.get_faults_all(); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Faults: " << mg.get_faults_all()[0]; * pros::delay(2); * } * } @@ -824,9 +825,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << mg.get_faults(1); * pros::delay(2); * } @@ -851,9 +852,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << mg.get_faults_all()[0]; * pros::delay(2); * } @@ -881,9 +882,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << mg.get_position(1); * pros::delay(2); * } @@ -906,10 +907,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Position: " << mg.get_position_all(); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Position: " << mg.get_position_all()[0]; * pros::delay(2); * } * } @@ -936,9 +937,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Power: " << mg.get_power(); * pros::delay(2); * } @@ -961,9 +962,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Power: " << mg.get_power_all()[0]; * pros::delay(2); * } @@ -997,9 +998,9 @@ class MotorGroup : public virtual AbstractMotor { * void opcontrol() { * std::uint32_t now = pros::millis(); * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << mg.get_raw_position(&now); * pros::delay(2); * } @@ -1027,9 +1028,9 @@ class MotorGroup : public virtual AbstractMotor { * void opcontrol() { * std::uint32_t now = pros::millis(); * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << mg.get_raw_position_all(&now)[0]; * pros::delay(2); * } @@ -1057,9 +1058,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Temperature: " << mg.get_temperature(); * pros::delay(2); * } @@ -1082,9 +1083,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Temperature: " << mg.get_temperature_all()[1]; * pros::delay(2); * } @@ -1111,9 +1112,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Torque: " << mg.get_torque(); * pros::delay(2); * } @@ -1136,9 +1137,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Torque: " << mg.get_torque(); * pros::delay(2); * } @@ -1165,9 +1166,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Voltage: " << mg.get_voltage(); * pros::delay(2); * } @@ -1190,9 +1191,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Voltage: " << mg.get_voltage_all()[0]; * pros::delay(2); * } @@ -1221,9 +1222,9 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Is the motor over its current limit?: " << mg.is_over_current(); * pros::delay(2); * } @@ -1246,10 +1247,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its current limit?: " << motor.is_over_current_all()[0]; + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Is the motor over its current limit?: " << mg.is_over_current_all()[0]; * pros::delay(2); * } * } @@ -1276,10 +1277,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp(); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Is the motor over its temperature limit?: " << mg.is_over_temp(); * pros::delay(2); * } * } @@ -1301,10 +1302,10 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp(); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Is the motor over its temperature limit?: " << mg.is_over_temp(); * pros::delay(2); * } * } @@ -1331,7 +1332,7 @@ class MotorGroup : public virtual AbstractMotor { * The zero indexed index of the motor in the motor group * * \return One of MotorBrake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor, or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code @@ -1352,7 +1353,7 @@ class MotorGroup : public virtual AbstractMotor { * EDOM - The motor group is empty * * \return A vector with one of MotorBrake for each motor in the motor group, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor, or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code @@ -1434,12 +1435,12 @@ class MotorGroup : public virtual AbstractMotor { * The zero indexed index of the motor in the motor group * * \return One of MotorUnits according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor or pros::E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Encoder Units: " << mg.get_encoder_units(); * } * \endcode @@ -1455,12 +1456,12 @@ class MotorGroup : public virtual AbstractMotor { * EDOM - The motor group is empty * * \return A vector with the following for each motor, One of MotorUnits according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor or pros::E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Encoder Units: " << mg.get_encoder_units_all()[0]; * } * \endcode @@ -1485,7 +1486,7 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Gearing: " << mg.get_gearing(); * } * \endcode @@ -1506,7 +1507,7 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Gearing: " << mg.get_gearing_all()[0]; * } * \endcode @@ -1592,7 +1593,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * std::cout << "Is the motor reversed? " << motor.is_reversed(); + * std::cout << "Is the first motor reversed? " << mg.is_reversed(); * // Prints "0" * } * \endcode @@ -1612,7 +1613,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * std::cout << "Is the motor reversed? " << motor.is_reversed_all()[0]; + * std::cout << "Is the motor reversed? " << mg.is_reversed_all()[0]; * // Prints "0" * } * \endcode @@ -1637,7 +1638,7 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Type: " << mg.get_type(); * } * \endcode @@ -1657,7 +1658,7 @@ class MotorGroup : public virtual AbstractMotor { * \b Example * \code * void initialize() { - * pros::MotorGroup mg ({1,3}, E_MOTOR_GEARSET_06, false, E_MOTOR_ENCODER_COUNTS); + * pros::MotorGroup mg ({1,3}, pros::E_MOTOR_GEARSET_06, false, pros::E_MOTOR_ENCODER_COUNTS); * std::cout << "Motor Type: " << mg.get_type_all()[0]; * } * \endcode @@ -1799,11 +1800,11 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * mg.set_current_limit(1000); * while (true) { - * mg = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will reduce its output at 1000 mA instead of the default 2500 mA * pros::delay(2); * } @@ -1829,11 +1830,11 @@ class MotorGroup : public virtual AbstractMotor { * \code * void opcontrol() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * mg.set_current_limit_all(1000); * while (true) { - * mg = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will reduce its output at 1000 mA instead of the default 2500 mA * pros::delay(2); * } @@ -1863,7 +1864,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_encoder_units(E_MOTOR_ENCODER_DEGREES, 1); + * mg.set_encoder_units(pros::E_MOTOR_ENCODER_DEGREES, 1); * std::cout << "Encoder Units: " << mg.get_encoder_units(); * } * \endcode @@ -1891,7 +1892,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_encoder_units(E_MOTOR_ENCODER_DEGREES, 1); + * mg.set_encoder_units(pros::E_MOTOR_ENCODER_DEGREES, 1); * std::cout << "Encoder Units: " << mg.get_encoder_units(); * } * \endcode @@ -1916,7 +1917,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * mg.set_encoder_units_all(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << mg.get_encoder_units(); * } * \endcode @@ -1941,7 +1942,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * mg.set_encoder_units_all(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << mg.get_encoder_units(); * } * \endcode @@ -2006,7 +2007,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_gearing(E_MOTOR_GEARSET_06, 1); + * mg.set_gearing(pros::E_MOTOR_GEARSET_06, 1); * std::cout << "Gearset: " << mg.get_gearing(); * } * \endcode @@ -2068,7 +2069,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_gearing(E_MOTOR_GEARSET_06, 1); + * mg.set_gearing(pros::E_MOTOR_GEARSET_06, 1); * std::cout << "Gearset: " << mg.get_gearing(); * } * \endcode @@ -2093,7 +2094,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_gearing_all(E_MOTOR_GEARSET_06); + * mg.set_gearing_all(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << mg.get_gearing(); * } * \endcode @@ -2118,7 +2119,7 @@ class MotorGroup : public virtual AbstractMotor { * \code * void initialize() { * pros::MotorGroup mg({1,3}); - * mg.set_gearing_all(E_MOTOR_GEARSET_06); + * mg.set_gearing_all(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << mg.get_gearing(); * } * \endcode @@ -2147,11 +2148,11 @@ class MotorGroup : public virtual AbstractMotor { * pros::MotorGroup mg({1,3}); * //reverse the motor at index 1 (port 3) * mg.set_reversed(true, 1); - * std::cout << "Is this motor reversed? " << motor.is_reversed(1); + * std::cout << "Is this motor reversed? " << mg.is_reversed(1); * pros::delay(100); * // unreverse the motor at index 1 (port 3) * mg.set_reversed(false, 1); - * std::cout << "Is this motor reversed? " << motor.is_reversed(1); + * std::cout << "Is this motor reversed? " << mg.is_reversed(1); * } * \endcode */ @@ -2176,7 +2177,7 @@ class MotorGroup : public virtual AbstractMotor { * void initialize() { * pros::MotorGroup mg({1,3}); * mg.set_reversed_all(true); - * std::cout << "Is this motor reversed? " << motor.is_reversed(); + * std::cout << "Is this motor reversed? " << mg.is_reversed(); * } * \endcode */ @@ -2204,11 +2205,11 @@ class MotorGroup : public virtual AbstractMotor { * \code * void autonomous() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * mg.set_voltage_limit(10000, 1); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor on at index 1 (port 3) will not output more than 10 V * pros::delay(2); * } @@ -2235,11 +2236,11 @@ class MotorGroup : public virtual AbstractMotor { * \code * void autonomous() { * pros::MotorGroup mg({1,3}); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * mg.set_voltage_limit_all(10000); * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * mg.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will not output more than 10 V * pros::delay(2); * } diff --git a/include/pros/motors.hpp b/include/pros/motors.hpp index 6556aada..38ed8ccd 100644 --- a/include/pros/motors.hpp +++ b/include/pros/motors.hpp @@ -62,10 +62,10 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void opcontrol() { - * Motor first_motor(1); //Creates a motor on port 1 without altering gearset or encoder units - * Motor reversed_motor(-2); //Creates a reversed motor on port 1 port 1 without altering gearset or encoder units - * Motor blue_motor(3, pros::v5::MotorGears::blue); //Creates a motor on port 3 with blue gear set - * Motor rotations_motor(4, pros::v5::MotorGears::green, pros::v5::MotorUnits::rotations); //port 4 w/ rotations + * pros::Motor first_motor(1); //Creates a motor on port 1 without altering gearset or encoder units + * pros::Motor reversed_motor(-2); //Creates a reversed motor on port 1 port 1 without altering gearset or encoder units + * pros::Motor blue_motor(3, pros::v5::MotorGears::blue); //Creates a motor on port 3 with blue gear set + * pros::Motor rotations_motor(4, pros::v5::MotorGears::green, pros::v5::MotorUnits::rotations); //port 4 w/ rotations * * } * \endcode @@ -100,10 +100,10 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void opcontrol() { - * pros::Motor Motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Motor motor (1); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor.move(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * pros::delay(2); * } * } @@ -203,8 +203,8 @@ class Motor : public AbstractMotor, public Device { * * This velocity corresponds to different actual speeds depending on the * gearset used for the motor. This results in a range of +-100 for - * E_MOTOR_GEARSET_36, +-200 for E_MOTOR_GEARSET_18, and +-600 for - * E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent + * pros::E_MOTOR_GEARSET_36, +-200 for pros::E_MOTOR_GEARSET_18, and +-600 for + * pros::E_MOTOR_GEARSET_6. The velocity is held with PID to ensure consistent * speed, as opposed to setting the motor's voltage. * * This function uses the following values of errno when an error state is @@ -274,7 +274,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void autonomous() { - * Motor motor(1); + * pros::Motor motor(1); * motor.move_voltage(12000); * pros::delay(1000); // Move at max voltage for 1 second * motor.brake(); @@ -371,11 +371,11 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * motor.move_velocity(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Velocity: " << motor.get_target_velocity(); - * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y + * // Prints the value of pros::E_CONTROLLER_ANALOG_LEFT_Y * pros::delay(2); * } * } @@ -407,7 +407,7 @@ class Motor : public AbstractMotor, public Device { * void opcontrol() { * pros::Motor motor (1); * while (true) { - * motor = controller_get_analog(E_CONTROLLER_MASTER, E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(pros::c::controller_get_analog(pros::E_CONTROLLER_MASTER, pros::E_CONTROLLER_ANALOG_LEFT_Y)); * printf("Actual velocity: %lf\n", motor.get_actual_velocity()); * pros::delay(2); * } @@ -441,9 +441,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Current Draw: " << motor.get_current_draw(); * pros::delay(2); * } @@ -477,9 +477,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Direction: " << motor.get_direction(); * pros::delay(2); * } @@ -518,9 +518,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Efficiency: " << motor.get_efficiency(); * pros::delay(2); * } @@ -556,9 +556,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << motor.get_faults();pros::delay(2); * } * } @@ -592,9 +592,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << motor.get_faults(); * pros::delay(2); * } @@ -628,9 +628,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << motor.get_position(); * pros::delay(2); * } @@ -664,9 +664,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Power: " << motor.get_power(); * pros::delay(2); * } @@ -709,9 +709,9 @@ class Motor : public AbstractMotor, public Device { * void opcontrol() { * std::uint32_t now = pros::millis(); * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << motor.get_raw_position(&now); * pros::delay(2); * } @@ -745,9 +745,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Temperature: " << motor.get_temperature(); * pros::delay(2); * } @@ -781,9 +781,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Torque: " << motor.get_torque(); * pros::delay(2); * } @@ -817,9 +817,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Voltage: " << motor.get_voltage(); * pros::delay(2); * } @@ -854,9 +854,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Is the motor over its current limit?: " << motor.is_over_current(); * pros::delay(2); * } @@ -890,9 +890,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp(); * pros::delay(2); * } @@ -926,7 +926,7 @@ class Motor : public AbstractMotor, public Device { * By default index is 0, and will return an error for a non-zero index * * \return One of MotorBrake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor, or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code @@ -992,12 +992,12 @@ class Motor : public AbstractMotor, public Device { * By default index is 0, and will return an error for a non-zero index * * \return One of MotorUnits according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor or pros::E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Encoder Units: " << motor.get_encoder_units(); * } * \endcode @@ -1028,7 +1028,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Gearing: " << motor.get_gearing(); * } * \endcode @@ -1120,7 +1120,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Type: " << motor.get_type(); * } * \endcode @@ -1223,11 +1223,11 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * motor.set_current_limit(1000); * while (true) { - * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will reduce its output at 1000 mA instead of the default 2500 mA * pros::delay(2); * } @@ -1254,7 +1254,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); + * motor.set_encoder_units(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode @@ -1289,7 +1289,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); + * motor.set_encoder_units(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode @@ -1323,7 +1323,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing(E_MOTOR_GEARSET_06); + * motor.set_gearing(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode @@ -1360,7 +1360,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing(E_MOTOR_GEARSET_06); + * motor.set_gearing(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode @@ -1419,11 +1419,11 @@ class Motor : public AbstractMotor, public Device { * \code * void autonomous() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * motor.set_voltage_limit(10000); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will not output more than 10 V * pros::delay(2); * } @@ -1526,7 +1526,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void opcontrol() { - * std::vector motor_all = pros::Motor::get_all_devices(); // All motors that are connected + * std::vector motor_all = pros::Motor::get_all_devices(); // All motors that are connected * } * \endcode */ @@ -1582,11 +1582,11 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * motor.move_velocity(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Velocity: " << motor.get_target_velocity_all()[0]; - * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y + * // Prints the value of pros::E_CONTROLLER_ANALOG_LEFT_Y * pros::delay(2); * } * } @@ -1608,11 +1608,11 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * motor.move_velocity(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Velocity: " << motor.get_actual_velocity_all()[0]; - * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y + * // Prints the value of pros::E_CONTROLLER_ANALOG_LEFT_Y * pros::delay(2); * } * } @@ -1636,9 +1636,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Current Draw: " << motor.get_current_draw_all()[0]; * pros::delay(2); * } @@ -1664,9 +1664,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Direction: " << motor.get_direction_all()[0]; * pros::delay(2); * } @@ -1695,9 +1695,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Efficiency: " << motor.get_efficiency(); * pros::delay(2); * } @@ -1722,9 +1722,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; * pros::delay(2); * } @@ -1750,9 +1750,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; * pros::delay(2); * } @@ -1777,9 +1777,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << motor.get_position_all()[0]; * pros::delay(2); * } @@ -1803,9 +1803,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Power: " << motor.get_power_all()[0]; * pros::delay(2); * } @@ -1836,9 +1836,9 @@ class Motor : public AbstractMotor, public Device { * void opcontrol() { * std::uint32_t now = pros::millis(); * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Position: " << motor.get_raw_position(&now); * pros::delay(2); * } @@ -1861,9 +1861,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Temperature: " << motor.get_temperature_all()[0]; * pros::delay(2); * } @@ -1886,9 +1886,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Torque: " << motor.get_torque(); * pros::delay(2); * } @@ -1912,9 +1912,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Motor Voltage: " << motor.get_voltage_all()[0]; * pros::delay(2); * } @@ -1938,9 +1938,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Is the motor over its current limit?: " << motor.is_over_current_all()[0]; * pros::delay(2); * } @@ -1963,9 +1963,9 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp_all(); * pros::delay(2); * } @@ -1982,7 +1982,7 @@ class Motor : public AbstractMotor, public Device { * ENODEV - The port cannot be configured as a motor * * \return One of Motor_Brake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * motor, or pros::E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code @@ -2028,12 +2028,12 @@ class Motor : public AbstractMotor, public Device { * ENODEV - The port cannot be configured as a motor * * \return A vector containing One of Motor_Units according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * motor or pros::E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Encoder Units: " << motor.get_encoder_units_all()[0]; * } * \endcode @@ -2053,7 +2053,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Gearing: " << motor.get_gearing_all()[0]; * } * \endcode @@ -2120,7 +2120,7 @@ class Motor : public AbstractMotor, public Device { * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * pros::Motor motor (1, pros::MotorGears::blue, pros::MotorUnits::counts); * std::cout << "Motor Type: " << motor.get_type_all()[0]; * } * \endcode @@ -2192,11 +2192,11 @@ class Motor : public AbstractMotor, public Device { * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * motor.set_current_limit_all(1000); * while (true) { - * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will reduce its output at 1000 mA instead of the default 2500 mA * pros::delay(2); * } @@ -2234,7 +2234,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * motor.set_encoder_units_all(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode @@ -2259,7 +2259,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * motor.set_encoder_units_all(pros::E_MOTOR_ENCODER_DEGREES); * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode @@ -2284,7 +2284,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing_all(E_MOTOR_GEARSET_06); + * motor.set_gearing_all(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode @@ -2309,7 +2309,7 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing_all(E_MOTOR_GEARSET_06); + * motor.set_gearing_all(pros::E_MOTOR_GEARSET_06); * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode @@ -2366,11 +2366,11 @@ class Motor : public AbstractMotor, public Device { * \code * void autonomous() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * * motor.set_voltage_limit_all(10000); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * motor.move(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y)); * // The motor will not output more than 10 V * pros::delay(2); * } @@ -2466,7 +2466,7 @@ const pros::Motor operator"" _mtr(const unsigned long long int m); * \code * using namespace pros::literals; * void opcontrol() { - * pros::motor motor = 2_rmtr; //Makes an reversed Motor object on port 2 + * pros::Motor motor = 2_rmtr; //Makes an reversed Motor object on port 2 * } * \endcode */ diff --git a/include/pros/optical.hpp b/include/pros/optical.hpp index 3cb55d91..16b41986 100644 --- a/include/pros/optical.hpp +++ b/include/pros/optical.hpp @@ -67,7 +67,7 @@ class Optical : public Device { * \b Example * \code * void opcontrol() { - * std::vector optical_all = pros::Optical::get_all_devices(); // All optical sensors that are connected + * std::vector optical_all = pros::Optical::get_all_devices(); // All optical sensors that are connected * } * \endcode */ diff --git a/include/pros/rotation.h b/include/pros/rotation.h index 5a904414..e6708bec 100644 --- a/include/pros/rotation.h +++ b/include/pros/rotation.h @@ -95,7 +95,6 @@ int32_t rotation_reset(uint8_t port); * #define ROTATION_PORT 1 * * void initialize() { - * pros::Rotation rotation_sensor(ROTATION_PORT); * rotation_set_data_rate(ROTATION_PORT, 5); * } * \endcode @@ -267,10 +266,8 @@ int32_t rotation_get_angle(uint8_t port); * #define ROTATION_PORT 1 * * void opcontrol() { - * Rotation rotation_sensor(ROTATION_PORT); * while (true) { - * - * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ + * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)) { * rotation_set_reversed(ROTATION_PORT, true); // Reverses the Rotation Sensor on ROTATION_PORT * } * delay(20); @@ -299,10 +296,8 @@ int32_t rotation_set_reversed(uint8_t port, bool value); * #define ROTATION_PORT 1 * * void opcontrol() { - * Rotation rotation_sensor(ROTATION_PORT); - * while (true) { - * - * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ + * while (true) { + * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)) { * rotation_reverse(ROTATION_PORT); * } * delay(20); @@ -333,10 +328,8 @@ int32_t rotation_reverse(uint8_t port); * #define ROTATION_PORT 1 * * void opcontrol() { - * Rotation rotation_sensor(ROTATION_PORT); * bool reverse_flag = true; - * while (true) { - * + * while (true) { * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * rotation_init_reverse(ROTATION_PORT, reverse_flag); * } @@ -366,9 +359,7 @@ int32_t rotation_init_reverse(uint8_t port, bool reverse_flag); * #define ROTATION_PORT 1 * * void opcontrol() { - * Rotation rotation_sensor(ROTATION_PORT); - * while (true) { - * + * while (true) { * if(controller_get_digital(CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_X)){ * rotation_get_reversed(ROTATION_PORT); * } diff --git a/include/pros/rotation.hpp b/include/pros/rotation.hpp index 1e6dda9d..d28c45a4 100644 --- a/include/pros/rotation.hpp +++ b/include/pros/rotation.hpp @@ -76,9 +76,9 @@ class Rotation : public Device { * \code * void opcontrol() { * pros::Rotation rotation_sensor(1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * if(master.get_analog(E_CONTROLLER_DIGITAL_X) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { * rotation_sensor.reset(); * } * pros::delay(20); @@ -136,9 +136,9 @@ class Rotation : public Device { * \code * void opcontrol() { * pros::Rotation rotation_sensor(1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * if(master.get_analog(E_CONTROLLER_DIGITAL_X) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { * rotation_sensor.set_position(600); * } * pros::delay(20); @@ -165,9 +165,9 @@ class Rotation : public Device { * \code * void opcontrol() { * pros::Rotation rotation_sensor(1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * if(master.get_analog(E_CONTROLLER_DIGITAL_X) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { * rotation_sensor.reset_position(); * } * pros::delay(20); @@ -185,7 +185,7 @@ class Rotation : public Device { * \b Example * \code * void opcontrol() { - * std::vector rotation_all = pros::Rotation::get_all_devices(); // All rotation sensors that are connected + * std::vector rotation_all = pros::Rotation::get_all_devices(); // All rotation sensors that are connected * } * \endcode */ @@ -208,7 +208,7 @@ class Rotation : public Device { * pros::Rotation rotation_sensor(1); * while (true) { * printf("Position: %d Ticks \n", rotation_sensor.get_position()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -233,8 +233,8 @@ class Rotation : public Device { * void opcontrol() { * pros::Rotation rotation_sensor(1); * while (true) { - * printf("Velocity: %d centidegrees per second \n", rotation_sensor.get_velocity)); - * delay(20); + * printf("Velocity: %d centidegrees per second \n", rotation_sensor.get_velocity()); + * pros::delay(20); * } * } * \endcode @@ -258,7 +258,7 @@ class Rotation : public Device { * pros::Rotation rotation_sensor(1); * while (true) { * printf("Angle: %d centidegrees \n", rotation_sensor.get_angle()); - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -284,9 +284,9 @@ class Rotation : public Device { * \code * void opcontrol() { * pros::Rotation rotation_sensor(1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * if(master.get_analog(E_CONTROLLER_DIGITAL_X) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { * rotation_sensor.set_reversed(true); // Reverses the Rotation Sensor * } * pros::delay(20); @@ -311,9 +311,9 @@ class Rotation : public Device { * \code * void opcontrol() { * pros::Rotation rotation_sensor(1); - * pros::Controller master (E_CONTROLLER_MASTER); + * pros::Controller master (pros::E_CONTROLLER_MASTER); * while (true) { - * if(master.get_analog(E_CONTROLLER_DIGITAL_X) { + * if(master.get_digital(pros::E_CONTROLLER_DIGITAL_X)) { * rotation_sensor.reverse(); * } * pros::delay(20); @@ -340,7 +340,7 @@ class Rotation : public Device { * pros::Rotation rotation_sensor(1); * while (true) { * printf("Reversed: %d \n", rotation_sensor.get_reversed()); - * delay(20); + * pros::delay(20); * } * } * \endcode diff --git a/include/pros/rtos.h b/include/pros/rtos.h index b5ae33bf..7608bcf5 100644 --- a/include/pros/rtos.h +++ b/include/pros/rtos.h @@ -230,7 +230,7 @@ uint32_t millis(void); * \b Example * \code * void opcontrol() { - * uint64_t now = micros(); + * uint32_t now = micros() / 1000; * while (true) { * // Do opcontrol things * task_delay_until(&now, 2000); @@ -472,7 +472,7 @@ task_state_e_t task_get_state(task_t task); * mutex_take(counter_mutex, TIMEOUT_MAX);// Mutexes are used for protecting shared resources * counter++; * mutex_give(counter_mutex); - * pros::delay(10); + * delay(10); * } * } * @@ -485,7 +485,7 @@ task_state_e_t task_get_state(task_t task); * task_suspepend(task); * } * mutex_give(counter_mutex); - * pros::delay(10); + * delay(10); * } * } * \endcode diff --git a/include/pros/rtos.hpp b/include/pros/rtos.hpp index d6c2d890..4fdbe559 100644 --- a/include/pros/rtos.hpp +++ b/include/pros/rtos.hpp @@ -142,7 +142,7 @@ class Task { * } * * void initialize() { - * pros::c::task_t my_task = pros::Task::create(my_task_fn, (void*)"PROS"); + * pros::task_t my_task = pros::Task::create(my_task_fn, (void*)"PROS"); * } * \endcode */ @@ -179,7 +179,7 @@ class Task { * } * * void initialize() { - * pros::c::task_t my_task = pros::Task::create(my_task_fn, "My Task"); + * pros::task_t my_task = pros::Task::create(my_task_fn, "My Task"); * } * \endcode */ @@ -281,7 +281,7 @@ class Task { * } * * void initialize() { - * pros::c::task_t my_task = pros::Task::create(my_task_fn, "My Task"); + * pros::task_t my_task = pros::Task::create(my_task_fn, "My Task"); * * pros::Task my_task_cpp(my_task); * } @@ -321,7 +321,7 @@ class Task { * } * * void initialize() { - * pros::c::task_t my_task = pros::Task::create(my_task_fn, "My Task"); + * pros::task_t my_task = pros::Task::create(my_task_fn, "My Task"); * * pros::Task my_task_cpp = my_task; * } @@ -393,7 +393,7 @@ class Task { * void initialize() { * pros::Task my_task(my_task_fn, "My Task"); * - * Task.set_priority(pros::DEFAULT_PRIORITY + 1); + * my_task.set_priority(pros::DEFAULT_PRIORITY + 1); * } * \endcode */ @@ -521,7 +521,7 @@ class Task { * void initialize() { * pros::Task my_task(my_task_fn, "My Task"); * - * pros::c::task_t my_task_c = (pros::c::task_t)my_task; + * pros::task_t my_task_c = (pros::task_t)my_task; * } * \endcode */ @@ -622,7 +622,7 @@ class Task { * // Reset the notification counter * task.notify_clear(); * } - * delay(10); + * pros::delay(10); * } * } * @@ -636,7 +636,7 @@ class Task { * task.notify_ext(1, NOTIFY_ACTION_INCREMENT, &count); * } * - * delay(20); + * pros::delay(20); * } * } * \endcode @@ -696,7 +696,7 @@ class Task { * printf("Got a notification: %d\n", task.notify_take(false, TIMEOUT_MAX)); * * tasK_notify(task); - * delay(10): + * pros::delay(10): * } * } * @@ -706,7 +706,7 @@ class Task { * if(controller_get_digital(CONTROLLER_MASTER, DIGITAL_L1)) { * task.notify(); * } - * delay(10); + * pros::delay(10); * } * } * \endcode @@ -889,7 +889,7 @@ class Mutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -907,7 +907,7 @@ class Mutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -977,7 +977,7 @@ class Mutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -995,7 +995,7 @@ class Mutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1059,7 +1059,7 @@ class Mutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1077,7 +1077,7 @@ class Mutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1145,7 +1145,7 @@ class Mutex { * odom_heading = heading_new; * odom_mutex.unlock(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1163,7 +1163,7 @@ class Mutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1227,7 +1227,7 @@ class Mutex { * odom_heading = heading_new; * odom_mutex.unlock(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1245,7 +1245,7 @@ class Mutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1423,7 +1423,7 @@ class RecursiveMutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1441,7 +1441,7 @@ class RecursiveMutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1511,7 +1511,7 @@ class RecursiveMutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1529,7 +1529,7 @@ class RecursiveMutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1593,7 +1593,7 @@ class RecursiveMutex { * odom_heading = heading_new; * odom_mutex.give(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1611,7 +1611,7 @@ class RecursiveMutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1679,7 +1679,7 @@ class RecursiveMutex { * odom_heading = heading_new; * odom_mutex.unlock(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1697,7 +1697,7 @@ class RecursiveMutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1761,7 +1761,7 @@ class RecursiveMutex { * odom_heading = heading_new; * odom_mutex.unlock(); * - * delay(10); + * pros::delay(10); * } * } * @@ -1779,7 +1779,7 @@ class RecursiveMutex { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * @@ -1961,7 +1961,7 @@ class MutexVar { * * *odom_pose.take() = new_pose; * - * delay(10); + * pros::delay(10); * } * } * @@ -1972,7 +1972,7 @@ class MutexVar { * * // ---- Move the robot using the current locations goes here ---- * - * delay(10); + * pros::delay(10); * } * } * diff --git a/include/pros/screen.hpp b/include/pros/screen.hpp index cbfe2fcf..53f0a53b 100644 --- a/include/pros/screen.hpp +++ b/include/pros/screen.hpp @@ -72,7 +72,7 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void initialize() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * } * * void opcontrol() { @@ -135,7 +135,7 @@ const char* convert_args(const std::string& arg) { * \code * void initialize() { * //set eraser color to red - * set_eraser(red); + * pros::screen::set_eraser(pros::Color::red); * } * * void opcontrol() { @@ -193,7 +193,7 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void initialize() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * } * * void opcontrol() { @@ -220,7 +220,7 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void initialize() { - * pros::screen::set_eraser(red); + * pros::screen::set_eraser(pros::Color::red); * } * * void opcontrol() { @@ -246,7 +246,7 @@ const char* convert_args(const std::string& arg) { * * \b Example * \code * void initialize() { - * pros::screen::set_eraser(red); + * pros::screen::set_eraser(pros::Color::red); * } * * void opcontrol() { @@ -388,7 +388,7 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * // Color the Screen in Red - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::fill_rect(0,0,400,200); * int i = 0; * while(i < 200){ @@ -417,7 +417,7 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void opcontrol() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * // Draw line down the screen at x = 100 * pros::screen::draw_line(100,0,100,200); * } @@ -442,7 +442,7 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * // Color the Screen in Red - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::fill_rect(0,0,400,200); * // Erase line down the screen at x = 100 * pros::screen::erase_line(100,0,100,200); @@ -467,7 +467,7 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void opcontrol() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::draw_rect(1,1,480,200); * } * \endcode @@ -491,7 +491,7 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * // Draw Box Around Half the Screen in Red - * pros::screen::set_eraser(red); + * pros::screen::set_eraser(pros::Color::red); * pros::screen::erase_rect(5,5,240,200); * } * \endcode @@ -516,7 +516,7 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * // Fill Around Half the Screen in Red - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::fill_rect(5,5,240,200); * } * \endcode @@ -540,7 +540,7 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * // Draw a circle with radius of 100 in red - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::draw_circle(240, 200, 100); * } * \endcode @@ -563,10 +563,10 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void opcontrol() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::fill_rect(5,5,240,200); * // Erase a circle with radius of 100 in blue - * pros::screen::set_pen(blue); + * pros::screen::set_pen(pros::Color::blue); * pros::screen::erase_circle(240, 200, 100); * } * \endcode @@ -590,10 +590,10 @@ const char* convert_args(const std::string& arg) { * \b Example * \code * void opcontrol() { - * pros::screen::set_pen(red); + * pros::screen::set_pen(pros::Color::red); * pros::screen::fill_rect(5,5,240,200); * // Fill a circlular area with radius of 100 in blue - * pros::screen::set_pen(blue); + * pros::screen::set_pen(pros::Color::blue); * pros::screen::fill_circle(240, 200, 100); * } * \endcode @@ -622,13 +622,14 @@ const char* convert_args(const std::string& arg) { * \code * void opcontrol() { * int i = 0; - * pros::screen::set_pen(blue); + * pros::screen::set_pen(pros::Color::blue); * while(1){ * // Will print seconds started since program started on line 3 - * pros::screen::print(pros::TEXT_MEDIUM, 3, "Seconds Passed: %3d", i++); + * pros::screen::print(TEXT_MEDIUM, 3, "Seconds Passed: %3d", i++); * pros::delay(1000); * } * } + * \endcode */ template void print(pros::text_format_e_t txt_fmt, const std::int16_t line, const char* text, Params... args){ @@ -650,10 +651,10 @@ const char* convert_args(const std::string& arg) { /** * Gets the touch status of the last touch of the screen. * - * \return The last_touch_e_t enum specifier that indicates the last touch status of the screen (E_TOUCH_EVENT_RELEASE, E_TOUCH_EVENT_PRESS, or E_TOUCH_EVENT_PRESS_AND_HOLD). + * \return The last_touch_e_t enum specifier that indicates the last touch status of the screen (E_TOUCH_EVENT_RELEASE, pros::E_TOUCH_EVENT_PRESS, or pros::E_TOUCH_EVENT_PRESS_AND_HOLD). * This will be released by default if no action was taken. * If an error occured, the screen_touch_status_s_t will have its - * last_touch_e_t enum specifier set to E_TOUCH_ERR, and other values set to -1. + * last_touch_e_t enum specifier set to pros::E_TOUCH_ERR, and other values set to -1. * * \b Example * \code diff --git a/include/pros/vision.h b/include/pros/vision.h index 6b3f104c..06f6a300 100644 --- a/include/pros/vision.h +++ b/include/pros/vision.h @@ -208,7 +208,7 @@ int32_t vision_clear_led(uint8_t port); * vision_signature_from_utility(EXAMPLE_SIG, 8973, 11143, 10058, -2119, -1053, -1586, 5.4, 0); * vision_set_signature(VISION_PORT, EXAMPLE_SIG, &RED_SIG); * while (true) { - * vision_signature_s_t rtn = vision_get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); + * vision_object_s_t rtn = vision_get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); * // Gets the largest object of the EXAMPLE_SIG signature * printf("sig: %d", rtn.signature); * // Prints "sig: 1" @@ -253,7 +253,7 @@ vision_signature_s_t vision_signature_from_utility(const int32_t id, const int32 * #define OTHER_SIG 2 * * void opcontrol() { - * vision_color_code_t code1 = vision_create_color_code(VISION_PORT, EXAMPLE_SIG, OTHER_SIG); + * vision_color_code_t code1 = vision_create_color_code(VISION_PORT, EXAMPLE_SIG, OTHER_SIG, 0, 0, 0); * } * \endcode */ @@ -362,7 +362,7 @@ vision_object_s_t vision_get_by_sig(uint8_t port, const uint32_t size_id, const * #define OTHER_SIG 2 * * void opcontrol() { - * vision_color_code_t code1 = vision_create_color_code(VISION_PORT, EXAMPLE_SIG, OTHER_SIG); + * vision_color_code_t code1 = vision_create_color_code(VISION_PORT, EXAMPLE_SIG, OTHER_SIG, 0, 0, 0); * while (true) { * vision_object_s_t rtn = vision_get_by_code(VISION_PORT, 0, code1); * // Gets the largest object diff --git a/include/pros/vision.hpp b/include/pros/vision.hpp index 0a845f6b..95b84ae5 100644 --- a/include/pros/vision.hpp +++ b/include/pros/vision.hpp @@ -57,7 +57,7 @@ class Vision : public Device { * } * \endcode */ - Vision(std::uint8_t port, vision_zero_e_t zero_point = E_VISION_ZERO_TOPLEFT); + Vision(std::uint8_t port, vision_zero_e_t zero_point = pros::E_VISION_ZERO_TOPLEFT); Vision(const Device& device) : Vision(device.get_port()){}; @@ -114,15 +114,15 @@ class Vision : public Device { * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * // values acquired from the vision utility - * vision_signature_s_t RED_SIG = - * vision_signature_from_utility(EXAMPLE_SIG, 8973, 11143, 10058, -2119, -1053, -1586, 5.4, 0); + * pros::vision_signature_s_t RED_SIG = + * pros::vision_signature_from_utility(EXAMPLE_SIG, 8973, 11143, 10058, -2119, -1053, -1586, 5.4, 0); * vision_sensor.set_signature(EXAMPLE_SIG, &RED_SIG); * while (true) { - * vision_signature_s_t rtn = vision_sensor.get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); + * pros::vision_object_s_t rtn = vision_sensor.get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); * // Gets the largest object of the EXAMPLE_SIG signature * printf("sig: %d", rtn.signature); * // Prints "sig: 1" - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -179,7 +179,7 @@ class Vision : public Device { * \b Example * \code * void opcontrol() { - * std::vector vision_all = pros::Vision::get_all_devices(); // All vision sensors that are connected + * std::vector vision_all = pros::Vision::get_all_devices(); // All vision sensors that are connected * } * \endcode */ @@ -208,10 +208,10 @@ class Vision : public Device { * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_size(0); + * pros::vision_object_s_t rtn = vision_sensor.get_by_size(0); * // Gets the largest object * printf("sig: %d", rtn.signature); - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -246,11 +246,11 @@ class Vision : public Device { * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_sig(0, EXAMPLE_SIG); + * pros::vision_object_s_t rtn = vision_sensor.get_by_sig(0, EXAMPLE_SIG); * // Gets the largest object of the EXAMPLE_SIG signature * printf("sig: %d", rtn.signature); * // Prints "sig: 1" - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -284,10 +284,10 @@ class Vision : public Device { * pros::Vision vision_sensor(VISION_PORT); * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG); * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_code(0, code1); + * pros::vision_object_s_t rtn = vision_sensor.get_by_code(0, code1); * // Gets the largest object * printf("sig: %d", rtn.signature); - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -335,7 +335,7 @@ class Vision : public Device { * pros::Vision vision_sensor(VISION_PORT); * while (true) { * printf("Number of Objects Detected: %d\n", vision_sensor.get_object_count()); - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -421,12 +421,12 @@ class Vision : public Device { * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; + * pros::vision_object_s_t object_arr[NUM_VISION_OBJECTS]; * while (true) { * vision_sensor.read_by_size(0, NUM_VISION_OBJECTS, object_arr); * printf("sig: %d", object_arr[0].signature); * // Prints the signature of the largest object found - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -469,12 +469,12 @@ class Vision : public Device { * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; + * pros::vision_object_s_t object_arr[NUM_VISION_OBJECTS]; * while (true) { * vision_sensor.read_by_sig(0, EXAMPLE_SIG, NUM_VISION_OBJECTS, object_arr); * printf("sig: %d", object_arr[0].signature); * // Prints "sig: 1" - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -516,13 +516,13 @@ class Vision : public Device { * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; - * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG, 0, 0, 0); + * pros::vision_object_s_t object_arr[NUM_VISION_OBJECTS]; + * pros::vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG, 0, 0, 0); * while (true) { * vision_sensor.read_by_code(0, code1, NUM_VISION_OBJECTS, object_arr); * printf("sig: %d", object_arr[0].signature); * // Prints the signature of the largest object found - * delay(2); + * pros::delay(2); * } * } * \endcode @@ -710,7 +710,7 @@ class Vision : public Device { * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); - * vision_sensor.set_zero_point(E_VISION_ZERO_CENTER); + * vision_sensor.set_zero_point(pros::E_VISION_ZERO_CENTER); * } * \endcode */