Cleaned up integer type usage in wpilibc (#92)

Replaced all unsigned types to signed and int32_t with int in wpilibc
This commit is contained in:
Tyler Veness
2016-09-06 00:01:45 -07:00
committed by Peter Johnson
parent ff93050b31
commit 0cd05d1a42
169 changed files with 914 additions and 943 deletions

View File

@@ -13,8 +13,8 @@
#include "Timer.h"
#include "WPIErrors.h"
const uint32_t AnalogGyro::kOversampleBits = 10;
const uint32_t AnalogGyro::kAverageBits = 0;
const int AnalogGyro::kOversampleBits = 10;
const int AnalogGyro::kAverageBits = 0;
const float AnalogGyro::kSamplesPerSecond = 50.0;
const float AnalogGyro::kCalibrationSampleTime = 5.0;
const float AnalogGyro::kDefaultVoltsPerDegreePerSecond = 0.007;
@@ -44,7 +44,7 @@ void AnalogGyro::InitAnalogGyro(int channel) {
*
* @param channel The analog channel the gyro is connected to.
*/
AnalogGyro::AnalogGyro(uint32_t channel) { InitAnalogGyro(channel); }
AnalogGyro::AnalogGyro(int channel) { InitAnalogGyro(channel); }
/**
* Reset the gyro.

View File

@@ -17,7 +17,7 @@
*
* @param channel The channel number to represent.
*/
AnalogInput::AnalogInput(uint32_t channel) : m_channel(channel) {
AnalogInput::AnalogInput(int channel) : m_channel(channel) {
std::stringstream ss;
ss << "analog/" << channel;
m_impl = new SimFloatInput(ss.str());
@@ -54,7 +54,7 @@ float AnalogInput::GetAverageVoltage() const { return m_impl->Get(); }
*
* @return The channel number.
*/
uint32_t AnalogInput::GetChannel() const { return m_channel; }
int AnalogInput::GetChannel() const { return m_channel; }
/**
* Get the Average value for the PID Source base object.

View File

@@ -17,7 +17,7 @@
*
* @param channel The digital channel (1..14).
*/
DigitalInput::DigitalInput(uint32_t channel) : m_channel(channel) {
DigitalInput::DigitalInput(int channel) : m_channel(channel) {
std::stringstream ss;
ss << "dio/" << channel;
m_impl = new SimDigitalInput(ss.str());
@@ -27,12 +27,12 @@ DigitalInput::DigitalInput(uint32_t channel) : m_channel(channel) {
* Get the value from a digital input channel.
* Retrieve the value of a single digital input channel from the FPGA.
*/
uint32_t DigitalInput::Get() const { return m_impl->Get(); }
int DigitalInput::Get() const { return m_impl->Get(); }
/**
* @return The GPIO channel number that this object represents.
*/
uint32_t DigitalInput::GetChannel() const { return m_channel; }
int DigitalInput::GetChannel() const { return m_channel; }
void DigitalInput::UpdateTable() {
if (m_table != nullptr) {

View File

@@ -16,7 +16,7 @@
* @param forwardChannel The forward channel on the module to control.
* @param reverseChannel The reverse channel on the module to control.
*/
DoubleSolenoid::DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel)
DoubleSolenoid::DoubleSolenoid(int forwardChannel, int reverseChannel)
: DoubleSolenoid(1, forwardChannel, reverseChannel) {}
/**
@@ -26,8 +26,8 @@ DoubleSolenoid::DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel)
* @param forwardChannel The forward channel on the module to control.
* @param reverseChannel The reverse channel on the module to control.
*/
DoubleSolenoid::DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
uint32_t reverseChannel) {
DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
int reverseChannel) {
m_reversed = false;
if (reverseChannel < forwardChannel) { // Swap ports to get the right address
int channel = reverseChannel;

View File

@@ -17,11 +17,11 @@
#include "WPIErrors.h"
#include "simulation/MainNode.h"
const uint32_t DriverStation::kBatteryChannel;
const uint32_t DriverStation::kJoystickPorts;
const uint32_t DriverStation::kJoystickAxes;
const int DriverStation::kBatteryChannel;
const int DriverStation::kJoystickPorts;
const int DriverStation::kJoystickAxes;
const float DriverStation::kUpdatePeriod = 0.02;
uint8_t DriverStation::m_updateNumber = 0;
int DriverStation::m_updateNumber = 0;
/**
* DriverStation contructor.
@@ -78,7 +78,7 @@ float DriverStation::GetBatteryVoltage() const {
* @param axis The analog axis value to read from the joystick.
* @return The value of the axis on the joystick.
*/
float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis) {
float DriverStation::GetStickAxis(int stick, int axis) {
if (axis < 0 || axis > (kJoystickAxes - 1)) {
wpi_setWPIError(BadJoystickAxis);
return 0.0;
@@ -105,7 +105,7 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis) {
* @param button The button number to check.
* @return If the button is pressed.
*/
bool DriverStation::GetStickButton(uint32_t stick, uint32_t button) {
bool DriverStation::GetStickButton(int stick, int button) {
if (stick < 0 || stick >= 6) {
wpi_setWPIErrorWithContext(ParameterOutOfRange,
"stick must be between 0 and 5");
@@ -128,7 +128,7 @@ bool DriverStation::GetStickButton(uint32_t stick, uint32_t button) {
* @param stick The joystick to read.
* @return The state of the buttons on the joystick.
*/
int16_t DriverStation::GetStickButtons(uint32_t stick) {
int16_t DriverStation::GetStickButtons(int stick) {
if (stick < 0 || stick >= 6) {
wpi_setWPIErrorWithContext(ParameterOutOfRange,
"stick must be between 0 and 5");
@@ -161,7 +161,7 @@ int16_t DriverStation::GetStickButtons(uint32_t stick) {
* Valid range is 1 - 4.
* @return The analog voltage on the input.
*/
float DriverStation::GetAnalogIn(uint32_t channel) {
float DriverStation::GetAnalogIn(int channel) {
wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetAnalogIn");
return 0.0;
}
@@ -174,7 +174,7 @@ float DriverStation::GetAnalogIn(uint32_t channel) {
*
* @param channel The digital input to get. Valid range is 1 - 8.
*/
bool DriverStation::GetDigitalIn(uint32_t channel) {
bool DriverStation::GetDigitalIn(int channel) {
wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetDigitalIn");
return false;
}
@@ -188,7 +188,7 @@ bool DriverStation::GetDigitalIn(uint32_t channel) {
* @param channel The digital output to set. Valid range is 1 - 8.
* @param value The state to set the digital output.
*/
void DriverStation::SetDigitalOut(uint32_t channel, bool value) {
void DriverStation::SetDigitalOut(int channel, bool value) {
wpi_setWPIErrorWithContext(UnsupportedInSimulation, "SetDigitalOut");
}
@@ -198,7 +198,7 @@ void DriverStation::SetDigitalOut(uint32_t channel, bool value) {
* @param channel The digital ouput to monitor. Valid range is 1 through 8.
* @return A digital value being output on the Drivers Station.
*/
bool DriverStation::GetDigitalOut(uint32_t channel) {
bool DriverStation::GetDigitalOut(int channel) {
wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetDigitalOut");
return false;
}
@@ -253,7 +253,7 @@ DriverStation::Alliance DriverStation::GetAlliance() const {
* This could return 1, 2, or 3.
* @return The location of the driver station
*/
uint32_t DriverStation::GetLocation() const {
int DriverStation::GetLocation() const {
return -1; // TODO: Support locations
}
@@ -304,7 +304,7 @@ void DriverStation::ReportWarning(std::string error) {
* Report an error to the DriverStation messages window.
* The error is also printed to the program console.
*/
void DriverStation::ReportError(bool is_error, int32_t code,
void DriverStation::ReportError(bool is_error, int code,
const std::string& error,
const std::string& location,
const std::string& stack) {

View File

@@ -10,7 +10,6 @@
#include <sstream>
#include "LiveWindow/LiveWindow.h"
#include "Resource.h"
#include "WPIErrors.h"
/**
@@ -30,15 +29,15 @@
* value will either exactly match the spec'd count or
* be double (2x) the spec'd count.
*/
void Encoder::InitEncoder(int32_t channelA, int32_t channelB,
bool reverseDirection, EncodingType encodingType) {
void Encoder::InitEncoder(int channelA, int channelB, bool reverseDirection,
EncodingType encodingType) {
m_table = nullptr;
this->channelA = channelA;
this->channelB = channelB;
m_encodingType = encodingType;
m_encodingScale = encodingType == k4X ? 4 : encodingType == k2X ? 2 : 1;
int32_t index = 0;
int index = 0;
m_distancePerPulse = 1.0;
LiveWindow::GetInstance()->AddSensor("Encoder", channelA, this);
@@ -77,7 +76,7 @@ void Encoder::InitEncoder(int32_t channelA, int32_t channelB,
* value will either exactly match the spec'd count or
* be double (2x) the spec'd count.
*/
Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
Encoder::Encoder(int aChannel, int bChannel, bool reverseDirection,
EncodingType encodingType) {
InitEncoder(aChannel, bChannel, reverseDirection, encodingType);
}
@@ -204,7 +203,7 @@ double Encoder::DecodingScaleFactor() const {
*
* Used to divide raw edge counts down to spec'd counts.
*/
int32_t Encoder::GetEncodingScale() const { return m_encodingScale; }
int Encoder::GetEncodingScale() const { return m_encodingScale; }
/**
* Gets the raw value from the encoder.
@@ -214,7 +213,7 @@ int32_t Encoder::GetEncodingScale() const { return m_encodingScale; }
*
* @return Current raw count from the encoder
*/
int32_t Encoder::GetRaw() const {
int Encoder::GetRaw() const {
throw "Simulation doesn't currently support this method.";
}
@@ -227,7 +226,7 @@ int32_t Encoder::GetRaw() const {
* @return Current count from the Encoder adjusted for the 1x, 2x, or 4x scale
* factor.
*/
int32_t Encoder::Get() const {
int Encoder::Get() const {
throw "Simulation doesn't currently support this method.";
}

View File

@@ -11,7 +11,7 @@
/**
* @param channel The PWM channel that the Jaguar is attached to.
*/
Jaguar::Jaguar(uint32_t channel) : SafePWM(channel) {
Jaguar::Jaguar(int channel) : SafePWM(channel) {
/*
* Input profile defined by Luminary Micro.
*

View File

@@ -11,13 +11,13 @@
#include "DriverStation.h"
#include "WPIErrors.h"
const uint32_t Joystick::kDefaultXAxis;
const uint32_t Joystick::kDefaultYAxis;
const uint32_t Joystick::kDefaultZAxis;
const uint32_t Joystick::kDefaultTwistAxis;
const uint32_t Joystick::kDefaultThrottleAxis;
const uint32_t Joystick::kDefaultTriggerButton;
const uint32_t Joystick::kDefaultTopButton;
const int Joystick::kDefaultXAxis;
const int Joystick::kDefaultYAxis;
const int Joystick::kDefaultZAxis;
const int Joystick::kDefaultTwistAxis;
const int Joystick::kDefaultThrottleAxis;
const int Joystick::kDefaultTriggerButton;
const int Joystick::kDefaultTopButton;
static Joystick* joysticks[DriverStation::kJoystickPorts];
static bool joySticksInitialized = false;
@@ -28,8 +28,7 @@ static bool joySticksInitialized = false;
*
* @param port The port on the driver station that the joystick is plugged into.
*/
Joystick::Joystick(uint32_t port)
: Joystick(port, kNumAxisTypes, kNumButtonTypes) {
Joystick::Joystick(int port) : Joystick(port, kNumAxisTypes, kNumButtonTypes) {
m_axes[kXAxis] = kDefaultXAxis;
m_axes[kYAxis] = kDefaultYAxis;
m_axes[kZAxis] = kDefaultZAxis;
@@ -51,21 +50,20 @@ Joystick::Joystick(uint32_t port)
* @param numAxisTypes The number of axis types in the enum.
* @param numButtonTypes The number of button types in the enum.
*/
Joystick::Joystick(uint32_t port, uint32_t numAxisTypes,
uint32_t numButtonTypes)
Joystick::Joystick(int port, int numAxisTypes, int numButtonTypes)
: m_port(port), m_ds(DriverStation::GetInstance()) {
if (!joySticksInitialized) {
for (unsigned i = 0; i < DriverStation::kJoystickPorts; i++)
for (int i = 0; i < DriverStation::kJoystickPorts; i++)
joysticks[i] = nullptr;
joySticksInitialized = true;
}
joysticks[m_port] = this;
m_axes = std::make_unique<uint32_t[]>(numAxisTypes);
m_buttons = std::make_unique<uint32_t[]>(numButtonTypes);
m_axes = std::make_unique<int[]>(numAxisTypes);
m_buttons = std::make_unique<int[]>(numButtonTypes);
}
Joystick* Joystick::GetStickForPort(uint32_t port) {
Joystick* Joystick::GetStickForPort(int port) {
Joystick* stick = joysticks[port];
if (stick == nullptr) {
stick = new Joystick(port);
@@ -121,7 +119,7 @@ float Joystick::GetThrottle() const {
* @param axis The axis to read [1-6].
* @return The value of the axis.
*/
float Joystick::GetRawAxis(uint32_t axis) const {
float Joystick::GetRawAxis(int axis) const {
return m_ds.GetStickAxis(m_port, axis);
}
@@ -199,7 +197,7 @@ bool Joystick::GetBumper(JoystickHand hand) const {
* @param button The button number to be read.
* @return The state of the button.
*/
bool Joystick::GetRawButton(uint32_t button) const {
bool Joystick::GetRawButton(int button) const {
return m_ds.GetStickButton(m_port, button);
}
@@ -208,7 +206,7 @@ bool Joystick::GetRawButton(uint32_t button) const {
*
* @return the angle of the POV in degrees, or -1 if the POV is not pressed.
*/
int Joystick::GetPOV(uint32_t pov) const {
int Joystick::GetPOV(int pov) const {
return 0; // TODO
}
@@ -237,7 +235,7 @@ bool Joystick::GetButton(ButtonType button) const {
* @param axis The axis to look up the channel for.
* @return The channel fr the axis.
*/
uint32_t Joystick::GetAxisChannel(AxisType axis) { return m_axes[axis]; }
int Joystick::GetAxisChannel(AxisType axis) { return m_axes[axis]; }
/**
* Set the channel associated with a specified axis.
@@ -245,7 +243,7 @@ uint32_t Joystick::GetAxisChannel(AxisType axis) { return m_axes[axis]; }
* @param axis The axis to set the channel for.
* @param channel The channel to set the axis to.
*/
void Joystick::SetAxisChannel(AxisType axis, uint32_t channel) {
void Joystick::SetAxisChannel(AxisType axis, int channel) {
m_axes[axis] = channel;
}

View File

@@ -80,7 +80,7 @@ void Notifier::UpdateAlarm() {}
* long as its scheduled time is after the current time. Then the item is
* removed or rescheduled (repetitive events) in the queue.
*/
void Notifier::ProcessQueue(uint32_t mask, void* params) {
void Notifier::ProcessQueue(int mask, void* params) {
Notifier* current;
// keep processing events until no more

View File

@@ -81,7 +81,7 @@ PIDController::PIDController(float Kp, float Ki, float Kd, float Kf,
m_controlLoop = std::make_unique<Notifier>(&PIDController::Calculate, this);
m_controlLoop->StartPeriodic(m_period);
static int32_t instances = 0;
static int instances = 0;
instances++;
m_toleranceType = kNoTolerance;
@@ -483,7 +483,7 @@ void PIDController::SetPercentTolerance(float percent) {
* not register as on target for at least the specified bufLength cycles.
* @param bufLength Number of previous cycles to average. Defaults to 1.
*/
void PIDController::SetToleranceBuffer(unsigned bufLength) {
void PIDController::SetToleranceBuffer(int bufLength) {
std::lock_guard<priority_recursive_mutex> lock(m_mutex);
m_bufLength = bufLength;

View File

@@ -14,8 +14,8 @@
const float PWM::kDefaultPwmPeriod = 5.05;
const float PWM::kDefaultPwmCenter = 1.5;
const int32_t PWM::kDefaultPwmStepsDown = 1000;
const int32_t PWM::kPwmDisabled = 0;
const int PWM::kDefaultPwmStepsDown = 1000;
const int PWM::kPwmDisabled = 0;
/**
* Allocate a PWM given a channel number.
@@ -27,7 +27,7 @@ const int32_t PWM::kPwmDisabled = 0;
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP
* port
*/
PWM::PWM(uint32_t channel) {
PWM::PWM(int channel) {
std::stringstream ss;
if (!CheckPWMChannel(channel)) {
@@ -73,8 +73,8 @@ void PWM::EnableDeadbandElimination(bool eliminateDeadband) {
* @param deadbandMin The low end of the deadband range
* @param min The minimum pwm value
*/
void PWM::SetBounds(int32_t max, int32_t deadbandMax, int32_t center,
int32_t deadbandMin, int32_t min) {
void PWM::SetBounds(int max, int deadbandMax, int center, int deadbandMin,
int min) {
// Nothing to do in simulation.
}

View File

@@ -22,7 +22,7 @@
* @param channel The channel number (0-3).
* @param direction The direction that the Relay object will control.
*/
Relay::Relay(uint32_t channel, Relay::Direction direction)
Relay::Relay(int channel, Relay::Direction direction)
: m_channel(channel), m_direction(direction) {
std::stringstream ss;
if (!SensorBase::CheckRelayChannel(m_channel)) {
@@ -138,7 +138,7 @@ Relay::Value Relay::Get() const {
}
}
uint32_t Relay::GetChannel() const { return m_channel; }
int Relay::GetChannel() const { return m_channel; }
/**
* Set the expiration time for the Relay object.

View File

@@ -16,7 +16,7 @@
#undef max
#include <algorithm>
const int32_t RobotDrive::kMaxNumberOfMotors;
const int RobotDrive::kMaxNumberOfMotors;
static auto make_shared_nodelete(SpeedController* ptr) {
return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
@@ -52,7 +52,7 @@ void RobotDrive::InitRobotDrive() {
* @param leftMotorChannel The PWM channel number that drives the left motor.
* @param rightMotorChannel The PWM channel number that drives the right motor.
*/
RobotDrive::RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel) {
RobotDrive::RobotDrive(int leftMotorChannel, int rightMotorChannel) {
InitRobotDrive();
m_rearLeftMotor = std::make_shared<Talon>(leftMotorChannel);
m_rearRightMotor = std::make_shared<Talon>(rightMotorChannel);
@@ -72,8 +72,8 @@ RobotDrive::RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel) {
* @param frontRightMotor Front right motor channel number
* @param rearRightMotor Rear Right motor channel number
*/
RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor,
uint32_t frontRightMotor, uint32_t rearRightMotor) {
RobotDrive::RobotDrive(int frontLeftMotor, int rearLeftMotor,
int frontRightMotor, int rearRightMotor) {
InitRobotDrive();
m_rearLeftMotor = std::make_shared<Talon>(rearLeftMotor);
m_rearRightMotor = std::make_shared<Talon>(rearRightMotor);
@@ -266,8 +266,8 @@ void RobotDrive::TankDrive(GenericHID& leftStick, GenericHID& rightStick,
* @param rightStick The Joystick object to use for the right side of the robot.
* @param rightAxis The axis to select on the right side Joystick object.
*/
void RobotDrive::TankDrive(GenericHID* leftStick, uint32_t leftAxis,
GenericHID* rightStick, uint32_t rightAxis,
void RobotDrive::TankDrive(GenericHID* leftStick, int leftAxis,
GenericHID* rightStick, int rightAxis,
bool squaredInputs) {
if (leftStick == nullptr || rightStick == nullptr) {
wpi_setWPIError(NullParameter);
@@ -277,8 +277,8 @@ void RobotDrive::TankDrive(GenericHID* leftStick, uint32_t leftAxis,
squaredInputs);
}
void RobotDrive::TankDrive(GenericHID& leftStick, uint32_t leftAxis,
GenericHID& rightStick, uint32_t rightAxis,
void RobotDrive::TankDrive(GenericHID& leftStick, int leftAxis,
GenericHID& rightStick, int rightAxis,
bool squaredInputs) {
TankDrive(leftStick.GetRawAxis(leftAxis), rightStick.GetRawAxis(rightAxis),
squaredInputs);
@@ -371,8 +371,8 @@ void RobotDrive::ArcadeDrive(GenericHID& stick, bool squaredInputs) {
* @param squaredInputs Setting this parameter to true increases the sensitivity
* at lower speeds
*/
void RobotDrive::ArcadeDrive(GenericHID* moveStick, uint32_t moveAxis,
GenericHID* rotateStick, uint32_t rotateAxis,
void RobotDrive::ArcadeDrive(GenericHID* moveStick, int moveAxis,
GenericHID* rotateStick, int rotateAxis,
bool squaredInputs) {
float moveValue = moveStick->GetRawAxis(moveAxis);
float rotateValue = rotateStick->GetRawAxis(rotateAxis);
@@ -396,8 +396,8 @@ void RobotDrive::ArcadeDrive(GenericHID* moveStick, uint32_t moveAxis,
* @param squaredInputs Setting this parameter to true increases the sensitivity
* at lower speeds
*/
void RobotDrive::ArcadeDrive(GenericHID& moveStick, uint32_t moveAxis,
GenericHID& rotateStick, uint32_t rotateAxis,
void RobotDrive::ArcadeDrive(GenericHID& moveStick, int moveAxis,
GenericHID& rotateStick, int rotateAxis,
bool squaredInputs) {
float moveValue = moveStick.GetRawAxis(moveAxis);
float rotateValue = rotateStick.GetRawAxis(rotateAxis);
@@ -630,7 +630,7 @@ float RobotDrive::Limit(float num) {
*/
void RobotDrive::Normalize(double* wheelSpeeds) {
double maxMagnitude = fabs(wheelSpeeds[0]);
int32_t i;
int i;
for (i = 1; i < kMaxNumberOfMotors; i++) {
double temp = fabs(wheelSpeeds[i]);
if (maxMagnitude < temp) maxMagnitude = temp;

View File

@@ -14,7 +14,7 @@
*
* @param channel The PWM channel number (0..19).
*/
SafePWM::SafePWM(uint32_t channel) : PWM(channel) {
SafePWM::SafePWM(int channel) : PWM(channel) {
m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
m_safetyHelper->SetSafetyEnabled(false);
}

View File

@@ -18,7 +18,7 @@
#include <unistd.h>
#elif defined(_WIN32)
#include <windows.h>
void sleep(unsigned milliseconds) { Sleep(milliseconds); }
void sleep(unsigned int milliseconds) { Sleep(milliseconds); }
#endif
SampleRobot::SampleRobot() : m_robotMainOverridden(true) {}

View File

@@ -18,7 +18,7 @@
*
* @param channel The channel on the solenoid module to control (1..8).
*/
Solenoid::Solenoid(uint32_t channel) : Solenoid(1, channel) {}
Solenoid::Solenoid(int channel) : Solenoid(1, channel) {}
/**
* Constructor.
@@ -26,7 +26,7 @@ Solenoid::Solenoid(uint32_t channel) : Solenoid(1, channel) {}
* @param moduleNumber The solenoid module (1 or 2).
* @param channel The channel on the solenoid module to control (1..8).
*/
Solenoid::Solenoid(uint8_t moduleNumber, uint32_t channel) {
Solenoid::Solenoid(int moduleNumber, int channel) {
std::stringstream ss;
ss << "pneumatic/" << moduleNumber << "/" << channel;
m_impl = new SimContinuousOutput(ss.str());

View File

@@ -12,7 +12,7 @@
/**
* @param channel The PWM channel that the Talon is attached to.
*/
Talon::Talon(uint32_t channel) : SafePWM(channel) {
Talon::Talon(int channel) : SafePWM(channel) {
/* Note that the Talon uses the following bounds for PWM values. These values
* should work reasonably well for most controllers, but if users experience
* issues such as asymmetric behavior around the deadband or inability to

View File

@@ -53,8 +53,8 @@ static void wpi_handleTracing() {
* Utility.h.
*/
bool wpi_assert_impl(bool conditionValue, const char* conditionText,
const char* message, const char* fileName,
uint32_t lineNumber, const char* funcName) {
const char* message, const char* fileName, int lineNumber,
const char* funcName) {
if (!conditionValue) {
std::stringstream errorStream;
@@ -84,8 +84,7 @@ bool wpi_assert_impl(bool conditionValue, const char* conditionText,
void wpi_assertEqual_common_impl(int valueA, int valueB,
const std::string& equalityType,
const std::string& message,
const std::string& fileName,
uint32_t lineNumber,
const std::string& fileName, int lineNumber,
const std::string& funcName) {
// Error string buffer
std::stringstream error;
@@ -116,7 +115,7 @@ void wpi_assertEqual_common_impl(int valueA, int valueB,
* Utility.h.
*/
bool wpi_assertEqual_impl(int valueA, int valueB, const std::string& message,
const std::string& fileName, uint32_t lineNumber,
const std::string& fileName, int lineNumber,
const std::string& funcName) {
if (!(valueA == valueB)) {
wpi_assertEqual_common_impl(valueA, valueB, "!=", message, fileName,
@@ -133,7 +132,7 @@ bool wpi_assertEqual_impl(int valueA, int valueB, const std::string& message,
* Utility.h.
*/
bool wpi_assertNotEqual_impl(int valueA, int valueB, const std::string& message,
const std::string& fileName, uint32_t lineNumber,
const std::string& fileName, int lineNumber,
const std::string& funcName) {
if (!(valueA != valueB)) {
wpi_assertEqual_common_impl(valueA, valueB, "==", message, fileName,
@@ -159,7 +158,7 @@ uint64_t GetFPGATime() { return wpilib::internal::simTime * 1e6; }
static std::string demangle(char const* mangledSymbol) {
char buffer[256];
size_t length;
int status;
int32_t status;
if (sscanf(mangledSymbol, "%*[^(]%*[^_]%255[^)+]", buffer)) {
char* symbol = abi::__cxa_demangle(buffer, nullptr, &length, &status);
@@ -180,7 +179,7 @@ static std::string demangle(char const* mangledSymbol) {
/**
* Get a stack trace, ignoring the first "offset" symbols.
*/
std::string GetStackTrace(uint32_t offset) {
std::string GetStackTrace(int offset) {
void* stackTrace[128];
int stackSize = backtrace(stackTrace, 128);
char** mangledSymbols = backtrace_symbols(stackTrace, stackSize);
@@ -202,7 +201,5 @@ std::string GetStackTrace(uint32_t offset) {
static std::string demangle(char const* mangledSymbol) {
return "no demangling on windows";
}
std::string GetStackTrace(uint32_t offset) {
return "no stack trace on windows";
}
std::string GetStackTrace(int offset) { return "no stack trace on windows"; }
#endif

View File

@@ -12,7 +12,7 @@
/**
* @param channel The PWM channel that the Victor is attached to.
*/
Victor::Victor(uint32_t channel) : SafePWM(channel) {
Victor::Victor(int channel) : SafePWM(channel) {
/* Note that the Victor uses the following bounds for PWM values. These values
* were determined empirically and optimized for the Victor 888. These values
* should work reasonably well for Victor 884 controllers as well but if users