mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Fix usages of std::min and std::max to be windows safe (#4887)
This commit is contained in:
@@ -196,7 +196,7 @@ bool ADIS16448_IMU::SwitchToStandardSPI() {
|
||||
while (data_count > 0) {
|
||||
/* Dequeue 200 at a time, or the remainder of the buffer if less than
|
||||
* 200 */
|
||||
m_spi->ReadAutoReceivedData(trashBuffer, std::min(200, data_count),
|
||||
m_spi->ReadAutoReceivedData(trashBuffer, (std::min)(200, data_count),
|
||||
0_s);
|
||||
/* Update remaining buffer count */
|
||||
data_count = m_spi->ReadAutoReceivedData(trashBuffer, 0, 0_s);
|
||||
@@ -331,7 +331,7 @@ int ADIS16448_IMU::ConfigCalTime(CalibrationTime new_cal_time) {
|
||||
void ADIS16448_IMU::Calibrate() {
|
||||
std::scoped_lock sync(m_mutex);
|
||||
// Calculate the running average
|
||||
int gyroAverageSize = std::min(m_accum_count, m_avg_size);
|
||||
int gyroAverageSize = (std::min)(m_accum_count, m_avg_size);
|
||||
double accum_gyro_rate_x = 0.0;
|
||||
double accum_gyro_rate_y = 0.0;
|
||||
double accum_gyro_rate_z = 0.0;
|
||||
|
||||
@@ -193,7 +193,7 @@ bool ADIS16470_IMU::SwitchToStandardSPI() {
|
||||
while (data_count > 0) {
|
||||
/* Receive data, max of 200 words at a time (prevent potential segfault)
|
||||
*/
|
||||
m_spi->ReadAutoReceivedData(trashBuffer, std::min(data_count, 200),
|
||||
m_spi->ReadAutoReceivedData(trashBuffer, (std::min)(data_count, 200),
|
||||
0_s);
|
||||
/*Get the remaining data count */
|
||||
data_count = m_spi->ReadAutoReceivedData(trashBuffer, 0, 0_s);
|
||||
|
||||
@@ -103,8 +103,8 @@ DifferentialDrive::WheelSpeeds DifferentialDrive::ArcadeDriveIK(
|
||||
|
||||
// Find the maximum possible value of (throttle + turn) along the vector that
|
||||
// the joystick is pointing, then desaturate the wheel speeds
|
||||
double greaterInput = std::max(std::abs(xSpeed), std::abs(zRotation));
|
||||
double lesserInput = std::min(std::abs(xSpeed), std::abs(zRotation));
|
||||
double greaterInput = (std::max)(std::abs(xSpeed), std::abs(zRotation));
|
||||
double lesserInput = (std::min)(std::abs(xSpeed), std::abs(zRotation));
|
||||
if (greaterInput == 0.0) {
|
||||
return {0.0, 0.0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user