Skip to content

Commit

Permalink
馃悰 Fix multiple ADI bugs and inconsistencies (#151)
Browse files Browse the repository at this point in the history
* Fix IntelliSense error

* Note possible hack with registry pad

* Note possible issue with claim_port

* Cleanup ADI C API

* Remove config clear from ADI destructor

* Move ADI config to initilizer list

* Fix double normalization of ultrasonic port

* Partially Revert "Remove config clear from ADI destructor"

This partially reverts commit 6a562ef.

* Declare ADIPort destructor as default

* Revert "Note possible hack with registry pad"

This reverts commit 866067b.

* Change claim_port note
  • Loading branch information
TixoRebel authored and HotelCalifornia committed Aug 19, 2019
1 parent b58f8ab commit 61eb20a
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 213 deletions.
2 changes: 2 additions & 0 deletions VSCode.md
Expand Up @@ -4,3 +4,5 @@ Use the following include paths for intellisense completion:
"${env:PROS_TOOLCHAIN}/lib/gcc/arm-none-eabi/6.3.1/include",
"${workspaceRoot}",
"${workspaceRoot}/include"

Add "_INTELLISENSE" to your defines to fix certain intellisense errors that will actually compile without issue
5 changes: 5 additions & 0 deletions include/pros/adi.h
Expand Up @@ -37,8 +37,13 @@ typedef enum adi_port_config_e {
E_ADI_DIGITAL_IN = 2,
E_ADI_DIGITAL_OUT = 3,

#ifdef _INTELLISENSE
#define _DEPRECATE_DIGITAL_IN = E_ADI_DIGITAL_IN
#define _DEPRECATE_ANALOG_IN = E_ADI_ANALOG_IN
#else
#define _DEPRECATE_DIGITAL_IN __attribute__((deprecated("use E_ADI_DIGITAL_IN instead"))) = E_ADI_DIGITAL_IN
#define _DEPRECATE_ANALOG_IN __attribute__((deprecated("use E_ADI_ANALOG_IN instead"))) = E_ADI_ANALOG_IN
#endif

E_ADI_SMART_BUTTON _DEPRECATE_DIGITAL_IN,
E_ADI_SMART_POT _DEPRECATE_ANALOG_IN,
Expand Down
4 changes: 1 addition & 3 deletions include/pros/adi.hpp
Expand Up @@ -39,7 +39,7 @@ class ADIPort {
*/
ADIPort(std::uint8_t port, adi_port_config_e_t type = E_ADI_TYPE_UNDEFINED);

virtual ~ADIPort(void);
virtual ~ADIPort(void) = default;

/**
* Gets the configuration for the given ADI port.
Expand Down Expand Up @@ -474,8 +474,6 @@ class ADIGyro : private ADIPort {
*/
ADIGyro(std::uint8_t port, double multiplier = 1);

~ADIGyro(void) override;

/**
* Gets the current gyro angle in tenths of a degree. Unless a multiplier is
* applied to the gyro, the return value will be a whole number representing
Expand Down
3 changes: 3 additions & 0 deletions include/vdml/vdml.h
Expand Up @@ -32,6 +32,9 @@
* If a port isn't yet registered, it registered as a motor automatically.
* If a mutex cannot be taken, errno is set to EACCES (access denied) and
* returns.
*
* This and other similar macros should only be used in functions that return
* int32_t as PROS_ERR could be returned.
*
* \param port
* The V5 port number from 0-20
Expand Down

0 comments on commit 61eb20a

Please sign in to comment.