Upgrade to C++20 (#4239)

* Use explicit this capture required by C++20
* Use C++20 span
* Replace wpi::numbers with std::numbers
* Fix C++20 clang-tidy warning false positive in fmt
* Remove ciso646 include since C++20 removed that header
* Fix global-buffer-overflow asan warnings in ntcore tests
* Add DIOSetProxy constructor to HAL

* Upgrade MSVC compiler to 2022
* Bump native-utils to 2023.2.7 (changes to std=c++20)

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
This commit is contained in:
Tyler Veness
2022-10-15 16:33:14 -07:00
committed by GitHub
parent 396143004c
commit fbdc810887
355 changed files with 1659 additions and 2918 deletions

View File

@@ -4,8 +4,9 @@
#include "commands/TurnDegrees.h"
#include <numbers>
#include <units/math.h>
#include <wpi/numbers>
void TurnDegrees::Initialize() {
// Set motors to stop, read encoder values for starting point
@@ -26,7 +27,7 @@ bool TurnDegrees::IsFinished() {
// found here https://www.pololu.com/category/203/romi-chassis-kits, has a
// wheel placement diameter (149 mm) - width of the wheel (8 mm) = 141 mm
// or 5.551 inches. We then take into consideration the width of the tires.
static auto inchPerDegree = (5.551_in * wpi::numbers::pi) / 360_deg;
static auto inchPerDegree = (5.551_in * std::numbers::pi) / 360_deg;
// Compare distance traveled from start to distance based on degree turn.
return GetAverageTurningDistance() >= inchPerDegree * m_angle;

View File

@@ -4,7 +4,7 @@
#include "subsystems/Drivetrain.h"
#include <wpi/numbers>
#include <numbers>
#include "Constants.h"
@@ -20,9 +20,9 @@ Drivetrain::Drivetrain() {
// gearbox is constructed, you might have to invert the left side instead.
m_rightMotor.SetInverted(true);
m_leftEncoder.SetDistancePerPulse(wpi::numbers::pi * kWheelDiameter.value() /
m_leftEncoder.SetDistancePerPulse(std::numbers::pi * kWheelDiameter.value() /
kCountsPerRevolution);
m_rightEncoder.SetDistancePerPulse(wpi::numbers::pi * kWheelDiameter.value() /
m_rightEncoder.SetDistancePerPulse(std::numbers::pi * kWheelDiameter.value() /
kCountsPerRevolution);
ResetEncoders();
}