mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[xrp] Update XRP for new SparkFun RP2350 Board (#7880)
Enables servos 3 and 4 usage on the new XRP board.
This commit is contained in:
@@ -142,6 +142,10 @@ void XRP::HandleServoSimValueChanged(const wpi::json& data) {
|
||||
deviceId = 4;
|
||||
} else if (data["device"] == "servo2") {
|
||||
deviceId = 5;
|
||||
} else if (data["device"] == "servo3") {
|
||||
deviceId = 6;
|
||||
} else if (data["device"] == "servo4") {
|
||||
deviceId = 7;
|
||||
}
|
||||
|
||||
if (deviceId != -1 && servoData.find("<position") != servoData.end()) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class XRPServo {
|
||||
|
||||
private static void checkDeviceAllocation(int deviceNum) {
|
||||
if (!s_simDeviceNameMap.containsKey(deviceNum)) {
|
||||
throw new IllegalArgumentException("Invalid XRPServo device number. Should be 4-5");
|
||||
throw new IllegalArgumentException("Invalid XRPServo device number. Should be 4-7");
|
||||
}
|
||||
|
||||
if (s_registeredDevices.contains(deviceNum)) {
|
||||
@@ -34,6 +34,8 @@ public class XRPServo {
|
||||
static {
|
||||
s_simDeviceNameMap.put(4, "servo1");
|
||||
s_simDeviceNameMap.put(5, "servo2");
|
||||
s_simDeviceNameMap.put(6, "servo3");
|
||||
s_simDeviceNameMap.put(7, "servo4");
|
||||
}
|
||||
|
||||
private final SimDouble m_simPosition;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::map<int, std::string> XRPServo::s_simDeviceMap = {{4, "servo1"},
|
||||
{5, "servo2"}};
|
||||
std::map<int, std::string> XRPServo::s_simDeviceMap = {
|
||||
{4, "servo1"}, {5, "servo2"}, {6, "servo3"}, {7, "servo4"}};
|
||||
|
||||
std::set<int> XRPServo::s_registeredDevices = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user