Fix usage reporting indices (#2009)

According to NI, 0 is unspecified, and all the indices need to be
index + 1, so the first index becomes 1.
This commit is contained in:
Thad House
2019-10-29 21:34:10 -07:00
committed by Peter Johnson
parent f6b844ea30
commit 9dc30797e4
74 changed files with 95 additions and 94 deletions

View File

@@ -72,7 +72,7 @@ ADXL362::ADXL362(SPI::Port port, Range range)
commands[2] = kPowerCtl_Measure | kPowerCtl_UltraLowNoise;
m_spi.Write(commands, 3);
HAL_Report(HALUsageReporting::kResourceType_ADXL362, port);
HAL_Report(HALUsageReporting::kResourceType_ADXL362, port + 1);
SendableRegistry::GetInstance().AddLW(this, "ADXL362", port);
}

View File

@@ -57,7 +57,7 @@ ADXRS450_Gyro::ADXRS450_Gyro(SPI::Port port)
Calibrate();
}
HAL_Report(HALUsageReporting::kResourceType_ADXRS450, port);
HAL_Report(HALUsageReporting::kResourceType_ADXRS450, port + 1);
SendableRegistry::GetInstance().AddLW(this, "ADXRS450_Gyro", port);
}

View File

@@ -58,7 +58,7 @@ void AnalogAccelerometer::InitSendable(SendableBuilder& builder) {
void AnalogAccelerometer::InitAccelerometer() {
HAL_Report(HALUsageReporting::kResourceType_Accelerometer,
m_analogInput->GetChannel());
m_analogInput->GetChannel() + 1);
SendableRegistry::GetInstance().AddLW(this, "Accelerometer",
m_analogInput->GetChannel());

View File

@@ -148,7 +148,7 @@ void AnalogGyro::InitGyro() {
return;
}
HAL_Report(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel());
HAL_Report(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel() + 1);
SendableRegistry::GetInstance().AddLW(this, "AnalogGyro",
m_analog->GetChannel());

View File

@@ -42,7 +42,7 @@ AnalogInput::AnalogInput(int channel) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_AnalogChannel, channel);
HAL_Report(HALUsageReporting::kResourceType_AnalogChannel, channel + 1);
SendableRegistry::GetInstance().AddLW(this, "AnalogInput", channel);
}

View File

@@ -42,7 +42,7 @@ AnalogOutput::AnalogOutput(int channel) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_AnalogOutput, m_channel);
HAL_Report(HALUsageReporting::kResourceType_AnalogOutput, m_channel + 1);
SendableRegistry::GetInstance().AddLW(this, "AnalogOutput", m_channel);
}

View File

@@ -36,7 +36,7 @@ AnalogTrigger::AnalogTrigger(AnalogInput* input) {
}
m_index = index;
HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, input->m_channel);
HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, m_index + 1);
SendableRegistry::GetInstance().AddLW(this, "AnalogTrigger",
input->GetChannel());
}

View File

@@ -41,5 +41,5 @@ AnalogTriggerOutput::AnalogTriggerOutput(const AnalogTrigger& trigger,
AnalogTriggerType outputType)
: m_trigger(&trigger), m_outputType(outputType) {
HAL_Report(HALUsageReporting::kResourceType_AnalogTriggerOutput,
trigger.GetIndex(), static_cast<uint8_t>(outputType));
trigger.GetIndex() + 1, static_cast<uint8_t>(outputType) + 1);
}

View File

@@ -27,7 +27,7 @@ CAN::CAN(int deviceId) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId);
HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId + 1);
}
CAN::CAN(int deviceId, int deviceManufacturer, int deviceType) {
@@ -41,7 +41,7 @@ CAN::CAN(int deviceId, int deviceManufacturer, int deviceType) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId);
HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId + 1);
}
CAN::~CAN() {

View File

@@ -28,7 +28,7 @@ Compressor::Compressor(int pcmID) : m_module(pcmID) {
}
SetClosedLoopControl(true);
HAL_Report(HALUsageReporting::kResourceType_Compressor, pcmID);
HAL_Report(HALUsageReporting::kResourceType_Compressor, pcmID + 1);
SendableRegistry::GetInstance().AddLW(this, "Compressor", pcmID);
}

View File

@@ -26,7 +26,7 @@ Counter::Counter(Mode mode) {
SetMaxPeriod(.5);
HAL_Report(HALUsageReporting::kResourceType_Counter, m_index, mode);
HAL_Report(HALUsageReporting::kResourceType_Counter, m_index + 1, mode + 1);
SendableRegistry::GetInstance().AddLW(this, "Counter", m_index);
}

View File

@@ -33,6 +33,6 @@ DMC60::DMC60(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_DigilentDMC60, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_DigilentDMC60, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "DMC60", GetChannel());
}

View File

@@ -38,7 +38,7 @@ DigitalGlitchFilter::DigitalGlitchFilter() {
*index = true;
HAL_Report(HALUsageReporting::kResourceType_DigitalGlitchFilter,
m_channelIndex);
m_channelIndex + 1);
SendableRegistry::GetInstance().AddLW(this, "DigitalGlitchFilter",
m_channelIndex);
}
@@ -87,9 +87,6 @@ void DigitalGlitchFilter::DoAdd(DigitalSource* input, int requestedIndex) {
int actualIndex =
HAL_GetFilterSelect(input->GetPortHandleForRouting(), &status);
wpi_assertEqual(actualIndex, requestedIndex);
HAL_Report(HALUsageReporting::kResourceType_DigitalInput,
input->GetChannel());
}
}

View File

@@ -40,7 +40,7 @@ DigitalInput::DigitalInput(int channel) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel);
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel + 1);
SendableRegistry::GetInstance().AddLW(this, "DigitalInput", channel);
}

View File

@@ -41,7 +41,7 @@ DigitalOutput::DigitalOutput(int channel) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_DigitalOutput, channel);
HAL_Report(HALUsageReporting::kResourceType_DigitalOutput, channel + 1);
SendableRegistry::GetInstance().AddLW(this, "DigitalOutput", channel);
}

View File

@@ -72,10 +72,10 @@ DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
m_forwardMask = 1 << m_forwardChannel;
m_reverseMask = 1 << m_reverseChannel;
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_forwardChannel,
m_moduleNumber);
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_reverseChannel,
m_moduleNumber);
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_forwardChannel + 1,
m_moduleNumber + 1);
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_reverseChannel + 1,
m_moduleNumber + 1);
SendableRegistry::GetInstance().AddLW(this, "DoubleSolenoid", m_moduleNumber,
m_forwardChannel);

View File

@@ -254,7 +254,7 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
reverseDirection, (HAL_EncoderEncodingType)encodingType, &status);
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
HAL_Report(HALUsageReporting::kResourceType_Encoder, GetFPGAIndex(),
HAL_Report(HALUsageReporting::kResourceType_Encoder, GetFPGAIndex() + 1,
encodingType);
SendableRegistry::GetInstance().AddLW(this, "Encoder",
m_aSource->GetChannel());

View File

@@ -27,6 +27,6 @@ Jaguar::Jaguar(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_Jaguar, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_Jaguar, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "Jaguar", GetChannel());
}

View File

@@ -24,7 +24,7 @@ Joystick::Joystick(int port) : GenericHID(port) {
m_axes[Axis::kTwist] = kDefaultTwistChannel;
m_axes[Axis::kThrottle] = kDefaultThrottleChannel;
HAL_Report(HALUsageReporting::kResourceType_Joystick, port);
HAL_Report(HALUsageReporting::kResourceType_Joystick, port + 1);
}
void Joystick::SetXChannel(int channel) { m_axes[Axis::kX] = channel; }

View File

@@ -26,7 +26,7 @@ NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
m_dio.SetPWMRate(15625);
m_dio.EnablePWM(0.5);
HAL_Report(HALUsageReporting::kResourceType_NidecBrushless, pwmChannel);
HAL_Report(HALUsageReporting::kResourceType_NidecBrushless, pwmChannel + 1);
registry.AddLW(this, "Nidec Brushless", pwmChannel);
}

View File

@@ -46,7 +46,7 @@ PWM::PWM(int channel) {
HAL_SetPWMEliminateDeadband(m_handle, false, &status);
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
HAL_Report(HALUsageReporting::kResourceType_PWM, channel);
HAL_Report(HALUsageReporting::kResourceType_PWM, channel + 1);
SendableRegistry::GetInstance().AddLW(this, "PWM", channel);
SetSafetyEnabled(false);

View File

@@ -27,6 +27,6 @@ PWMSparkMax::PWMSparkMax(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_RevSparkMaxPWM, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_RevSparkMaxPWM, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "PWMSparkMax", GetChannel());
}

View File

@@ -31,6 +31,6 @@ PWMTalonSRX::PWMTalonSRX(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_PWMTalonSRX, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_PWMTalonSRX, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "PWMTalonSRX", GetChannel());
}

View File

@@ -31,6 +31,6 @@ PWMVictorSPX::PWMVictorSPX(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_PWMVictorSPX, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_PWMVictorSPX, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "PWMVictorSPX", GetChannel());
}

View File

@@ -34,7 +34,7 @@ PowerDistributionPanel::PowerDistributionPanel(int module) {
return;
}
HAL_Report(HALUsageReporting::kResourceType_PDP, module);
HAL_Report(HALUsageReporting::kResourceType_PDP, module + 1);
SendableRegistry::GetInstance().AddLW(this, "PowerDistributionPanel", module);
}

View File

@@ -41,7 +41,7 @@ Relay::Relay(int channel, Relay::Direction direction)
m_reverseHandle = HAL_kInvalidHandle;
return;
}
HAL_Report(HALUsageReporting::kResourceType_Relay, m_channel);
HAL_Report(HALUsageReporting::kResourceType_Relay, m_channel + 1);
}
if (m_direction == kBothDirections || m_direction == kReverseOnly) {
int32_t status = 0;

View File

@@ -32,6 +32,7 @@ SD540::SD540(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540,
GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "SD540", GetChannel());
}

View File

@@ -157,7 +157,8 @@ SPI::SPI(Port port) : m_port(static_cast<HAL_SPIPort>(port)) {
HAL_InitializeSPI(m_port, &status);
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
HAL_Report(HALUsageReporting::kResourceType_SPI, port);
HAL_Report(HALUsageReporting::kResourceType_SPI,
static_cast<uint8_t>(port) + 1);
}
SPI::~SPI() { HAL_CloseSPI(m_port); }

View File

@@ -41,7 +41,8 @@ SerialPort::SerialPort(int baudRate, Port port, int dataBits,
DisableTermination();
HAL_Report(HALUsageReporting::kResourceType_SerialPort, 0);
HAL_Report(HALUsageReporting::kResourceType_SerialPort,
static_cast<uint8_t>(port) + 1);
}
SerialPort::SerialPort(int baudRate, const wpi::Twine& portName, Port port,
@@ -74,7 +75,8 @@ SerialPort::SerialPort(int baudRate, const wpi::Twine& portName, Port port,
DisableTermination();
HAL_Report(HALUsageReporting::kResourceType_SerialPort, 0);
HAL_Report(HALUsageReporting::kResourceType_SerialPort,
static_cast<uint8_t>(port) + 1);
}
SerialPort::~SerialPort() {

View File

@@ -27,7 +27,7 @@ Servo::Servo(int channel) : PWM(channel) {
// Assign defaults for period multiplier for the servo PWM control signal
SetPeriodMultiplier(kPeriodMultiplier_4X);
HAL_Report(HALUsageReporting::kResourceType_Servo, channel);
HAL_Report(HALUsageReporting::kResourceType_Servo, channel + 1);
SendableRegistry::GetInstance().SetName(this, "Servo", channel);
}

View File

@@ -46,8 +46,8 @@ Solenoid::Solenoid(int moduleNumber, int channel)
return;
}
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_channel,
m_moduleNumber);
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_channel + 1,
m_moduleNumber + 1);
SendableRegistry::GetInstance().AddLW(this, "Solenoid", m_moduleNumber,
m_channel);
}

View File

@@ -32,6 +32,6 @@ Spark::Spark(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_RevSPARK, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_RevSPARK, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "Spark", GetChannel());
}

View File

@@ -32,6 +32,6 @@ Talon::Talon(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_Talon, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_Talon, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "Talon", GetChannel());
}

View File

@@ -33,6 +33,6 @@ Victor::Victor(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_Victor, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_Victor, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "Victor", GetChannel());
}

View File

@@ -32,6 +32,6 @@ VictorSP::VictorSP(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel() + 1);
SendableRegistry::GetInstance().SetName(this, "VictorSP", GetChannel());
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -12,7 +12,7 @@
using namespace frc;
XboxController::XboxController(int port) : GenericHID(port) {
HAL_Report(HALUsageReporting::kResourceType_XboxController, port);
HAL_Report(HALUsageReporting::kResourceType_XboxController, port + 1);
}
double XboxController::GetX(JoystickHand hand) const {

View File

@@ -129,7 +129,7 @@ public class ADXL362 implements Accelerometer, Sendable, AutoCloseable {
transferBuffer.put(2, (byte) (kPowerCtl_Measure | kPowerCtl_UltraLowNoise));
m_spi.write(transferBuffer, 3);
HAL.report(tResourceType.kResourceType_ADXL362, port.value);
HAL.report(tResourceType.kResourceType_ADXL362, port.value + 1);
SendableRegistry.addLW(this, "ADXL362", port.value);
}

View File

@@ -95,7 +95,7 @@ public class ADXRS450_Gyro extends GyroBase implements Gyro, PIDSource, Sendable
calibrate();
}
HAL.report(tResourceType.kResourceType_ADXRS450, port.value);
HAL.report(tResourceType.kResourceType_ADXRS450, port.value + 1);
SendableRegistry.addLW(this, "ADXRS450_Gyro", port.value);
}

View File

@@ -31,7 +31,7 @@ public class AnalogAccelerometer implements PIDSource, Sendable, AutoCloseable {
*/
private void initAccelerometer() {
HAL.report(tResourceType.kResourceType_Accelerometer,
m_analogChannel.getChannel());
m_analogChannel.getChannel() + 1);
SendableRegistry.addLW(this, "Accelerometer", m_analogChannel.getChannel());
}

View File

@@ -41,7 +41,7 @@ public class AnalogGyro extends GyroBase implements Gyro, PIDSource, Sendable, A
AnalogGyroJNI.setupAnalogGyro(m_gyroHandle);
HAL.report(tResourceType.kResourceType_Gyro, m_analog.getChannel());
HAL.report(tResourceType.kResourceType_Gyro, m_analog.getChannel() + 1);
SendableRegistry.addLW(this, "AnalogGyro", m_analog.getChannel());
}

View File

@@ -49,7 +49,7 @@ public class AnalogInput implements PIDSource, Sendable, AutoCloseable {
final int portHandle = HAL.getPort((byte) channel);
m_port = AnalogJNI.initializeAnalogInputPort(portHandle);
HAL.report(tResourceType.kResourceType_AnalogChannel, channel);
HAL.report(tResourceType.kResourceType_AnalogChannel, channel + 1);
SendableRegistry.addLW(this, "AnalogInput", channel);
}

View File

@@ -33,7 +33,7 @@ public class AnalogOutput implements Sendable, AutoCloseable {
final int portHandle = HAL.getPort((byte) channel);
m_port = AnalogJNI.initializeAnalogOutputPort(portHandle);
HAL.report(tResourceType.kResourceType_AnalogOutput, channel);
HAL.report(tResourceType.kResourceType_AnalogOutput, channel + 1);
SendableRegistry.addLW(this, "AnalogOutput", channel);
}

View File

@@ -72,7 +72,7 @@ public class AnalogTrigger implements Sendable, AutoCloseable {
AnalogJNI.initializeAnalogTrigger(channel.m_port, index.asIntBuffer());
m_index = index.asIntBuffer().get(0);
HAL.report(tResourceType.kResourceType_AnalogTrigger, channel.getChannel());
HAL.report(tResourceType.kResourceType_AnalogTrigger, m_index + 1);
SendableRegistry.addLW(this, "AnalogTrigger", channel.getChannel());
}

View File

@@ -74,7 +74,7 @@ public class AnalogTriggerOutput extends DigitalSource implements Sendable {
m_trigger = trigger;
m_outputType = outputType;
HAL.report(tResourceType.kResourceType_AnalogTriggerOutput,
trigger.getIndex(), outputType.value);
trigger.getIndex() + 1, outputType.value + 1);
}
/**

View File

@@ -40,7 +40,7 @@ public class CAN implements Closeable {
*/
public CAN(int deviceId) {
m_handle = CANAPIJNI.initializeCAN(kTeamManufacturer, deviceId, kTeamDeviceType);
HAL.report(tResourceType.kResourceType_CAN, deviceId);
HAL.report(tResourceType.kResourceType_CAN, deviceId + 1);
}
/**
@@ -54,7 +54,7 @@ public class CAN implements Closeable {
*/
public CAN(int deviceId, int deviceManufacturer, int deviceType) {
m_handle = CANAPIJNI.initializeCAN(deviceManufacturer, deviceId, deviceType);
HAL.report(tResourceType.kResourceType_CAN, deviceId);
HAL.report(tResourceType.kResourceType_CAN, deviceId + 1);
}
/**

View File

@@ -39,7 +39,7 @@ public class Compressor implements Sendable, AutoCloseable {
m_compressorHandle = CompressorJNI.initializeCompressor((byte) module);
HAL.report(tResourceType.kResourceType_Compressor, module);
HAL.report(tResourceType.kResourceType_Compressor, module + 1);
SendableRegistry.addLW(this, "Compressor", module);
}

View File

@@ -86,7 +86,7 @@ public class Counter implements CounterBase, PIDSource, Sendable, AutoCloseable
setMaxPeriod(.5);
HAL.report(tResourceType.kResourceType_Counter, m_index, mode.value);
HAL.report(tResourceType.kResourceType_Counter, m_index + 1, mode.value + 1);
SendableRegistry.addLW(this, "Counter", m_index);
}

View File

@@ -39,7 +39,7 @@ public class DMC60 extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_DigilentDMC60, getChannel());
HAL.report(tResourceType.kResourceType_DigilentDMC60, getChannel() + 1);
SendableRegistry.setName(this, "DMC60", getChannel());
}
}

View File

@@ -35,7 +35,7 @@ public class DigitalGlitchFilter implements Sendable, AutoCloseable {
m_channelIndex = index;
m_filterAllocated[index] = true;
HAL.report(tResourceType.kResourceType_DigitalGlitchFilter,
m_channelIndex, 0);
m_channelIndex + 1, 0);
SendableRegistry.addLW(this, "DigitalGlitchFilter", index);
}
}

View File

@@ -35,7 +35,7 @@ public class DigitalInput extends DigitalSource implements Sendable, AutoCloseab
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), true);
HAL.report(tResourceType.kResourceType_DigitalInput, channel);
HAL.report(tResourceType.kResourceType_DigitalInput, channel + 1);
SendableRegistry.addLW(this, "DigitalInput", channel);
}

View File

@@ -38,7 +38,7 @@ public class DigitalOutput implements Sendable, AutoCloseable {
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), false);
HAL.report(tResourceType.kResourceType_DigitalOutput, channel);
HAL.report(tResourceType.kResourceType_DigitalOutput, channel + 1);
SendableRegistry.addLW(this, "DigitalOutput", channel);
}

View File

@@ -77,10 +77,10 @@ public class DoubleSolenoid extends SolenoidBase implements Sendable, AutoClosea
m_forwardMask = (byte) (1 << forwardChannel);
m_reverseMask = (byte) (1 << reverseChannel);
HAL.report(tResourceType.kResourceType_Solenoid, forwardChannel,
m_moduleNumber);
HAL.report(tResourceType.kResourceType_Solenoid, reverseChannel,
m_moduleNumber);
HAL.report(tResourceType.kResourceType_Solenoid, forwardChannel + 1,
m_moduleNumber + 1);
HAL.report(tResourceType.kResourceType_Solenoid, reverseChannel + 1,
m_moduleNumber + 1);
SendableRegistry.addLW(this, "DoubleSolenoid", m_moduleNumber, forwardChannel);
}

View File

@@ -80,7 +80,7 @@ public class Encoder implements CounterBase, PIDSource, Sendable, AutoCloseable
m_pidSource = PIDSourceType.kDisplacement;
int fpgaIndex = getFPGAIndex();
HAL.report(tResourceType.kResourceType_Encoder, fpgaIndex, type.value);
HAL.report(tResourceType.kResourceType_Encoder, fpgaIndex + 1, type.value + 1);
SendableRegistry.addLW(this, "Encoder", fpgaIndex);
}

View File

@@ -56,9 +56,9 @@ public class GearTooth extends Counter {
super(channel);
enableDirectionSensing(directionSensitive);
if (directionSensitive) {
HAL.report(tResourceType.kResourceType_GearTooth, channel, 0, "D");
HAL.report(tResourceType.kResourceType_GearTooth, channel + 1, 0, "D");
} else {
HAL.report(tResourceType.kResourceType_GearTooth, channel, 0);
HAL.report(tResourceType.kResourceType_GearTooth, channel + 1, 0);
}
SendableRegistry.setName(this, "GearTooth", channel);
}
@@ -75,9 +75,9 @@ public class GearTooth extends Counter {
super(source);
enableDirectionSensing(directionSensitive);
if (directionSensitive) {
HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel(), 0, "D");
HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel() + 1, 0, "D");
} else {
HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel(), 0);
HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel() + 1, 0);
}
SendableRegistry.setName(this, "GearTooth", source.getChannel());
}

View File

@@ -37,7 +37,7 @@ public class Jaguar extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_Jaguar, getChannel());
HAL.report(tResourceType.kResourceType_Jaguar, getChannel() + 1);
SendableRegistry.setName(this, "Jaguar", getChannel());
}
}

View File

@@ -97,7 +97,7 @@ public class Joystick extends GenericHID {
m_axes[Axis.kTwist.value] = kDefaultTwistChannel;
m_axes[Axis.kThrottle.value] = kDefaultThrottleChannel;
HAL.report(tResourceType.kResourceType_Joystick, port);
HAL.report(tResourceType.kResourceType_Joystick, port + 1);
}
/**

View File

@@ -44,7 +44,7 @@ public class NidecBrushless extends MotorSafety implements SpeedController, Send
m_pwm = new PWM(pwmChannel);
SendableRegistry.addChild(this, m_pwm);
HAL.report(tResourceType.kResourceType_NidecBrushless, pwmChannel);
HAL.report(tResourceType.kResourceType_NidecBrushless, pwmChannel + 1);
SendableRegistry.addLW(this, "Nidec Brushless", pwmChannel);
}

View File

@@ -63,7 +63,7 @@ public class PWM extends MotorSafety implements Sendable, AutoCloseable {
PWMJNI.setPWMEliminateDeadband(m_handle, false);
HAL.report(tResourceType.kResourceType_PWM, channel);
HAL.report(tResourceType.kResourceType_PWM, channel + 1);
SendableRegistry.addLW(this, "PWM", channel);
setSafetyEnabled(false);

View File

@@ -36,7 +36,7 @@ public class PWMSparkMax extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_RevSparkMaxPWM, getChannel());
HAL.report(tResourceType.kResourceType_RevSparkMaxPWM, getChannel() + 1);
SendableRegistry.setName(this, "PWMSparkMax", getChannel());
}
}

View File

@@ -40,7 +40,7 @@ public class PWMTalonSRX extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_PWMTalonSRX, getChannel());
HAL.report(tResourceType.kResourceType_PWMTalonSRX, getChannel() + 1);
SendableRegistry.setName(this, "PWMTalonSRX", getChannel());
}
}

View File

@@ -40,7 +40,7 @@ public class PWMVictorSPX extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_PWMVictorSPX, getChannel());
HAL.report(tResourceType.kResourceType_PWMVictorSPX, getChannel() + 1);
SendableRegistry.setName(this, "PWMVictorSPX", getChannel());
}
}

View File

@@ -29,7 +29,7 @@ public class PowerDistributionPanel implements Sendable, AutoCloseable {
SensorUtil.checkPDPModule(module);
m_handle = PDPJNI.initializePDP(module);
HAL.report(tResourceType.kResourceType_PDP, module);
HAL.report(tResourceType.kResourceType_PDP, module + 1);
SendableRegistry.addLW(this, "PowerDistributionPanel", module);
}

View File

@@ -105,7 +105,7 @@ public class Relay extends MotorSafety implements Sendable, AutoCloseable {
int portHandle = HAL.getPort((byte) m_channel);
if (m_direction == Direction.kBoth || m_direction == Direction.kForward) {
m_forwardHandle = RelayJNI.initializeRelayPort(portHandle, true);
HAL.report(tResourceType.kResourceType_Relay, m_channel);
HAL.report(tResourceType.kResourceType_Relay, m_channel + 1);
}
if (m_direction == Direction.kBoth || m_direction == Direction.kReverse) {
m_reverseHandle = RelayJNI.initializeRelayPort(portHandle, false);

View File

@@ -45,12 +45,12 @@ public abstract class RobotBase implements AutoCloseable {
@Override
public void reportVideoServer(int id) {
HAL.report(tResourceType.kResourceType_PCVideoServer, id);
HAL.report(tResourceType.kResourceType_PCVideoServer, id + 1);
}
@Override
public void reportUsbCamera(int id) {
HAL.report(tResourceType.kResourceType_UsbCamera, id);
HAL.report(tResourceType.kResourceType_UsbCamera, id + 1);
}
@Override
@@ -60,7 +60,7 @@ public abstract class RobotBase implements AutoCloseable {
@Override
public void reportAxisCamera(int id) {
HAL.report(tResourceType.kResourceType_AxisCamera, id);
HAL.report(tResourceType.kResourceType_AxisCamera, id + 1);
}
@Override

View File

@@ -34,7 +34,7 @@ public class SD540 extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_MindsensorsSD540, getChannel());
HAL.report(tResourceType.kResourceType_MindsensorsSD540, getChannel() + 1);
SendableRegistry.setName(this, "SD540", getChannel());
}

View File

@@ -47,7 +47,7 @@ public class SPI implements AutoCloseable {
SPIJNI.spiInitialize(m_port);
HAL.report(tResourceType.kResourceType_SPI, port.value);
HAL.report(tResourceType.kResourceType_SPI, port.value + 1);
}
@Override

View File

@@ -120,7 +120,7 @@ public class SerialPort implements AutoCloseable {
disableTermination();
HAL.report(tResourceType.kResourceType_SerialPort, 0);
HAL.report(tResourceType.kResourceType_SerialPort, port.value + 1);
}
/**
@@ -151,7 +151,7 @@ public class SerialPort implements AutoCloseable {
disableTermination();
HAL.report(tResourceType.kResourceType_SerialPort, 0);
HAL.report(tResourceType.kResourceType_SerialPort, port.value + 1);
}
/**

View File

@@ -39,7 +39,7 @@ public class Servo extends PWM {
setBounds(kDefaultMaxServoPWM, 0, 0, 0, kDefaultMinServoPWM);
setPeriodMultiplier(PeriodMultiplier.k4X);
HAL.report(tResourceType.kResourceType_Servo, getChannel());
HAL.report(tResourceType.kResourceType_Servo, getChannel() + 1);
SendableRegistry.setName(this, "Servo", getChannel());
}

View File

@@ -48,7 +48,7 @@ public class Solenoid extends SolenoidBase implements Sendable, AutoCloseable {
int portHandle = HAL.getPortWithModule((byte) m_moduleNumber, (byte) m_channel);
m_solenoidHandle = SolenoidJNI.initializeSolenoidPort(portHandle);
HAL.report(tResourceType.kResourceType_Solenoid, m_channel, m_moduleNumber);
HAL.report(tResourceType.kResourceType_Solenoid, m_channel + 1, m_moduleNumber + 1);
SendableRegistry.addLW(this, "Solenoid", m_moduleNumber, m_channel);
}

View File

@@ -34,7 +34,7 @@ public class Spark extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_RevSPARK, getChannel());
HAL.report(tResourceType.kResourceType_RevSPARK, getChannel() + 1);
SendableRegistry.setName(this, "Spark", getChannel());
}

View File

@@ -39,7 +39,7 @@ public class Talon extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_Talon, getChannel());
HAL.report(tResourceType.kResourceType_Talon, getChannel() + 1);
SendableRegistry.setName(this, "Talon", getChannel());
}
}

View File

@@ -41,7 +41,7 @@ public class Victor extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_Victor, getChannel());
HAL.report(tResourceType.kResourceType_Victor, getChannel() + 1);
SendableRegistry.setName(this, "Victor", getChannel());
}
}

View File

@@ -39,7 +39,7 @@ public class VictorSP extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_VictorSP, getChannel());
HAL.report(tResourceType.kResourceType_VictorSP, getChannel() + 1);
SendableRegistry.setName(this, "VictorSP", getChannel());
}
}

View File

@@ -50,7 +50,7 @@ public class XboxController extends GenericHID {
public XboxController(final int port) {
super(port);
HAL.report(tResourceType.kResourceType_XboxController, port);
HAL.report(tResourceType.kResourceType_XboxController, port + 1);
}
/**