Skip to content

Commit

Permalink
📝Update docs for pre-release (#657)
Browse files Browse the repository at this point in the history
* Update version

* 🐛 Fix pros::E_TEXT_LARGE_CENTER Simple Name

* Update version numbers

* 🐛Motor bug fixes and add new set_gearing (#611)

* ✨Add list_files function (#612)

* Add list_files

* renamed c function

* Clarify the docs

* ✨ ADI Get Port (#613)

* Initial Commit. Added get_port() for adi.

* Second commit. Fixed changes.

* 🐛Vex link default override (#614)

* Initial Commit. Changed defualt param.

* Fixed param docs

* ✨Field Control State Getter (#608)

* Field Control State Getter

* Fixed merge issues

* Removed left over testing code

* change macros to enum/functions

---------

Co-authored-by: noam987 <[email protected]>
Co-authored-by: noam987 <[email protected]>

* Added vexFileSync when writing to files (#619)

* 🐛Fix rotation sensor reversed port (#618)

* 🐛 Field Control Getter Return Value (#627)

* Field Control State Getter

* Fixed merge issues

* Removed left over testing code

* change macros to enum/functions

* fix return value issue

* fixed version

---------

Co-authored-by: noam987 <[email protected]>
Co-authored-by: noam987 <[email protected]>

* ✨default the VFS to the sd card (#621)

* Fix motor voltage limit port mutex returning

* Initial implementation for get_all_devices

* Remove use of templating

* modify gps functions

* add example code to gps header files

* revert api.h and version

* add newline at end of gps.c

* add newline at end of version

* Completed get_all_devices member function for all critical devices

* Fix compile issues

* 🐛ADI mutex fix (#633)

* Fixed duplicate zero indexing in ext_adi_led_set_pixel as well as validate_type

* testing

* Fixed zero indexing

* fix merge

* removes an extra -1

* Add missing -1

* Last -1

* Fix return without releasing mutex

---------

Co-authored-by: noam987 <[email protected]>

* ✨Adds static getters for some devices (#653)

* imu_v1

* revert main.cpp

* Add injector for gps

* rename to _ casing and add vision sensor

* 📝 PROS 4: Documentation Fixes for optical and distance sensor (#654)

* Documentation Fixes for optical sensor

* Distance sensor documentation fixes

* Added alias function get_distance for get for distance sensor

* Update get_distance func header for distance sensor

* 🐛Fixed Imu::is_calibrating function for PROS 4 #626 (#629)

* Fixed Imu::is_calibrating function

Updated imu status enums to properly reflect values returned by get_status. Also modifed imu::is_calibrating so it returns the correct value.

* Bugfixes from the pros 3 version

---------

Co-authored-by: noam987 <[email protected]>
Co-authored-by: noam987 <[email protected]>

* 🐛Remove = overload from motor groups (#656)

---------

Co-authored-by: Richard Stump <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: phinc23 <[email protected]>
Co-authored-by: Yuechan Li <[email protected]>
Co-authored-by: Sprocket Riggs <[email protected]>
Co-authored-by: Cooper7196 <[email protected]>
Co-authored-by: Gavin-Niederman <[email protected]>
Co-authored-by: aberiggs <[email protected]>
Co-authored-by: Yuechan Li <[email protected]>
Co-authored-by: Gracelu128 <[email protected]>
Co-authored-by: Richard Li <[email protected]>
  • Loading branch information
13 people authored May 5, 2024
1 parent c445161 commit cf2e2fa
Show file tree
Hide file tree
Showing 40 changed files with 2,294 additions and 1,155 deletions.
5 changes: 3 additions & 2 deletions include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@

#define PROS_VERSION_MAJOR 4
#define PROS_VERSION_MINOR 0
#define PROS_VERSION_PATCH 2
#define PROS_VERSION_STRING "4.0.2"
#define PROS_VERSION_PATCH 6
#define PROS_VERSION_STRING "4.0.6"


#include "pros/adi.h"
#include "pros/colors.h"
Expand Down
19 changes: 0 additions & 19 deletions include/pros/abstract_motor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,6 @@ class AbstractMotor {
/// These functions allow programmers to make motors move
///@{

/**
* Sets the voltage for the motor from -127 to 127.
*
* This is designed to map easily to the input from the controller's analog
* stick for simple opcontrol use. The actual behavior of the motor is
* analogous to use of pros::Motor::move().
*
* This function uses the following values of errno when an error state is
* reached:
* ENODEV - The port cannot be configured as a motor
*
* \param voltage
* The new motor voltage from -127 to 127
*
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
virtual std::int32_t operator=(std::int32_t voltage) const = 0;

/**
* Sets the voltage for the motor from -127 to 127.
*
Expand Down
51 changes: 51 additions & 0 deletions include/pros/adi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,33 @@ class Port {
*/
std::int32_t set_value(std::int32_t value) const;

/**
* Gets the port of the sensor.
*
* \return returns a tuple of integer ports.
*
* \note The parts of the tuple are {smart port, adi port, second adi port (when applicable)}.
*
*
* \b Example
* \code
* #define DIGITAL_SENSOR_PORT 1 // 'A'
*
* void initialize() {
* pros::adi::AnalogIn sensor (DIGITAL_SENSOR_PORT);
*
* // Getting values from the tuple using std::get<index>
* int sensorSmartPort = std::get<0>(sensor.get_port()); // First value
* int sensorAdiPort = std::get<1>(sensor.get_port()); // Second value
*
* // Prints the first and second value from the port tuple (The Adi Port. The first value is the Smart Port)
* printf("Sensor Smart Port: %d\n", sensorSmartPort);
* printf("Sensor Adi Port: %d\n", sensorAdiPort);
* }
* \endcode
*/
virtual ext_adi_port_tuple_t get_port() const;

protected:
std::uint8_t _smart_port;
std::uint8_t _adi_port;
Expand Down Expand Up @@ -396,6 +423,8 @@ class AnalogIn : protected Port {
* value calibrated HR: (16 bit calibrated value), value: (12 bit value)]
*/
friend std::ostream& operator<<(std::ostream& os, pros::adi::AnalogIn& analog_in);

using Port::get_port;
};

///@}
Expand Down Expand Up @@ -484,6 +513,8 @@ class AnalogOut : private Port {
* \endcode
*/
using Port::set_value;

using Port::get_port;

/**
* This is the overload for the << operator for printing to streams
Expand Down Expand Up @@ -595,6 +626,8 @@ class DigitalOut : private Port {
*/
using Port::set_value;

using Port::get_port;

/**
* This is the overload for the << operator for printing to streams
*
Expand Down Expand Up @@ -731,6 +764,8 @@ class DigitalIn : private Port {
* value: (value)]
*/
friend std::ostream& operator<<(std::ostream& os, pros::adi::DigitalIn& digital_in);

using Port::get_port;
};

///@}
Expand Down Expand Up @@ -875,6 +910,8 @@ class Motor : private Port {
* \endcode
*/
using Port::get_value;

using Port::get_port;
};

///@}
Expand Down Expand Up @@ -1004,6 +1041,11 @@ class Encoder : private Port {
* value: (value)]
*/
friend std::ostream& operator<<(std::ostream& os, pros::adi::Encoder& encoder);
ext_adi_port_tuple_t get_port() const override;

private:
ext_adi_port_pair_t _port_pair;

};

///@}
Expand Down Expand Up @@ -1108,6 +1150,8 @@ class Ultrasonic : private Port {
* \endcode
*/
std::int32_t get_value() const;

using Port::get_port;
};

///@}
Expand Down Expand Up @@ -1259,6 +1303,8 @@ class Gyro : private Port {
* \endcode
*/
std::int32_t reset() const;

using Port::get_port;
};

///@}
Expand Down Expand Up @@ -1419,6 +1465,9 @@ class Potentiometer : public AnalogIn {
* Prints in format(this below is all in one line with no new line):
*/
friend std::ostream& operator<<(std::ostream& os, pros::adi::Potentiometer& potentiometer);

using Port::get_port;

};

///@}
Expand Down Expand Up @@ -1710,6 +1759,8 @@ class Led : protected Port {
*/
std::int32_t length();

using Port::get_port;

protected:
std::vector<uint32_t> _buffer;
};
Expand Down
5 changes: 4 additions & 1 deletion include/pros/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Device {
* }
* \endcode
*/
std::uint8_t get_port(void);
std::uint8_t get_port(void) const;

/**
* Checks if the device is installed.
Expand Down Expand Up @@ -137,6 +137,9 @@ class Device {
*/
pros::DeviceType get_plugged_type() const;

static pros::DeviceType get_plugged_type(std::uint8_t port);

static std::vector<Device> get_all_devices(pros::DeviceType device_type = pros::DeviceType::undefined);

protected:
/**
Expand Down
38 changes: 35 additions & 3 deletions include/pros/distance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class Distance : public Device {
* }
* \endcode
*/
explicit Distance(const std::uint8_t port);
Distance(const std::uint8_t port);

Distance(const Device& device)
: Distance(device.get_port()) {};

/**
* Get the currently measured distance from the sensor in mm
Expand All @@ -67,7 +70,7 @@ class Distance : public Device {
* ENODEV - The port cannot be configured as an Distance Sensor
*
* \return The distance value or PROS_ERR if the operation failed, setting
* errno.
* errno. Will return 9999 if the sensor can not detect an object.
*
* \b Example
* \code
Expand All @@ -84,6 +87,35 @@ class Distance : public Device {
*/
virtual std::int32_t get();

static std::vector<Distance> get_all_devices();

/**
* Get the currently measured distance from the sensor in mm.
* \note This function is identical to get().
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Distance Sensor
*
* \return The distance value or PROS_ERR if the operation failed, setting
* errno. Will return 9999 if the sensor can not detect an object.
*
* \b Example
* \code
* #define DISTANCE_PORT 1
*
* void opcontrol() {
Distance distance(DISTANCE_PORT);
* while (true) {
* printf("Distance confidence: %d\n", distance.get_distance());
* delay(20);
* }
* }
* \endcode
*/
virtual std::int32_t get_distance();

/**
* Get the confidence in the distance reading
*
Expand Down Expand Up @@ -127,7 +159,7 @@ class Distance : public Device {
* ENODEV - The port cannot be configured as an Distance Sensor
*
* \return The size value or PROS_ERR if the operation failed, setting
* errno.
* errno. Will return -1 if the sensor is not able to determine object size.
*
* \b Example
* \code
Expand Down
Loading

0 comments on commit cf2e2fa

Please sign in to comment.