mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilib] Remove version writes (#8003)
This will use a much different mechanism in the future.
This commit is contained in:
@@ -10,11 +10,6 @@ import edu.wpi.first.hal.REVPHFaults;
|
||||
import edu.wpi.first.hal.REVPHJNI;
|
||||
import edu.wpi.first.hal.REVPHStickyFaults;
|
||||
import edu.wpi.first.hal.REVPHVersion;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,32 +35,6 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
final String fwVersion =
|
||||
version.firmwareMajor + "." + version.firmwareMinor + "." + version.firmwareFix;
|
||||
|
||||
if (version.firmwareMajor > 0 && RobotBase.isReal()) {
|
||||
// Write PH firmware version to roboRIO
|
||||
final String fileName = "REV_PH_" + String.format("%02d", module) + "_WPILib_Version.ini";
|
||||
final File file = new File("/tmp/frc_versions/" + fileName);
|
||||
try {
|
||||
if (file.exists() && !file.delete()) {
|
||||
throw new IOException("Failed to delete " + fileName);
|
||||
}
|
||||
|
||||
if (!file.createNewFile()) {
|
||||
throw new IOException("Failed to create new " + fileName);
|
||||
}
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("[Version]\n".getBytes(StandardCharsets.UTF_8));
|
||||
output.write("model=REV PH\n".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(
|
||||
("deviceID=" + Integer.toHexString(0x9052600 | module) + "\n")
|
||||
.getBytes(StandardCharsets.UTF_8));
|
||||
output.write(("currentVersion=" + fwVersion).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write " + fileName + ": " + ex, ex.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
// Check PH firmware version
|
||||
if (version.firmwareMajor > 0 && version.firmwareMajor < 22) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
@@ -15,11 +15,6 @@ import edu.wpi.first.networktables.NetworkTableEvent;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import edu.wpi.first.wpilibj.util.WPILibVersion;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -297,26 +292,6 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
m_robotCopy = robot;
|
||||
m_runMutex.unlock();
|
||||
|
||||
if (!isSimulation()) {
|
||||
final File file = new File("/tmp/frc_versions/FRC_Lib_Version.ini");
|
||||
try {
|
||||
if (file.exists() && !file.delete()) {
|
||||
throw new IOException("Failed to delete FRC_Lib_Version.ini");
|
||||
}
|
||||
|
||||
if (!file.createNewFile()) {
|
||||
throw new IOException("Failed to create new FRC_Lib_Version.ini");
|
||||
}
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("Java ".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(WPILibVersion.Version.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write FRC_Lib_Version.ini: " + ex, ex.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
boolean errorOnExit = false;
|
||||
try {
|
||||
robot.startCompetition();
|
||||
|
||||
Reference in New Issue
Block a user